/** * Constructor. * * @param delay The delay between when the caret last moves and when the * text should be scanned for matching occurrences. This should * be in milliseconds. * @param color The color to use to mark the occurrences. This cannot be * <code>null</code>. */ MarkOccurrencesSupport(int delay, Color color) { timer = new Timer(delay, this); timer.setRepeats(false); p = new SmartHighlightPainter(); setColor(color); }
/** * Sets the color used for "mark all." This fires a property change of * type {@link #MARK_ALL_COLOR_PROPERTY}. * * @param color The color to use for "mark all." * @see #getMarkAllHighlightColor() */ public void setMarkAllHighlightColor(Color color) { Color old = (Color)markAllHighlightPainter.getPaint(); if (old!=null && !old.equals(color)) { markAllHighlightPainter.setPaint(color); RTextAreaHighlighter h = (RTextAreaHighlighter)getHighlighter(); if (h.getMarkAllHighlightCount()>0) { repaint(); // Repaint if words are highlighted. } firePropertyChange(MARK_ALL_COLOR_PROPERTY, old, color); } }
/** * Toggles whether a border is painted around marked highlights. * * @param paint Whether to paint a border. * @see #getPaintBorder() * @see #setColor(Color) */ public void setPaintBorder(boolean paint) { if (paint!=p.getPaintBorder()) { p.setPaintBorder(paint); if (textArea!=null) { textArea.repaint(); } } }
/** * Returns the color being used to mark occurrences. * * @return The color being used. * @see #setColor(Color) */ public Color getColor() { return (Color)p.getPaint(); }
@Override public void setRoundedSelectionEdges(boolean rounded) { if (getRoundedSelectionEdges()!=rounded) { markAllHighlightPainter.setRoundedEdges(rounded); super.setRoundedSelectionEdges(rounded); // Fires event. } }
/** * Returns whether a border is painted around marked occurrences. * * @return Whether a border is painted. * @see #setPaintBorder(boolean) * @see #getColor() */ public boolean getPaintBorder() { return p.getPaintBorder(); }
/** * Sets the color to use when marking occurrences. * * @param color The color to use. * @see #getColor() * @see #setPaintBorder(boolean) */ public void setColor(Color color) { p.setPaint(color); if (textArea!=null) { clear(); caretUpdate(null); // Force a highlight repaint. } }
/** * Returns the color used in "mark all" highlights. * * @return The color. * @see #setMarkAllHighlightColor(Color) */ public Color getMarkAllHighlightColor() { return (Color)markAllHighlightPainter.getPaint(); }
@Override public void setRoundedSelectionEdges(boolean rounded) { if (getRoundedSelectionEdges()!=rounded) { markAllHighlightPainter.setRoundedEdges(rounded); super.setRoundedSelectionEdges(rounded); // Fires event. } }
/** * Returns whether a border is painted around marked occurrences. * * @return Whether a border is painted. * @see #setPaintBorder(boolean) * @see #getColor() */ public boolean getPaintBorder() { return p.getPaintBorder(); }
/** * Sets the color to use when marking occurrences. * * @param color The color to use. * @see #getColor() * @see #setPaintBorder(boolean) */ public void setColor(Color color) { p.setPaint(color); if (textArea!=null) { clear(); caretUpdate(null); // Force a highlight repaint. } }
/** * Toggles whether a border is painted around marked highlights. * * @param paint Whether to paint a border. * @see #getPaintBorder() * @see #setColor(Color) */ public void setPaintBorder(boolean paint) { if (paint!=p.getPaintBorder()) { p.setPaintBorder(paint); if (textArea!=null) { textArea.repaint(); } } }
/** * Sets the color used for "mark all." This fires a property change of * type {@link #MARK_ALL_COLOR_PROPERTY}. * * @param color The color to use for "mark all." * @see #getMarkAllHighlightColor() */ public void setMarkAllHighlightColor(Color color) { Color old = (Color)markAllHighlightPainter.getPaint(); if (old!=null && !old.equals(color)) { markAllHighlightPainter.setPaint(color); RTextAreaHighlighter h = (RTextAreaHighlighter)getHighlighter(); if (h.getMarkAllHighlightCount()>0) { repaint(); // Repaint if words are highlighted. } firePropertyChange(MARK_ALL_COLOR_PROPERTY, old, color); } }
JTextComponent c, View view) { g.setColor((Color)getPaint());
@Override protected void init() { super.init(); // NOTE: Our actions are created here instead of in a static block // so they are only created when the first RTextArea is instantiated, // not before. There have been reports of users calling static getters // (e.g. RSyntaxTextArea.getDefaultBracketMatchBGColor()) which would // cause these actions to be created and (possibly) incorrectly // localized, if they were in a static block. if (cutAction==null) { createPopupMenuActions(); } // Install the undo manager. undoManager = createUndoManager(); getDocument().addUndoableEditListener(undoManager); // Set the defaults for various stuff. Color markAllHighlightColor = getDefaultMarkAllHighlightColor(); markAllHighlightPainter = new SmartHighlightPainter( markAllHighlightColor); setMarkAllHighlightColor(markAllHighlightColor); carets = new CaretStyle[2]; setCaretStyle(INSERT_MODE, CaretStyle.THICK_VERTICAL_LINE_STYLE); setCaretStyle(OVERWRITE_MODE, CaretStyle.BLOCK_STYLE); setDragEnabled(true); // Enable drag-and-drop. setTextMode(INSERT_MODE); // Carets array must be created first! setMarkAllOnOccurrenceSearches(true); // Fix the odd "Ctrl+H <=> Backspace" Java behavior. fixCtrlH(); }
/** * Returns the color being used to mark occurrences. * * @return The color being used. * @see #setColor(Color) */ public Color getColor() { return (Color)p.getPaint(); }
/** * Constructor. * * @param delay The delay between when the caret last moves and when the * text should be scanned for matching occurrences. This should * be in milliseconds. * @param color The color to use to mark the occurrences. This cannot be * <code>null</code>. */ MarkOccurrencesSupport(int delay, Color color) { timer = new Timer(delay, this); timer.setRepeats(false); p = new SmartHighlightPainter(); setColor(color); }
/** * Returns the color used in "mark all" highlights. * * @return The color. * @see #setMarkAllHighlightColor(Color) */ public Color getMarkAllHighlightColor() { return (Color)markAllHighlightPainter.getPaint(); }
@Override protected void init() { super.init(); // NOTE: Our actions are created here instead of in a static block // so they are only created when the first RTextArea is instantiated, // not before. There have been reports of users calling static getters // (e.g. RSyntaxTextArea.getDefaultBracketMatchBGColor()) which would // cause these actions to be created and (possibly) incorrectly // localized, if they were in a static block. if (cutAction==null) { createPopupMenuActions(); } // Install the undo manager. undoManager = createUndoManager(); getDocument().addUndoableEditListener(undoManager); // Set the defaults for various stuff. Color markAllHighlightColor = getDefaultMarkAllHighlightColor(); markAllHighlightPainter = new SmartHighlightPainter( markAllHighlightColor); setMarkAllHighlightColor(markAllHighlightColor); carets = new CaretStyle[2]; setCaretStyle(INSERT_MODE, CaretStyle.THICK_VERTICAL_LINE_STYLE); setCaretStyle(OVERWRITE_MODE, CaretStyle.BLOCK_STYLE); setDragEnabled(true); // Enable drag-and-drop. setTextMode(INSERT_MODE); // Carets array must be created first! setMarkAllOnOccurrenceSearches(true); // Fix the odd "Ctrl+H <=> Backspace" Java behavior. fixCtrlH(); }
JTextComponent c, View view) { g.setColor((Color)getPaint());