List of usage examples for javax.swing JTextField getClientProperty
public final Object getClientProperty(Object key)
From source file:org.eclim.installer.step.VimStep.java
/** * {@inheritDoc}/* ww w. j a va 2 s. c o m*/ * @see org.formic.wizard.step.GuiStep#init() */ public Component init() { GuiForm form = createForm(); String files = fieldName("files"); fileChooser = new FileChooser(JFileChooser.DIRECTORIES_ONLY); // allow just .vim dirs to not be hidden fileChooser.getFileChooser().setFileHidingEnabled(false); fileChooser.getFileChooser().addChoosableFileFilter(new FileFilter() { public boolean accept(java.io.File f) { String path = f.getAbsolutePath(); return f.isDirectory() && (path.matches(".*/\\.vim(/.*|$)") || !path.matches(".*/\\..*")); } public String getDescription() { return null; } }); String skip = fieldName("skip"); skipCheckBox = new JCheckBox(Installer.getString(skip)); skipCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean selected = ((JCheckBox) e.getSource()).isSelected(); JTextField fileField = fileChooser.getTextField(); fileField.setEnabled(!selected); fileChooser.getButton().setEnabled(!selected); if (dirList != null) { dirList.setEnabled(!selected); } // hacky Validator validator = (Validator) fileField.getClientProperty("validator"); setValid(selected || validator.isValid(fileField.getText())); } }); panel = new JPanel(new MigLayout("wrap 2", "[fill]", "[] [] [] [fill, grow]")); panel.add(form.createMessagePanel(), "span"); panel.add(new JLabel(Installer.getString(files)), "split"); panel.add(fileChooser, "skip"); panel.add(skipCheckBox, "span"); form.bind(files, fileChooser.getTextField(), new ValidatorBuilder().required().isDirectory().fileExists().isWritable().validator()); return panel; }