Cancelbutton im JFileChooser disablen?

Math55

Mitglied
hi, jemand ne idee, wie das geht?

so hab ichs:

Code:
  JFileChooser fc = new JFileChooser();
  fc.setDialogTitle("testdialog");
  			
  ((JButton) ((JPanel) fc.getComponent(5)).getAccessibleContext()
 				 .getAccessibleChild(5).getAccessibleContext()
 				 .getAccessibleChild(2)).setVisible(false);
  			
  fc.showDialog(new JFrame(), "Ok");

allerdings bringt das immer diese exception:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: No such child: 5
at java.awt.Container.getComponent(Unknown Source)
at JFsl.main(JFsl.java:1264)

hab die zahlen schon verändert, bringt aber nix. gibts da in java5 schon was wie disableCancelButton(boolean)?

danke :)
 
Zurück