Look and feel string : Look Feel « Swing JFC « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Swing JFC » Look FeelScreenshots 
Look and feel string
  
    
import java.awt.BorderLayout;
import java.awt.event.KeyEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class MainClass {
  final static JLabel l = new JLabel();

  public static void main(String[] args) {
    selectLookAndFeel();

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel pane = new JPanel();
    pane.setLayout(new BorderLayout());

    JButton b = new JButton("Press Me!");
    b.setMnemonic(KeyEvent.VK_P);
    b.setToolTipText("Click this button to see a message.");
    pane.add("North", b);

    l.setLabelFor(b);
    pane.add("South", l);

    f.setContentPane(pane);

    f.setSize(300100);
    f.setVisible(true);
  }

  private static void selectLookAndFeel() {
    String actualName = UIManager.getCrossPlatformLookAndFeelClassName();
    //actualName = UIManager.getSystemLookAndFeelClassName();
    //actualName = "com.sun.java.swing.plaf.mac.MacLookAndFeel";
    //actualName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    //actualName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

    try {
      UIManager.setLookAndFeel(actualName);
    catch (Exception e) {
      System.err.println("Could not get " + actualName + " look and feel for some reason.");
    }
  }
}

   
  
Related examples in the same category
1. Getting and Setting a Native Look and Feel
2. Retrieve the cross-platform look and feel
3. Default look and feel can be set in a file called 'swing.properties' located in the '/lib' directory.
4. Getting and Setting a Look and Feel
5. Set the look and feel using a system property on the command line
6. Selecting different looks and feels
7. Change the look and feelChange the look and feel
8. A Look-and-feel switcherA Look-and-feel switcher
9. Simple look and feel Example
10. Change Look and feelChange Look and feel
11. Get Installed Look And FeelsGet Installed Look And Feels
12. Get Swing Properties
13. awt.font.desktophints
14. Highlighted ButtonHighlighted Button
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.