-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c292c7
commit 3021ca8
Showing
6 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package ninjabrainbot.gui.buttons; | ||
|
||
import java.awt.Desktop; | ||
import java.net.URL; | ||
import java.util.Objects; | ||
|
||
import javax.swing.ImageIcon; | ||
|
||
import ninjabrainbot.Main; | ||
import ninjabrainbot.gui.style.StyleManager; | ||
|
||
public class WikiButton extends FlatButton { | ||
|
||
private final String wikiUrl; | ||
|
||
public WikiButton(StyleManager styleManager, String wikiUrl) { | ||
super(styleManager, new ImageIcon(Objects.requireNonNull(Main.class.getResource("/help_icon.png")))); | ||
this.wikiUrl = wikiUrl; | ||
setBackgroundColor(styleManager.currentTheme.COLOR_NEUTRAL); | ||
setHoverColor(styleManager.currentTheme.COLOR_NEUTRAL); | ||
addActionListener(__ -> openWikiPageInBrowser()); | ||
} | ||
|
||
private void openWikiPageInBrowser() { | ||
try { | ||
Desktop.getDesktop().browse(new URL(wikiUrl).toURI()); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.