diff --git a/.idea/artifacts/crashtestcardplayer.xml b/.idea/artifacts/crashtestcardplayer.xml index 720d1a9..be1b05e 100644 --- a/.idea/artifacts/crashtestcardplayer.xml +++ b/.idea/artifacts/crashtestcardplayer.xml @@ -8,6 +8,7 @@ + \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..1be159b Binary files /dev/null and b/icon.png differ diff --git a/src/de/ctdo/crashtest/cardplayer/MainFrame.java b/src/de/ctdo/crashtest/cardplayer/MainFrame.java index cf632de..6bf6799 100644 --- a/src/de/ctdo/crashtest/cardplayer/MainFrame.java +++ b/src/de/ctdo/crashtest/cardplayer/MainFrame.java @@ -2,10 +2,12 @@ package de.ctdo.crashtest.cardplayer; import de.ctdo.crashtest.cardplayer.irc.*; import javax.swing.*; +import javax.swing.UIManager.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.*; +import java.net.URL; import java.util.Vector; public class MainFrame extends JFrame { @@ -19,10 +21,44 @@ public class MainFrame extends JFrame { setPreferredSize(new Dimension(800,500)); irc = new IrcClient(HostHelper.getHostName().toLowerCase(), "#crashtest", "irc.ctdo.de", 6667); + + setIcon(); + setLookAndFeel(); initGui(); setVisible(true); } + private void setIcon() { + try { + URL url = Main.class.getResource("/icon.png"); + if(url != null) { + ImageIcon icon = new ImageIcon(url); + this.setIconImage(icon.getImage()); + } + } catch (Exception ignored) { } + } + + + private void setLookAndFeel() { + try { + for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + UIManager.setLookAndFeel(info.getClassName()); + + UIManager.put("nimbusLightBackground", Color.BLACK); + UIManager.put("text", new Color(0, 240, 0)); + UIManager.put("nimbusSelectionBackground", new Color(0 ,98, 0)); + UIManager.put("nimbusFocus", new Color(0 ,255, 0)); + UIManager.put("RootPane.background", Color.BLACK); + + break; + } + } + } catch (Exception e) { + // If Nimbus is not available, you can set the GUI to another look and feel. + } + } + private void initGui() { Container contentPane = this.getContentPane();