changed layout a bit

This commit is contained in:
Lucas Pleß 2012-06-15 12:30:42 +02:00
parent 52c14c4d24
commit e45efd892b
3 changed files with 37 additions and 0 deletions

View File

@ -8,6 +8,7 @@
<element id="module-output" name="crashtestCardPlayer" />
<element id="extracted-dir" path="$PROJECT_DIR$/libs/jerklib.jar" path-in-jar="/" />
<element id="file-copy" path="$PROJECT_DIR$/messages.txt" />
<element id="file-copy" path="$PROJECT_DIR$/icon.png" />
</root>
</artifact>
</component>

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

View File

@ -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();