Try to force equal look and feel across platforms. Default font type: Sans Serif, Plain, 12pt.

This commit is contained in:
dev
2011-07-27 09:55:43 +00:00
parent 3929c6c4b6
commit 5dfe3f9052
5 changed files with 51 additions and 6 deletions

View File

@ -4,6 +4,7 @@ package net.i2p.itoopie;
* Main.java
*/
import java.awt.Font;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
@ -16,6 +17,7 @@ import javax.net.ssl.HttpsURLConnection;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.FontUIResource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -24,6 +26,7 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.configuration.ConfigurationManager;
import net.i2p.itoopie.gui.GUIHelper;
import net.i2p.itoopie.gui.TrayManager;
import net.i2p.itoopie.gui.WindowHandler;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
@ -77,12 +80,13 @@ public class Main {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
GUIHelper.setDefaultStyle();
} catch (ClassNotFoundException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (UnsupportedLookAndFeelException ex) {
}
final Main main = new Main();
main.launchForeverLoop();
@ -95,7 +99,7 @@ public class Main {
// Popup Main window.
WindowHandler.toggleFrames();
// testStuff(); // Delete Me
//testStuff(); // Delete Me
}
@SuppressWarnings("static-access")
@ -315,4 +319,5 @@ public class Main {
}
*/
}
}

View File

@ -141,15 +141,13 @@ public class CertificateGUI {
(new Thread(){
@Override
public void run(){
System.out.println("CertGUI Thread populateInfo() - sleep");
try {
Thread.sleep(250);
Thread.sleep(100);
} catch (InterruptedException e) {}
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
System.out.println("CertGUI Thread invokeLater populateInfo()");
Main.fireNewChange();
}
});

View File

@ -1,14 +1,17 @@
package net.i2p.itoopie.gui;
import java.awt.Color;
import java.awt.Font;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
public class GUIHelper {
private final static Color VERY_LIGHT = new Color(230,230,230);
private final static Color LIGHT = new Color(215,215,215);
private final static Color MEDIUM = new Color (175,175,175);
private final static Color DARK = new Color(145,145,145);
public final static FontUIResource DEFAULT_FONT = new FontUIResource(Font.SANS_SERIF,Font.PLAIN,12);
public static void setDefaultStyle(){
//Selected tab
@ -21,5 +24,41 @@ public class GUIHelper {
UIManager.put("TabbedPane.contentAreaColor", VERY_LIGHT);
//Button and unselected tab background
UIManager.put("Button.background", Color.WHITE);
setDefaultFonts();
}
private static void setDefaultFonts(){
UIManager.put("Button.font", DEFAULT_FONT);
UIManager.put("ToggleButton.font", DEFAULT_FONT);
UIManager.put("RadioButton.font", DEFAULT_FONT);
UIManager.put("CheckBox.font", DEFAULT_FONT);
UIManager.put("ColorChooser.font", DEFAULT_FONT);
UIManager.put("ComboBox.font", DEFAULT_FONT);
UIManager.put("Label.font", DEFAULT_FONT);
UIManager.put("List.font", DEFAULT_FONT);
UIManager.put("MenuBar.font", DEFAULT_FONT);
UIManager.put("MenuItem.font", DEFAULT_FONT);
UIManager.put("RadioButtonMenuItem.font", DEFAULT_FONT);
UIManager.put("CheckBoxMenuItem.font", DEFAULT_FONT);
UIManager.put("Menu.font", DEFAULT_FONT);
UIManager.put("PopupMenu.font", DEFAULT_FONT);
UIManager.put("OptionPane.font", DEFAULT_FONT);
UIManager.put("Panel.font", DEFAULT_FONT);
UIManager.put("ProgressBar.font", DEFAULT_FONT);
UIManager.put("ScrollPane.font", DEFAULT_FONT);
UIManager.put("Viewport.font", DEFAULT_FONT);
UIManager.put("TabbedPane.font", DEFAULT_FONT);
UIManager.put("Table.font", DEFAULT_FONT);
UIManager.put("TableHeader.font", DEFAULT_FONT);
UIManager.put("TextField.font", DEFAULT_FONT);
UIManager.put("PasswordField.font", DEFAULT_FONT);
UIManager.put("TextArea.font", DEFAULT_FONT);
UIManager.put("TextPane.font", DEFAULT_FONT);
UIManager.put("EditorPane.font", DEFAULT_FONT);
UIManager.put("TitledBorder.font", DEFAULT_FONT);
UIManager.put("ToolBar.font", DEFAULT_FONT);
UIManager.put("ToolTip.font", DEFAULT_FONT);
UIManager.put("Tree.font", DEFAULT_FONT);
}
}

View File

@ -128,7 +128,6 @@ public class OverviewTab extends TabLogoPanel {
@Override
public void run() {
while (true) {
System.out.println("Overview populateInfo()");
populateInfo();
try {
Thread.sleep(updateInterval);

View File

@ -10,6 +10,8 @@ import javax.swing.SwingConstants;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
@ -123,6 +125,8 @@ public class SettingsFrame extends RegisteredFrame{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JPanel networkPanel = new JPanel();
networkPanel.setLayout(null);
networkPanel.setBounds(0, 0, 426, 89);