|
JLAFChooser
Java LookAndFeel chooser for Swing applications
DescriptionJLAFChooser provides you possibility to choose any from available from classpath LookAndFeel's. In Swing applications you as usual set LookAndFeel in your code, so user usually can't choose LookAndFeel by himself. JLAFChooser will give you possibility to choose LookAndFeel in running application, and, for example, save it's name in application settings to apply at start. API of JLAFChooser is similar to JColorChooser. It has few static methods to show dialog window with LookAndFeel chooser, and few methods to work directly with JLAFChooser. For any bugreports, feature requests or suggestions feel free to mail me. Screenshots
DownloadUser GuideRun to touch itJar file of JLAFChooser has Main class, so you can run it to see how it works on your system: java -jar jlafchooser-1.1.jar Simple usageThis will show JLAFChooser, apply and return selected LookAndFeel on OK button press. Same API to get LookAndFeel name of class name: JLAFChooser.showDialogLAF(null, null, true) Component usageThis will add JLAFChooser to any Swing container, so you can wrap it with application's Settings dialog: JLAFChooser chooser = new JLAFChooser(); JPanel panel = new JPanel(new BorderLayout()); panel.add(chooser, BorderLayout.CENTER); VariantsIf you want user to select LookAndFeel, but don't want to apply it: JLAFChooser chooser = new JLAFChooser(false); This will create same chooser, but without right panel, so Autoapply checkbox and Apply buttons will be hidden. Same if you want to show LookAndFeel chooser dialog, but don't want to apply it, just get user input: JLAFChooser.showDialogLAF(null, null, false); This will hide right panel with apply options, and OK button will only dispose dialog, without applying selected LookAndFeel How it worksJLAFChooser creates dialog and starts SwingWorker to scan classpath in background. LAFScanner scans folders and jars in classpath, looking for classes with *LookAndFeel.class names, then constructing it with reflections to check for construction possibility and isSupported flag. If LookAndFeel loaded - it will be added to selection list. Performing scan operations in background makes UI responsible all the time, without EDT hanging. Don't fear to use it!Scan operation takes less then 100 milliseconds, even for scanning rt.jar and other any big jar files, so with standard LookAndFeel set it will be loaded faster, than JDialog will be shown. If you have about 20 LookAndFeels in classpath - you will notice list updates, but it will not make you wait - Swing is fast enough our days. |
Sign in to add a comment
