Browse Source

Major changes

Changed the look and feel
Now uses WebLaF
master
Sogomn 9 years ago
parent
commit
ea3c9f6f72
  1. 26
      Ratty/src/de/sogomn/rat/Ratty.java
  2. 26
      Ratty/src/de/sogomn/rat/server/gui/RattyGui.java

26
Ratty/src/de/sogomn/rat/Ratty.java

@ -1,15 +1,13 @@
package de.sogomn.rat;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
import com.alee.laf.WebLookAndFeel;
import de.sogomn.engine.util.FileUtils;
import de.sogomn.rat.server.ActiveServer;
@ -30,23 +28,6 @@ public final class Ratty {
//...
}
private static void setLookAndFeel() {
final NimbusLookAndFeel nimbus = new NimbusLookAndFeel();
final UIDefaults defaults = nimbus.getDefaults();
defaults.put("control", new Color(245, 245, 245));
defaults.put("nimbusBase", new Color(225, 225, 225));
defaults.put("Table:\"Table.cellRenderer\".background", new Color(225, 225, 225));
defaults.put("Table.alternateRowColor", new Color(175, 175, 175));
defaults.put("Tree.background", new Color(245, 245, 245));
try {
UIManager.setLookAndFeel(nimbus);
} catch (final Exception ex) {
ex.printStackTrace();
}
}
private static void addToStartup() {
try {
final URI sourceUri = Ratty.class.getProtectionDomain().getCodeSource().getLocation().toURI();
@ -87,7 +68,8 @@ public final class Ratty {
}
public static void main(final String[] args) {
setLookAndFeel();
//setLookAndFeel();
WebLookAndFeel.install();
if (CLIENT) {
addToStartup();

26
Ratty/src/de/sogomn/rat/server/gui/RattyGui.java

@ -1,5 +1,6 @@
package de.sogomn.rat.server.gui;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
@ -32,6 +33,8 @@ public final class RattyGui {
private IGuiController controller;
private static final Dimension SIZE = new Dimension(800, 400);
private static final String[] HEADERS = {
"ID",
"Name",
@ -75,9 +78,27 @@ public final class RattyGui {
}
public RattyGui() {
final DefaultTableModel model = new DefaultTableModel() {
private static final long serialVersionUID = 365970129123372132L;
@Override
public boolean isCellEditable(final int row, final int column) {
return false;
}
@Override
public Class<?> getColumnClass(final int columnIndex) {
if (columnIndex == 5) {
return Boolean.class;
}
return super.getColumnClass(columnIndex);
}
};
frame = new JFrame();
table = new JTable();
tableModel = (DefaultTableModel)table.getModel();
tableModel = model;
scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
menu = new JPopupMenu();
@ -100,12 +121,13 @@ public final class RattyGui {
scrollPane.setBorder(null);
tableModel.setColumnIdentifiers(HEADERS);
table.setEnabled(false);
table.setComponentPopupMenu(menu);
table.addMouseListener(mouseAdapter);
table.setModel(tableModel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(scrollPane);
frame.setPreferredSize(SIZE);
frame.pack();
frame.setLocationByPlatform(true);
frame.setIconImages(GUI_ICONS);

Loading…
Cancel
Save