Hello all,
I'm currently using WSAD 5.0 beta that supports jdk1.3 for the
server side. I have sucessfully simulated the setFocusable()
by using isFocustraversable() which is available in 1.3.
The problem is that the comboBox receives the focus even if
the isTraversable() method returns false. If you add a FocusListener
the focusGained method is NOT invoked but the purple 'focus line' still
appears on the combobox. So if you press the space bar the combobox
shows up.
This problem is of MetalLookAndFeel and was pointed out Allan Wick
earlier. Thanks Allan for your help !
Following the tip that he gave me I found that the
javax.swing.plaf.metal.MetalComboBoxButton received the focus and
I peeped into the source code of 1.3 . It showed me
...
...
public boolean isFocusTraversable() {
return (!comboBox.isEditable()) && comboBox.isEnabled();
}
which in normal conditions returns true.
...
...
I can neither make my comboBox editable nor can I disable it.
Moreover in jdk1.4 you'll see
...
...
public boolean isFocusTraversable() {
return false;
}
...
...
which is basically what i want.
So I extended this MetalComboBoxButton and now
I want to plug it in my MetalLookAndFeel.
For doing that, I set the client property in this way ...
public class MyTheme extends DefaultMetalTheme {
...
...
public void addCustomEntriesToTable(UIDefaults table) {
table.put("ComboBoxUI",new FOSMetalComboBoxUI());
}
}
and then plugged this theme in the MetalLookAndFeel.
On running the program it gave me an exception ...
java.lang.ExceptionInInitializerError: java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:335)
at javax.swing.UIDefaults.get(UIDefaults.java:113)
at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:53)
at javax.swing.UIDefaults.getUIClass(UIDefaults.java:368)
at javax.swing.UIDefaults.getUI(UIDefaults.java:441)
at javax.swing.UIManager.getUI(UIManager.java:616)
at javax.swing.JLabel.updateUI(JLabel.java:258)
at javax.swing.JLabel.<init>(JLabel.java:152)
at javax.swing.JLabel.<init>(JLabel.java:223)
at
javax.swing.DefaultListCellRenderer.<init>(DefaultListCellRenderer.java:76)
at
javax.swing.plaf.basic.BasicComboBoxUI.<clinit>(BasicComboBoxUI.java:114)
at
fos.client.utils.laf.AbhayTheme.addCustomEntriesToTable(MyTheme.java:94)
at
javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1089)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:408)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:435)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:895)
at javax.swing.UIManager.initialize(UIManager.java:991)
at javax.swing.UIManager.maybeInitialize(UIManager.java:974)
at javax.swing.UIManager.getUI(UIManager.java:607)
at javax.swing.JPanel.updateUI(JPanel.java:117)
at javax.swing.JPanel.<init>(JPanel.java:77)
at javax.swing.JPanel.<init>(JPanel.java:107)
at javax.swing.JRootPane.createGlassPane(JRootPane.java:302)
at javax.swing.JRootPane.<init>(JRootPane.java:209)
at javax.swing.JFrame.createRootPane(JFrame.java:220)
at javax.swing.JFrame.frameInit(JFrame.java:210)
at javax.swing.JFrame.<init>(JFrame.java:153)
at abhay_test.TestPanel.main(TestPanel.java:67)
The MyTheme.java:94 is the line :
table.put("ComboBoxUI",new FOSMetalComboBoxUI());
I dont know how to proceed further.. Can any one explain where i'm
wrong ?
Can anybody suggest me any other way of plugging in my customized
MetalComboBoxButton into the MetalLookAndFeel ?
Thankyou in advance.... and thankyou for reading such a long
mail !! (I had to be a little verbose for explaining the background)
Thanks again all of you.
regards
abhay
____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm
Be respectful! Clean up your posts before replying
____________________________________________________