-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
None
-
beta2
-
sparc
-
solaris_7
The following code should make it so that the background color will turn to blue when a button is clicked, it doesn't work when the app is launched via web start.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
public class UIManagerTester {
public static void main( String[] args ) {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch(Exception e) {
e.printStackTrace();
}
new JButton();
UIManager.put("Label.foreground", new ColorUIResource(Color.red));
UIManager.put("Button.select", new ColorUIResource(Color.blue));
UIManager.put("Button.foreground", new ColorUIResource(Color.red));
UIManager.put("Button.background", new ColorUIResource(Color.black));
JFrame frame = new JFrame( "Test" );
JPanel aPanel = (JPanel) frame.getContentPane();
aPanel.setLayout(new FlowLayout());
aPanel.add(new JLabel("This is test label"));
JButton button = new JButton("Test Button");
button.setContentAreaFilled(true);
aPanel.add(button);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.pack();
frame.show();
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
public class UIManagerTester {
public static void main( String[] args ) {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch(Exception e) {
e.printStackTrace();
}
new JButton();
UIManager.put("Label.foreground", new ColorUIResource(Color.red));
UIManager.put("Button.select", new ColorUIResource(Color.blue));
UIManager.put("Button.foreground", new ColorUIResource(Color.red));
UIManager.put("Button.background", new ColorUIResource(Color.black));
JFrame frame = new JFrame( "Test" );
JPanel aPanel = (JPanel) frame.getContentPane();
aPanel.setLayout(new FlowLayout());
aPanel.add(new JLabel("This is test label"));
JButton button = new JButton("Test Button");
button.setContentAreaFilled(true);
aPanel.add(button);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.pack();
frame.show();
}
}