/** * @param parent the parent window * @param se * @param t a linked list containing the items that should be display in the jList * @param title the dialog's title. use {@code null} for standard-title * @param showoptions if true, the search-options for logical-filtering will be shown, if false, * this panel will be hidden. */ public CFilterSearch( java.awt.Frame parent, Settings se, LinkedList<String> t, String title, boolean showoptions) { super(parent); initComponents(); // set application icon setIconImage(Constants.zknicon.getImage()); // if we have a title, set it if (title != null) setTitle(title); // show or hide options-panel jPanel6.setVisible(showoptions); // sort linked list terms = t; Collections.sort(terms, new Comparer()); // when we have aqua-style, change scrollbars if (se.isMacAqua() || se.isSeaGlass()) { jTextFieldFilter.putClientProperty("JTextField.variant", "search"); if (se.isSeaGlass()) { jButtonOk.putClientProperty("JComponent.sizeVariant", "small"); jButtonCancel.putClientProperty("JComponent.sizeVariant", "small"); } } initBorders(se); initList(); initListeners(); }
public static void checkSteno( Settings settingsObj, StenoData stenoObj, javax.swing.JTextArea ta) { if (settingsObj.getStenoActivated()) { int caret = ta.getCaretPosition(); if (caret > 2) { try { String text = ta.getText(); int longest = stenoObj.retrieveLongestAbbrLength(); int start = caret - longest - 1; int start2 = text.lastIndexOf(System.lineSeparator(), caret - 2); if (start2 > start) { start = start2; } String searchstring = text.substring(start, caret); String abbr = stenoObj.findAbbreviationFromText(searchstring); if (abbr != null) { String longword = stenoObj.getStenoWord(abbr); if (longword != null) { StringBuilder sb = new StringBuilder(text); sb.replace(caret - abbr.length(), caret, longword); ta.setText(sb.toString()); caret = caret - abbr.length() + longword.length(); ta.setCaretPosition(caret); } else { if (!ta.getName().equals("jTextAreaAuthor")) { ta.replaceSelection("\t"); } } } else { if (!ta.getName().equals("jTextAreaAuthor")) { ta.replaceSelection("\t"); } } } catch (IndexOutOfBoundsException | IllegalArgumentException ex) { } } else { if (!ta.getName().equals("jTextAreaAuthor")) { ta.replaceSelection("\t"); } } } else { if (!ta.getName().equals("jTextAreaAuthor")) { ta.replaceSelection("\t"); } } }
public static void checkSpelling( int key, javax.swing.JTextArea ta, Settings settingsObj, AutoKorrektur spellObj) { if (KeyEvent.VK_SPACE == key || KeyEvent.VK_PERIOD == key || KeyEvent.VK_COMMA == key || KeyEvent.VK_BRACELEFT == key || KeyEvent.VK_ENTER == key || KeyEvent.VK_OPEN_BRACKET == key || KeyEvent.VK_COLON == key || KeyEvent.VK_QUOTE == key) { if (ta != null) { try { int caret = ta.getCaretPosition(); String text = ta.getText(); if (settingsObj.getSpellCorrect()) { if (caret > 2) { int start = text.lastIndexOf(" ", caret - 2); int start2 = text.lastIndexOf(System.lineSeparator(), caret - 2); if (start2 > start) { start = start2; } String wrong = text.substring(start + 1, caret - 1); String correct = spellObj.getCorrectSpelling(wrong); if (correct != null) { StringBuilder sb = new StringBuilder(text); sb.replace(start + 1, caret - 1, correct); ta.setText(sb.toString()); caret = caret - wrong.length() + correct.length(); ta.setCaretPosition(caret); } } } if (KeyEvent.VK_QUOTE == key) { // TODO Anfrührungszeichen ersetzen // <ALT>+0132 bzw. // <ALT>+0147 typographische Anführungszeichen oben / unten hin. } } catch (IndexOutOfBoundsException | IllegalArgumentException ex) { } } } }