Hello All,
My question is about UIManager, L&F Settings and paintComponent(). Look at
the following code:
01 import javax.swing.*;
02 import java.awt.*;
03
04 public class TestButton extends JButton {
05 Icon icon;
06 public TestButton(String s, Icon i) {
07 super(s, i);
08 }
09 /*
10 public void paintComponent(Graphics g) {
11 icon.paintIcon(this, g, 10,10);
12 }
13 */
14 public static void main(String args[]) {
15 try {
16
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
17 } catch(Exception e) {
18 e.printStackTrace();
19 }
20 System.out.println("Using " + UIManager.getSystemLookAndFeelClassName()
+ " L&F");
21 JFrame jf = new JFrame("Test");
22 jf.setSize(150,70);
23 jf.getContentPane().setLayout(new FlowLayout());
24 Icon icon = UIManager.getIcon("RadioButton.icon");
25 TestButton tb = new TestButton("Test Button", icon);
26 jf.getContentPane().add(tb);
27 jf.setVisible(true);
28 }
29 }
My questions are:
1. This code runs fine on Windows showing a JButton with a RadioButton
icon. It uses the WindowsLookAndFeel. Just comment out lines 15-19 and it
throws an e
2. This code throws an exception when run on a Linux system. Why?
3. Where can I find a listing of all internal JDK icons (like the
RadioButton one being used) that I can obtain from UIManager?
4 Just comment out the paintComponent() method and the porgram throws an
exception. Why?
Can anyone throw some light on these issues?
Thank you in advance,
Anil
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing