Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Default Buttons in Java to Make Them Look "Better"

I'm essentially trying to mimic the default windows xp simple calculator. When I change the background colours of the buttons in Java it makes them look very flat and "boring". I want to make the buttons look as close as possible to the buttons in the Windows XP calculator.

Here is an image comparing mine to WinXp's: calc example

Is there some kind of method I can use to change the style of the buttons much like you can do in Visual Basic to make the buttons almost pop more or look 3D like the Windows Xp Calculator.

The default buttons in Java are sort of what I'm looking for except there not white there more of a blue kind of colour in a gradient.

Is this possible, or am I stuck with ugly button?

like image 705
ComputerLocus Avatar asked Apr 24 '12 20:04

ComputerLocus


People also ask

How do you change button properties?

To edit a Button's properties, double left click or single right click the Button object. The Button Properties dialog will be displayed.

How do I change the color of a JButton in Java?

Normally with Java Swing you can set the background color of a button with: myJButton. setBackground(Color. RED);


1 Answers

Try setting the system look and feel at the beginning of the main method:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

This will load all Swing widgets with a native-ish look.

If you are insterested in what you are actually doing with this command, Oracle has a nice tutorial regarding look and feels: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

like image 55
Jakub Zaverka Avatar answered Oct 23 '22 22:10

Jakub Zaverka