Java Code Examples for org.jdesktop.swingx.autocomplete.AutoCompleteDecorator#decorate()
The following examples show how to use
org.jdesktop.swingx.autocomplete.AutoCompleteDecorator#decorate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Main.java From desktop with The Unlicense | 7 votes |
/** * @main */ public Main() { initComponents(); setLocationRelativeTo(this); this.setTitle("EVIL INSULT GENERATOR"); this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/com/imgs/app-icon.png"))); addCombobox(); AutoCompleteDecorator.decorate(this.cmbLanguage); DefaultListCellRenderer dlcr = new DefaultListCellRenderer(); dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER); cmbLanguage.setRenderer(dlcr); StyledDocument doc = txtPaneShow.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); try { Document doc1 = Jsoup.connect("http://evilinsult.com/generate_insult.php?lang=en").get(); Elements links = doc1.select("body"); for (Element link : links) { txtPaneShow.setText("\n" + link.text()); } } catch (RuntimeException e) { throw e; } catch (Exception ex) { txtPaneShow.setText("Insult Outage! Please Check Your Internet Connection And Try Again In Three Minutes"); } }
Example 2
Source File: OrderPanel.java From Java-Simple-Hotel-Management with GNU General Public License v3.0 | 5 votes |
public OrderPanel(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); this.getContentPane().setBackground(new Color(241,241,242)); searchHelper(); populateFoodTable(); populateItemTable(); AutoCompleteDecorator.decorate(combo_booking); }
Example 3
Source File: UITools.java From MtgDesktopCompanion with GNU General Public License v3.0 | 5 votes |
public static void autocomplete(JTextField txtSearch) { final List<String> res = new ArrayList<>(); txtSearch.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { res.clear(); if(!txtSearch.getText().isEmpty()) res.addAll(MTGControler.getInstance().getEnabled(MTGCardsIndexer.class).suggestCardName(txtSearch.getText())); } }); AutoCompleteDecorator.decorate(txtSearch,res,false); }
Example 4
Source File: PaymentPanel.java From Java-Simple-Hotel-Management with GNU General Public License v3.0 | 4 votes |
public PaymentPanel(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); searchHelper(); AutoCompleteDecorator.decorate(combo_booking); }
Example 5
Source File: SearchAlignment.java From AML-Project with Apache License 2.0 | 4 votes |
public SearchAlignment() { super(); this.setTitle("Search Alignment"); this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); this.setPreferredSize(new Dimension(700,140)); aml = AML.getInstance(); //The containing panel dialogPanel = new JPanel(); cl = new CardLayout(); dialogPanel.setLayout(cl); //The search panel JLabel desc = new JLabel("Enter Search Term: (min 3 characters)"); Font font = desc.getFont(); boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize()); desc.setFont(boldFont); JPanel labelPanel = new JPanel(); labelPanel.add(desc); Alignment a = AML.getInstance().getAlignment(); int total = a.size(); mappings = new ArrayList<String>(total); for(int i = 0; i < total; i++) { Mapping m = a.get(i); String map = aml.getSource().getName(m.getSourceId()); map += " = "; map += aml.getTarget().getName(m.getTargetId()); mappings.add(map); } searchField = new JTextArea(1,60); searchField.setEditable(true); KeyStroke keyStroke = KeyStroke.getKeyStroke("ENTER"); Object actionKey = searchField.getInputMap( JComponent.WHEN_FOCUSED).get(keyStroke); searchField.getActionMap().put(actionKey, wrapper); AutoCompleteDecorator.decorate(searchField,mappings,false); JPanel selectionPanel = new JPanel(); selectionPanel.add(searchField); cancel = new JButton("Cancel"); cancel.setPreferredSize(new Dimension(70,28)); cancel.addActionListener(this); find = new JButton("Find"); find.setPreferredSize(new Dimension(70,28)); find.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.add(cancel); buttonPanel.add(find); searchPanel = new JPanel(); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.PAGE_AXIS)); searchPanel.add(labelPanel); searchPanel.add(selectionPanel); searchPanel.add(buttonPanel); dialogPanel.add(searchPanel, "Search"); cl.show(dialogPanel, "Search"); this.add(dialogPanel); this.pack(); GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); int left = g.getCenterPoint().x - (int)(this.getPreferredSize().width / 2); this.setLocation(left, 0); this.setVisible(true); }
Example 6
Source File: KeySelectionPanel.java From nextreports-designer with Apache License 2.0 | 4 votes |
public KeySelectionPanel(boolean showValueField) { this.showValueField = showValueField; keysCombo = new JComboBox(); keysCombo.setEditable(true); AutoCompleteDecorator.decorate(keysCombo); keysCombo.setMinimumSize(dim); keysCombo.setPreferredSize(dim); if (showValueField) { keysCombo.setEnabled(false); } List<String> keys = NextReportsUtil.getReportKeys(); for (String key : keys) { keysCombo.addItem(key); } valueField = new JTextField(); valueField.setMinimumSize(dim); valueField.setPreferredSize(dim); allCheck = new JCheckBox(I18NSupport.getString("languages.keys.selection.key.all")); setLayout(new GridBagLayout()); add(new JLabel(I18NSupport.getString("languages.keys.selection.key")), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(keysCombo, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); if (showValueField) { add(new JLabel(I18NSupport.getString("languages.keys.selection.value")), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(valueField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); } else { add(allCheck, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); } }
Example 7
Source File: ControlPanel.java From Java-Simple-Hotel-Management with GNU General Public License v3.0 | 3 votes |
public ControlPanel() { initComponents(); // UIManager.setLookAndFeel(UIManager); this.getContentPane().setBackground(new Color(241,241,242)); searchCustomerHelper(); AutoCompleteDecorator.decorate(combo_users); date_checkIn.setDate(new Date()); //populateWithBookingData(); }