/** * Sets the color to use to highlight the current line. Note that if * highlighting the current line is turned off, you will not be able to * see this highlight. This method fires a property change of type * {@link #CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY}. * * @param color The color to use to highlight the current line. * @throws NullPointerException if <code>color</code> is <code>null</code>. * @see #getHighlightCurrentLine() * @see #setHighlightCurrentLine(boolean) * @see #getCurrentLineHighlightColor */ public void setCurrentLineHighlightColor(Color color) { if (color==null) { throw new NullPointerException(); } if (!color.equals(currentLineColor)) { Color old = currentLineColor; currentLineColor = color; firePropertyChange(CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY, old, color); } }
/** * Sets whether or not the current line is highlighted. This method * fires a property change of type {@link #HIGHLIGHT_CURRENT_LINE_PROPERTY}. * * @param highlight Whether or not to highlight the current line. * @see #getHighlightCurrentLine() * @see #getCurrentLineHighlightColor * @see #setCurrentLineHighlightColor */ public void setHighlightCurrentLine(boolean highlight) { if (highlight!=highlightCurrentLine) { highlightCurrentLine = highlight; firePropertyChange(HIGHLIGHT_CURRENT_LINE_PROPERTY, !highlight, highlight); repaint(); // Repaint entire width of line. } }
/** * Sets whether the current line highlight should have a "fade" effect. * This method fires a property change event of type * <code>CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY</code>. * * @param fade Whether the fade effect should be enabled. * @see #getFadeCurrentLineHighlight */ public void setFadeCurrentLineHighlight(boolean fade) { if (fade!=fadeCurrentLineHighlight) { fadeCurrentLineHighlight = fade; if (getHighlightCurrentLine()) { forceCurrentLineHighlightRepaint(); } firePropertyChange(CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY, !fade, fade); } }
/** * Sets the background color of this text editor. Note that this is * equivalent to calling <code>setBackgroundObject(bg)</code>.<p> * * NOTE: the opaque property is set to <code>true</code> when the * background is set to a color with 1.0 alpha (by this method). When an * image is used for the background, opaque is set to false. This is * because we perform better when setOpaque is true, but if we use an * image for the background when opaque is true, we get on-screen * garbage when the user scrolls via the arrow keys. Thus we * need setOpaque to be false in that case.<p> * You never have to change the opaque property yourself; it is always done * for you. * * @param bg The color to use as the background color. */ @Override public void setBackground(Color bg) { Object oldBG = getBackgroundObject(); if (oldBG instanceof Color) { // Just change color of strategy. ((ColorBackgroundPainterStrategy)backgroundPainter). setColor(bg); } else { // Was an image painter... backgroundPainter = new ColorBackgroundPainterStrategy(bg); } setOpaque(bg==null || bg.getAlpha()==0xff); firePropertyChange("background", oldBG, bg); repaint(); }
/** * Sets whether the edges of selections are rounded in this text area. * This method fires a property change of type * {@link #ROUNDED_SELECTION_PROPERTY}. * * @param rounded Whether selection edges should be rounded. * @see #getRoundedSelectionEdges() */ public void setRoundedSelectionEdges(boolean rounded) { if (roundedSelectionEdges!=rounded) { roundedSelectionEdges = rounded; Caret c = getCaret(); if (c instanceof ConfigurableCaret) { ((ConfigurableCaret)c).setRoundedSelectionEdges(rounded); if (c.getDot()!=c.getMark()) { // e.g., there's is a selection repaint(); } } firePropertyChange(ROUNDED_SELECTION_PROPERTY, !rounded, rounded); } }
firePropertyChange(BACKGROUND_IMAGE_PROPERTY, oldBG, image); repaint();
/** * Sets the color to use to highlight the current line. Note that if * highlighting the current line is turned off, you will not be able to * see this highlight. This method fires a property change of type * {@link #CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY}. * * @param color The color to use to highlight the current line. * @throws NullPointerException if <code>color</code> is <code>null</code>. * @see #getHighlightCurrentLine() * @see #setHighlightCurrentLine(boolean) * @see #getCurrentLineHighlightColor */ public void setCurrentLineHighlightColor(Color color) { if (color==null) { throw new NullPointerException(); } if (!color.equals(currentLineColor)) { Color old = currentLineColor; currentLineColor = color; firePropertyChange(CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY, old, color); } }
/** * Sets the color to use to highlight the current line. Note that if * highlighting the current line is turned off, you will not be able to * see this highlight. This method fires a property change of type * {@link #CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY}. * * @param color The color to use to highlight the current line. * @throws NullPointerException if <code>color</code> is <code>null</code>. * @see #getHighlightCurrentLine() * @see #setHighlightCurrentLine(boolean) * @see #getCurrentLineHighlightColor */ public void setCurrentLineHighlightColor(Color color) { if (color==null) throw new NullPointerException(); if (!color.equals(currentLineColor)) { Color old = currentLineColor; currentLineColor = color; firePropertyChange(CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY, old, color); } }
/** * Sets the color to use to highlight the current line. Note that if * highlighting the current line is turned off, you will not be able to * see this highlight. This method fires a property change of type * {@link #CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY}. * * @param color The color to use to highlight the current line. * @throws NullPointerException if <code>color</code> is <code>null</code>. * @see #getHighlightCurrentLine() * @see #setHighlightCurrentLine(boolean) * @see #getCurrentLineHighlightColor */ public void setCurrentLineHighlightColor(Color color) { if (color==null) throw new NullPointerException(); if (!color.equals(currentLineColor)) { Color old = currentLineColor; currentLineColor = color; firePropertyChange(CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY, old, color); } }
/** * Sets whether or not the current line is highlighted. This method * fires a property change of type {@link #HIGHLIGHT_CURRENT_LINE_PROPERTY}. * * @param highlight Whether or not to highlight the current line. * @see #getHighlightCurrentLine() * @see #getCurrentLineHighlightColor * @see #setCurrentLineHighlightColor */ public void setHighlightCurrentLine(boolean highlight) { if (highlight!=highlightCurrentLine) { highlightCurrentLine = highlight; firePropertyChange(HIGHLIGHT_CURRENT_LINE_PROPERTY, !highlight, highlight); repaint(); // Repaint entire width of line. } }
/** * Sets whether or not the current line is highlighted. This method * fires a property change of type {@link #HIGHLIGHT_CURRENT_LINE_PROPERTY}. * * @param highlight Whether or not to highlight the current line. * @see #getHighlightCurrentLine() * @see #getCurrentLineHighlightColor * @see #setCurrentLineHighlightColor */ public void setHighlightCurrentLine(boolean highlight) { if (highlight!=highlightCurrentLine) { highlightCurrentLine = highlight; firePropertyChange(HIGHLIGHT_CURRENT_LINE_PROPERTY, !highlight, highlight); repaint(); // Repaint entire width of line. } }
/** * Sets whether or not the current line is highlighted. This method * fires a property change of type {@link #HIGHLIGHT_CURRENT_LINE_PROPERTY}. * * @param highlight Whether or not to highlight the current line. * @see #getHighlightCurrentLine() * @see #getCurrentLineHighlightColor * @see #setCurrentLineHighlightColor */ public void setHighlightCurrentLine(boolean highlight) { if (highlight!=highlightCurrentLine) { highlightCurrentLine = highlight; firePropertyChange(HIGHLIGHT_CURRENT_LINE_PROPERTY, !highlight, highlight); repaint(); // Repaint entire width of line. } }
/** * Sets whether the current line highlight should have a "fade" effect. * This method fires a property change event of type * <code>CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY</code>. * * @param fade Whether the fade effect should be enabled. * @see #getFadeCurrentLineHighlight */ public void setFadeCurrentLineHighlight(boolean fade) { if (fade!=fadeCurrentLineHighlight) { fadeCurrentLineHighlight = fade; if (getHighlightCurrentLine()) forceCurrentLineHighlightRepaint(); firePropertyChange(CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY, !fade, fade); } }
/** * Sets whether the current line highlight should have a "fade" effect. * This method fires a property change event of type * <code>CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY</code>. * * @param fade Whether the fade effect should be enabled. * @see #getFadeCurrentLineHighlight */ public void setFadeCurrentLineHighlight(boolean fade) { if (fade!=fadeCurrentLineHighlight) { fadeCurrentLineHighlight = fade; if (getHighlightCurrentLine()) forceCurrentLineHighlightRepaint(); firePropertyChange(CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY, !fade, fade); } }
/** * Sets whether the current line highlight should have a "fade" effect. * This method fires a property change event of type * <code>CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY</code>. * * @param fade Whether the fade effect should be enabled. * @see #getFadeCurrentLineHighlight */ public void setFadeCurrentLineHighlight(boolean fade) { if (fade!=fadeCurrentLineHighlight) { fadeCurrentLineHighlight = fade; if (getHighlightCurrentLine()) { forceCurrentLineHighlightRepaint(); } firePropertyChange(CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY, !fade, fade); } }
/** * Sets whether the edges of selections are rounded in this text area. * This method fires a property change of type * {@link #ROUNDED_SELECTION_PROPERTY}. * * @param rounded Whether selection edges should be rounded. * @see #getRoundedSelectionEdges() */ public void setRoundedSelectionEdges(boolean rounded) { if (roundedSelectionEdges!=rounded) { roundedSelectionEdges = rounded; ConfigurableCaret cc = (ConfigurableCaret)getCaret(); cc.setRoundedSelectionEdges(rounded); if (cc.getDot()!=cc.getMark()) { // ie, if there is a selection repaint(); } firePropertyChange(ROUNDED_SELECTION_PROPERTY, !rounded, rounded); } }
/** * Sets whether the edges of selections are rounded in this text area. * This method fires a property change of type * {@link #ROUNDED_SELECTION_PROPERTY}. * * @param rounded Whether selection edges should be rounded. * @see #getRoundedSelectionEdges() */ public void setRoundedSelectionEdges(boolean rounded) { if (roundedSelectionEdges!=rounded) { roundedSelectionEdges = rounded; Caret c = getCaret(); if (c instanceof ConfigurableCaret) { ((ConfigurableCaret)c).setRoundedSelectionEdges(rounded); if (c.getDot()!=c.getMark()) { // e.g., there's is a selection repaint(); } } firePropertyChange(ROUNDED_SELECTION_PROPERTY, !rounded, rounded); } }
/** * Sets whether the edges of selections are rounded in this text area. * This method fires a property change of type * {@link #ROUNDED_SELECTION_PROPERTY}. * * @param rounded Whether selection edges should be rounded. * @see #getRoundedSelectionEdges() */ public void setRoundedSelectionEdges(boolean rounded) { if (roundedSelectionEdges!=rounded) { roundedSelectionEdges = rounded; ConfigurableCaret cc = (ConfigurableCaret)getCaret(); cc.setRoundedSelectionEdges(rounded); if (cc.getDot()!=cc.getMark()) { // ie, if there is a selection repaint(); } firePropertyChange(ROUNDED_SELECTION_PROPERTY, !rounded, rounded); } }
/** * Sets the background color of this text editor. Note that this is * equivalent to calling <code>setBackgroundObject(bg)</code>. * * NOTE: the opaque property is set to <code>true</code> when the * background is set to a color (by this method). When an image is used * for the background, opaque is set to false. This is because * we perform better when setOpaque is true, but if we use an * image for the background when opaque is true, we get on-screen * garbage when the user scrolls via the arrow keys. Thus we * need setOpaque to be false in that case.<p> * You never have to change the opaque property yourself; it is always done * for you. * * @param bg The color to use as the background color. */ public void setBackground(Color bg) { Object oldBG = getBackgroundObject(); if (oldBG instanceof Color) { // Just change color of strategy. ((ColorBackgroundPainterStrategy)backgroundPainter). setColor(bg); } else { // Was an image painter... backgroundPainter = new ColorBackgroundPainterStrategy(bg); } setOpaque(true); firePropertyChange("background", oldBG, bg); repaint(); }
firePropertyChange(BACKGROUND_IMAGE_PROPERTY, oldBG, image); repaint();