Currently, I've been trying to disable the JTextField of a JFileChooser that I am working.
At first blush I thought: "piece of cake"
Unfortunately, the Java Standard API does not implement it. So I've tried something like this to reach my goal.
Components[] comp = myJFileChooser.getComponents();
for(Component c: comp) {
if(c instanceof JTextField) {
c.setVisible(false);
}
}
It didn't work out.
But, the following idea worked :)
Click here to check out the solution.
Indeed the dificulty of this problem is to get the reference of the target JTextField. A single call of myJFileChooser.getComponents() is not enough because the text field is not directly involved by the JFileChooser.
Saturday, December 5, 2009
Subscribe to:
Posts (Atom)