private JPanel createPanel2() { JPanel panel = new JPanel(); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS)); panel.setBorder( BorderFactory.createCompoundBorder( new JideTitledBorder( new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH), "AutoCompletion with list and tree", JideTitledBorder.LEADING, JideTitledBorder.ABOVE_TOP), BorderFactory.createEmptyBorder(0, 0, 0, 0))); // create tree combobox final JTextField treeTextField = new JTextField(); treeTextField.setName("AutoCompletion JTextField with JTree"); SelectAllUtils.install(treeTextField); final JTree tree = new JTree(); tree.setVisibleRowCount(10); final TreeSearchable searchable = new TreeSearchable(tree); searchable.setRecursive(true); new AutoCompletion(treeTextField, searchable); panel.add(new JLabel("AutoCompletion JTextField with JTree")); panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); panel.add(treeTextField); panel.add(Box.createVerticalStrut(2), JideBoxLayout.FIX); panel.add(new JScrollPane(tree)); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); // create font name combobox final JTextField fontNameTextField = new JTextField(); fontNameTextField.setName("AutoCompletion JTextField with JList"); SelectAllUtils.install(fontNameTextField); final JList fontNameList = new JList(_fontNames); fontNameList.setVisibleRowCount(10); new AutoCompletion(fontNameTextField, new ListSearchable(fontNameList)); panel.add(new JLabel("AutoCompletion JTextField with JList")); panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); panel.add(fontNameTextField); panel.add(Box.createVerticalStrut(2), JideBoxLayout.FIX); panel.add(new JScrollPane(fontNameList)); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); return panel; }
private JPanel createPanel1() { JPanel panel = new JPanel(); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS)); panel.setBorder( BorderFactory.createCompoundBorder( new JideTitledBorder( new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH), "AutoCompletion combo box and text field", JideTitledBorder.LEADING, JideTitledBorder.ABOVE_TOP), BorderFactory.createEmptyBorder(0, 0, 0, 0))); JComboBox autoCompletionComboBox = new AutoCompletionComboBox(_fontNames); autoCompletionComboBox.setName("AutoCompletion JComboBox (Strict)"); autoCompletionComboBox.setToolTipText("AutoCompletion JComboBox (Strict)"); panel.add(new JLabel("AutoCompletion JComboBox (Strict)")); panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); panel.add(autoCompletionComboBox); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); AutoCompletionComboBox autoCompletionComboBoxNotStrict = new AutoCompletionComboBox(_fontNames); autoCompletionComboBoxNotStrict.setStrict(false); autoCompletionComboBoxNotStrict.setName("AutoCompletion JComboBox (Not strict)"); autoCompletionComboBoxNotStrict.setToolTipText("AutoCompletion JComboBox (Not strict)"); panel.add(new JLabel("AutoCompletion JComboBox (Not strict)")); panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); panel.add(autoCompletionComboBoxNotStrict); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); // create tree combobox final JTextField textField = new JTextField(); textField.setName("AutoCompletion JTextField with a hidden data"); SelectAllUtils.install(textField); new AutoCompletion(textField, _fontList); panel.add(new JLabel("AutoCompletion JTextField with a hidden data")); panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); panel.add(textField); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); // panel.add(Box.createVerticalStrut(24), JideBoxLayout.FIX); // panel.add(new JLabel("As comparisons:")); // panel.add(Box.createVerticalStrut(6), JideBoxLayout.FIX); // // JComboBox searchableComboBox = new JComboBox(_fontNames); // searchableComboBox.setEditable(false); // SearchableUtils.installSearchable(searchableComboBox); // searchableComboBox.setToolTipText("Searchable JComboBox"); // panel.add(new JLabel("Searchable JComboBox")); // panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); // panel.add(searchableComboBox); // panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); // // JTextField completionTextField = new JTextField(); // new ListCompletion(completionTextField, _fontNames); // completionTextField.setToolTipText("Completion JTextField (not auto-complete)"); // panel.add(new JLabel("Completion JTextField (not auto-complete)")); // panel.add(Box.createVerticalStrut(3), JideBoxLayout.FIX); // panel.add(completionTextField); // panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); return panel; }