/** * Returns the <code>java.awt.Color</code> used as the background color for * this text area. If a <code>java.awt.Image</code> image is currently * being used instead, <code>null</code> is returned. * * @return The current background color, or <code>null</code> if an image * is currently the background. */ @Override public final Color getBackground() { Object bg = getBackgroundObject(); return (bg instanceof Color) ? (Color)bg : null; }
/** * Returns the image currently used for the background. * If the current background is currently a <code>java.awt.Color</code> and * not a <code>java.awt.Image</code>, then <code>null</code> is returned. * * @return A <code>java.awt.Image</code> used for the background, or * <code>null</code> if the background is not an image. * @see #setBackgroundImage */ public final Image getBackgroundImage() { Object bg = getBackgroundObject(); return (bg instanceof Image) ? (Image)bg : null; }
/** * Sets the UI for this <code>RTextArea</code>. Note that, for instances * of <code>RTextArea</code>, <code>setUI</code> only updates the popup * menu; this is because <code>RTextArea</code>s' look and feels are * independent of the Java Look and Feel. This method is here so * subclasses can set a UI (subclass of <code>RTextAreaUI</code>) if they * have to. * * @param ui The new UI. * @see #setUI */ protected void setRTextAreaUI(RTextAreaUI ui) { super.setUI(ui); // Workaround as setUI makes the text area opaque, even if we don't // want it to be. setOpaque(getBackgroundObject() instanceof Color); }
/** * 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(); }
Object oldBG = getBackgroundObject(); if (oldBG instanceof Image) { // Just change image being displayed. ((ImageBackgroundPainterStrategy)backgroundPainter).
/** * Returns the <code>java.awt.Color</code> used as the background color for * this text area. If a <code>java.awt.Image</code> image is currently * being used instead, <code>null</code> is returned. * * @return The current background color, or <code>null</code> if an image * is currently the background. */ public final Color getBackground() { Object bg = getBackgroundObject(); return (bg instanceof Color) ? (Color)bg : null; }
/** * Returns the <code>java.awt.Color</code> used as the background color for * this text area. If a <code>java.awt.Image</code> image is currently * being used instead, <code>null</code> is returned. * * @return The current background color, or <code>null</code> if an image * is currently the background. */ @Override public final Color getBackground() { Object bg = getBackgroundObject(); return (bg instanceof Color) ? (Color)bg : null; }
/** * Returns the image currently used for the background. * If the current background is currently a <code>java.awt.Color</code> and * not a <code>java.awt.Image</code>, then <code>null</code> is returned. * * @return A <code>java.awt.Image</code> used for the background, or * <code>null</code> if the background is not an image. * @see #setBackgroundImage */ public final Image getBackgroundImage() { Object bg = getBackgroundObject(); return (bg instanceof Image) ? (Image)bg : null; }
/** * Returns the <code>java.awt.Color</code> used as the background color for * this text area. If a <code>java.awt.Image</code> image is currently * being used instead, <code>null</code> is returned. * * @return The current background color, or <code>null</code> if an image * is currently the background. */ public final Color getBackground() { Object bg = getBackgroundObject(); return (bg instanceof Color) ? (Color)bg : null; }
/** * Returns the image currently used for the background. * If the current background is currently a <code>java.awt.Color</code> and * not a <code>java.awt.Image</code>, then <code>null</code> is returned. * * @return A <code>java.awt.Image</code> used for the background, or * <code>null</code> if the background is not an image. * @see #setBackgroundImage */ public final Image getBackgroundImage() { Object bg = getBackgroundObject(); return (bg instanceof Image) ? (Image)bg : null; }
/** * Returns the image currently used for the background. * If the current background is currently a <code>java.awt.Color</code> and * not a <code>java.awt.Image</code>, then <code>null</code> is returned. * * @return A <code>java.awt.Image</code> used for the background, or * <code>null</code> if the background is not an image. * @see #setBackgroundImage */ public final Image getBackgroundImage() { Object bg = getBackgroundObject(); return (bg instanceof Image) ? (Image)bg : null; }
/** * Sets the UI for this <code>RTextArea</code>. Note that, for instances * of <code>RTextArea</code>, <code>setUI</code> only updates the popup * menu; this is because <code>RTextArea</code>s' look and feels are * independent of the Java Look and Feel. This method is here so * subclasses can set a UI (subclass of <code>RTextAreaUI</code>) if they * have to. * * @param ui The new UI. * @see #setUI */ protected void setRTextAreaUI(RTextAreaUI ui) { super.setUI(ui); // Workaround as setUI makes the text area opaque, even if we don't // want it to be. setOpaque(getBackgroundObject() instanceof Color); }
/** * Sets the UI for this <code>RTextArea</code>. Note that, for instances * of <code>RTextArea</code>, <code>setUI</code> only updates the popup * menu; this is because <code>RTextArea</code>s' look and feels are * independent of the Java Look and Feel. This method is here so * subclasses can set a UI (subclass of <code>RTextAreaUI</code>) if they * have to. * * @param ui The new UI. * @see #setUI */ protected void setRTextAreaUI(RTextAreaUI ui) { super.setUI(ui); // Workaround as setUI makes the text area opaque, even if we don't // want it to be. setOpaque(getBackgroundObject() instanceof Color); }
/** * Sets the UI for this <code>RTextArea</code>. Note that, for instances * of <code>RTextArea</code>, <code>setUI</code> only updates the popup * menu; this is because <code>RTextArea</code>s' look and feels are * independent of the Java Look and Feel. This method is here so * subclasses can set a UI (subclass of <code>RTextAreaUI</code>) if they * have to. * * @param ui The new UI. * @see #setUI */ protected void setRTextAreaUI(RTextAreaUI ui) { super.setUI(ui); // Workaround as setUI makes the text area opaque, even if we don't // want it to be. setOpaque(getBackgroundObject() instanceof Color); }
/** * 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 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(); }
/** * 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(); }
Object oldBG = getBackgroundObject(); if (oldBG instanceof Image) { // Just change image being displayed. ((BufferedImageBackgroundPainterStrategy)backgroundPainter).
Object oldBG = getBackgroundObject(); if (oldBG instanceof Image) { // Just change image being displayed. ((ImageBackgroundPainterStrategy)backgroundPainter).
Object oldBG = getBackgroundObject(); if (oldBG instanceof Image) { // Just change image being displayed. ((BufferedImageBackgroundPainterStrategy)backgroundPainter).