Tips for Tuning your Graphical User InterfaceThough some developers do not like the Swing components, which is due to some optical flaws. But in fact, these flaws are caused by default settings that are maybe chosen a bit awkwardly. Some improvements require the SweenJet API, others can be done without it.
UI-themes: New fonts and colorsIf you want to use other fonts or colors you may use UI-themes. Such a theme defines a default font, a default foreground and a default background color. Additionally, fonts/colors can be set for single component types.A UI-theme can be defined in a simple property file: # myThemeUI.properties name=MyTheme font=Arial-0-11 background=[245,245,250] foreground=darkGray TextField.background=white TextArea.background=white TextField.foreground=black TextArea.foreground=black ProgressBar.foreground=[153,153,255] ToolTip.background=[234,234,255] List.background=whiteNow, the UI-theme can be applied. This must be done as soon as possible and before any components is initialized. try { // Call this method before any component is initialized. SwingUtils.applyUITheme( getClass().getResource("/myThemeUI.properties")); } catch (IOException ioe) { ioe.printStackTrace(); } Splash screensSplash screens give important feedback to the user. If such a screen pops up, the user knows that the application launches.IconSplashScreen splashScreen = new IconSplashScreen(); splashScreen.setIcon(new ImageIcon( getClass().getResource("mySplashScreen.png"))); splashScreen.setVisible(true); // Do some stuff that needs some time. // ... // ... splashScreen.setVisible(false); Multi-line tooltipsSweenJet provides a simple solution for the recurrent problem of tooltips that are too long.UIManager.put("ToolTipUI", "org.municware.sweenjet.swing.AdvancedToolTipUI"); UIManager.put("AdvancedToolTipUI.preferredRowCharCount", 25); Text anti-aliasingAnti-aliasing makes text more comfortable to read. Fortunately, Swing supports anti-aliasing. You only have to set the system propertyswing.aatext
to true .
|
|
© Copyright by Julius Adorf 2006 • Web-design by Julius Adorf • Last modified: 02 NOV 2006 |