JButton displayed differently under Windows 2000 vs Windows XP

Hello,

I have an JButton that looks just fine under Windows 2000, but when I run my application under Windows XP, it does not look right.

The code to create the button is:

button =new javax.swing.JButton();

button.setBorder(null);

button.setBorderPainted(false);

button.setFocusPainted(false);

button.setFocusable(false);

button.setPreferredSize(new java.awt.Dimension(80, 73));

It is a large button with no border, but contains an image.

Like I said, it looks fine under 2000. No border is shown. But under XP, the border is still being shown.

Any ideas on why this is happening and is there anyway to have the border removed under XP?

Thanks.

-Jeff

[940 byte] By [k0balta] at [2007-11-27 10:15:21]
# 1

Probably because of the L&F you are using, which is?

bsampieria at 2007-7-28 15:39:00 > top of Java-index,Desktop,Core GUI APIs...
# 2

I am using:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Message was edited by:

k0balt

k0balta at 2007-7-28 15:39:00 > top of Java-index,Desktop,Core GUI APIs...
# 3

Well, probably the system L&F for XP doesn't let you change that stuff, cuz that would kinda defeat the point of the system L&F's definition of what a button is. The point of the system L&F is to let things look as much like other native OS apps as possible. You could use a JLabel and mouse listeners, I guess.

bsampieria at 2007-7-28 15:39:00 > top of Java-index,Desktop,Core GUI APIs...
# 4

Your code is exactly why the buttons don't look the same. There may be a windows XP look and feel, check out the java trail for the possible L&Fs if you want to standardize the way your app looks.

You can also look on the internet for free L&F packs that are just jar files you add to your project

kerryblue19a at 2007-7-28 15:39:00 > top of Java-index,Desktop,Core GUI APIs...
# 5

Thanks.

I may just use the JLabel with a mouse listener...

k0balta at 2007-7-28 15:39:00 > top of Java-index,Desktop,Core GUI APIs...