Java Code Examples for com.alee.laf.text.WebTextField#setInputPrompt()
The following examples show how to use
com.alee.laf.text.WebTextField#setInputPrompt() .
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: WebTextFieldExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebTextField textField = new WebTextField ( getStyleId (), 20 ); textField.setInputPrompt ( getPreviewLanguagePrefix () + "prompt" ); return CollectionUtils.asList ( textField ); }
Example 2
Source File: WebTextFieldExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebTextField textField = new WebTextField ( getStyleId (), 18 ); textField.setInputPrompt ( getPreviewLanguagePrefix () + "prompt" ); textField.setLeadingComponent ( new WebImage ( DemoStyles.leadingImage, DemoIcons.key16 ) ); return CollectionUtils.asList ( textField ); }
Example 3
Source File: WebTextFieldExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebTextField textField = new WebTextField ( getStyleId (), 18 ); textField.setInputPrompt ( getPreviewLanguagePrefix () + "prompt" ); textField.setTrailingComponent ( new WebImage ( DemoStyles.trailingImage, DemoIcons.github16 ) ); return CollectionUtils.asList ( textField ); }
Example 4
Source File: DecompilerPanel.java From Cafebabe with GNU General Public License v3.0 | 4 votes |
public DecompilerPanel(ClassNode cn, MethodNode mn) { this.dp = new DecompilerTextArea(); dp.setText(CFR.decompile(cn, mn)); this.label = new JLabel("CFR Decompiler 0.145"); this.setLayout(new BorderLayout(0, 0)); JPanel lpad = new JPanel(); lpad.setBorder(new EmptyBorder(1, 5, 0, 1)); lpad.setLayout(new GridLayout()); lpad.add(label); JPanel rs = new JPanel(); rs.setLayout(new GridLayout(1, 5)); for (int i = 0; i < 3; i++) rs.add(new JPanel()); WebTextField search = new WebTextField(); search.setInputPrompt(Translations.get("Search...")); search.addActionListener(l -> { try { String text = search.getText(); if (text.isEmpty()) { dp.getHighlighter().removeAllHighlights(); return; } String searchText = text.toLowerCase(); if (!Objects.equals(searchText, lastSearchText)) { searchIndex = -1; lastSearchText = searchText; } String[] split = dp.getText().split("\\r?\\n"); System.out.println(searchText); int firstIndex = -1; boolean first = false; Label: { for (int i = 0; i < split.length; i++) { String line = split[i]; if (line.toLowerCase().contains(searchText)) { if (i > searchIndex) { dp.setCaretPosition(dp.getDocument().getDefaultRootElement().getElement(i).getStartOffset()); searchIndex = i; break Label; } else if (!first) { firstIndex = i; first = true; } } } if (first) { // go back to first line dp.setCaretPosition(dp.getDocument().getDefaultRootElement().getElement(firstIndex).getStartOffset()); searchIndex = firstIndex; } } hightlightText(searchText); } catch (Exception e) { e.printStackTrace(); } }); rs.add(search); JButton reload = new JButton(Translations.get("Reload")); reload.addActionListener(l -> { dp.setText(CFR.decompile(cn, mn)); }); rs.add(reload); lpad.add(rs); this.add(lpad, BorderLayout.NORTH); JScrollPane scp = new RTextScrollPane(dp); scp.getVerticalScrollBar().setUnitIncrement(16); this.add(scp, BorderLayout.CENTER); }