-
How to get Java GUI to look like Windows
I am diving into Java, and I wanted to create a simple program with two text boxes, a few labels, and a button.
The problem is, I want the java program to look exactly like a windows program does. I am talking about window decorations and button styles, etc.
When I use swing to create my GUI, it looks javaish. How can I make it look windowsish?
(Yes, I have set the "JFrame.setDefaultLookAndFeelDecorated" to false.
-
hi,
use java.awt.* instead of javax.swing.* and read java.awt.* api because in this api JButton is Button like that so read that and use it to look the gui same as windows look
Regards
Rahul Vyas
-
you can also do it within swing, since swing has a plugable look and feel. see http://java.sun.com/docs/books/tutor...misc/plaf.html
-
Add this code to your main method.
Code:
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception e)
{
System.out.println("Unable to load Windows look and feel");
}
-
All of your suggestions worked great. I am going to use the last, because my code is already in swing.
Thanks.
-
What about changing back?
Apreciated the post and the answer but i have another question:
What about changing back to Java's look ?
I was thinking about inserting an option where the user could switch between them.
Thanks.
Similar Threads
-
By Anonymous in forum Java
Replies: 0
Last Post: 01-31-2002, 11:08 PM
-
Replies: 1
Last Post: 03-27-2001, 10:45 AM
-
By Sam Goldberg in forum Java
Replies: 0
Last Post: 09-26-2000, 09:52 AM
-
By JJ in forum Enterprise
Replies: 1
Last Post: 07-06-2000, 04:50 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|