Have you had enough of the default theme of your first java
application? TinyLAF provides an alternative theme for your java application that I'm
sure you're going to love. They provide some screenshots of how
would your application window look like.
Using the TinyLAF
To use the TinyLaf, you need to download its binary and add it to
your java build path. You also need to download its source code so you
can choose which theme you wanted to use. Extract the archieved file and look
for the themes directory. Now you have to choose which theme you would like to
use. Copy the particular theme to your project root directory and rename it to
"Default.theme". Now everything is setup correctly. I recommend you
to use Eclipse
IDE for
easier and simpler addition of your third party libraries.
import java.awt.FlowLayout; import java.awt.Toolkit; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class Tiny extends javax.swing.JFrame{ public static void main(String ars[]){ new Tiny(); } public void setLookAndFeel(){ Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel("de.muntjak.tinylookandfeel.TinyLookAndFeel"); SwingUtilities.updateComponentTreeUI(this); } catch(Exception ex) { ex.printStackTrace(); } } public Tiny(){ setLookAndFeel(); setTitle("Java Look and Feel"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); add(new javax.swing.JButton("Hello")); add(new javax.swing.JCheckBox("World!")); add(new javax.swing.JLabel("TinyLaf")); add(new javax.swing.JComboBox(new String[]{"Java"})); add(new javax.swing.JButton("Theme!")); pack(); setLocationRelativeTo(null); setVisible(true); } }You can copy and paste the code above on your editor and compile it. The generated result would look something like this:
Nightly Look And Feel
Forest Look And Feel
Silver Look And Feel
That's basically all it is. Pretty is, eh? If you are having a
trouble to using the TinyLAF, just ask here on this post and I'm more than glad
to answer your question. Have nice day to all of you!
No comments:
Post a Comment