Demos and Usage of java.awt.Component.getBackground()


   1:   public void actionPerformed(ActionEvent event) {
   2:     Component c = (Component)event.getSource();
   3:         ...
   4:     System.out.println("Background: " + c.getBackground());
   5:   }
   6: }

View Full Code Here
   1: 
   2:   public void paintBorder(Component _c, Graphics _g,
   3:               int _x, int _y, int _w, int _h)
   4:         ...
   5:       _g.translate(_x,_y);
   6:       _g.setColor(_c.getBackground());
   7:       _g.draw3DRect(0,0,_w-1,_h-1,false);
   8:         ...
   9: 
  10:   public Insets getBorderInsets(Component _c)
  11:   {

View Full Code Here
   1: 
   2:     public Oval (Component surface, int x, int y, int xRadius, int yRadius)
   3:     {
   4:         ...
   5: 
   6:     public Oval (Component surface, int xRadius, int yRadius)
   7:     {
   8:         ...
   9: 
  10:     public Oval (Component surface)
  11:     {
  12:         ...
  13:     Graphics g = surface.getGraphics ();
  14:     g.setColor (surface.getBackground());

View Full Code Here
   1: 
   2:     public Triangle (Component surface, int x, int y, int sideLength)
   3:     {
   4:         ...
   5: 
   6:     public Triangle (Component surface, int sideLength)
   7:     {
   8:         ...
   9: 
  10:     public Triangle (Component surface)
  11:     {
  12:         ...
  13:     yp [2] = y;
  14:     g.setColor (surface.getBackground());

View Full Code Here
   1: 
   2: import java.awt.Component;
   3: import java.awt.Graphics;
   4:         ...
   5: {
   6:     protected void drawControl (ButtonModel model, Graphics g, int x, int y, Component c)
   7:     {
   8:         ...
   9:         {
  10:             g.setColor(c.getBackground());
  11:             g.fillRect(x, y, ICON_SIZE - 1, ICON_SIZE - 1);

View Full Code Here
   1: 
   2: import java.awt.Component;
   3: import java.awt.Graphics;
   4:         ...
   5: 
   6:     public Insets getBorderInsets(Component component)
   7:     {
   8:         ...
   9:         {
  10:             g.setColor(component.getBackground().brighter());
  11:         }
  12:         ...
  13:         {
  14:             g.setColor(component.getBackground().darker());

View Full Code Here
   1: import dataweb.client.components.ToolBar;
   2: import java.awt.Component;
   3: import java.awt.Graphics;
   4:         ...
   5:     
   6:     private void installBorder(Component c){
   7:         if (c instanceof JComponent ){
   8:         ...
   9:             }
  10:             Component[] components = jc.getComponents();
  11:             
  12:         ...
  13:     public void update(Graphics g, JComponent c) {
  14:         if (c.isOpaque() && (c.getBackground() instanceof UIResource) &&

View Full Code Here
   1: 
   2: import java.awt.Component;
   3: import java.awt.GradientPaint;
   4:         ...
   5: {
   6:     protected void drawControl (ButtonModel model, Graphics g, int x, int y, Component c)
   7:     {
   8:         ...
   9:         {
  10:             g.setColor(c.getBackground());
  11:         }

View Full Code Here
   1: 
   2:   private Component component;
   3:   private boolean   firstStretch = true;
   4:         ...
   5: 
   6:   public Rubberband(Component c) {
   7:     listeners = new Vector();
   8:         ...
   9:       try {
  10:         g.setXORMode(component.getBackground());
  11: 
  12:         ...
  13:       try {
  14:         g.setXORMode(component.getBackground());

View Full Code Here
   1: import java.awt.Color;
   2: import java.awt.Component;
   3: import java.awt.Graphics;
   4:         ...
   5:         ScreensaverSettings settings = getContext().getSettings();
   6:         Component c = getContext().getComponent();
   7:         int width = c.getWidth();
   8:         ...
   9:     public void paint( Graphics g ) {
  10:         Component c = getContext().getComponent();
  11:         int width = c.getWidth();
  12:         ...
  13:         
  14:         g.setColor( c.getBackground() );

View Full Code Here
   1: 
   2:   protected Component comp;
   3:   protected Color color;
   4:         ...
   5: 
   6:   public RubberBand(Component c) {
   7:     this();
   8:         ...
   9: 
  10:   public void setComponent( Component c ) {
  11:     this.comp = c;
  12:         ...
  13:     if (pixelbox.width != 0 && pixelbox.height != 0) {
  14:       g.setXORMode(comp.getBackground());

View Full Code Here
   1: 
   2:   public void paintIcon(Component comp, Graphics g, int x, int y)
   3:   {
   4:         ...
   5:         g.fillPolygon(new int[] {x+1, x+width, x+1}, new int[] {y+1, y+1, y+height}, 3);
   6:         g.setColor(comp.getBackground());
   7:         g.fillPolygon(new int[] {x+width, x+1, x+width}, new int[] {y+1, y+height, y+height}, 3);
   8:         ...
   9:       g.fillRect(x+1, y+1, width-1, height-1);
  10:       g.setColor(comp.getBackground());
  11:       g.fillRect(x+3, y+3, width-5, height-5);

View Full Code Here
   1:     private static Border border = new Border() {
   2:     public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   3:         g.setColor(c.getForeground());
   4:         ...
   5:         g.drawRect(x+2, y+2, w-5, h-5);
   6:         g.setColor(c.getBackground());
   7:         g.drawRect(x+1, y+1, w-3, h-3);
   8:         ...
   9:     }
  10:     public Insets getBorderInsets(Component c) {
  11:     }

View Full Code Here
   1: 
   2:     protected  Component parent;
   3: 
   4:         ...
   5: public    Gadget(Component parent)
   6:   {
   7:         ...
   8: }
   9: public Component getParent()
  10: {
  11:         ...
  12: {
  13:     return parent.getBackground();

View Full Code Here
   1:       constraints.weightx = 1.0;
   2:       add((Component)panels.elementAt(i), constraints);
   3:     }
   4:         ...
   5: 
   6:     public void paintIcon(Component comp, Graphics g, int x, int y)
   7:     {
   8:         ...
   9:           g.fillPolygon(new int[] {1, width-1, 1}, new int[] {1, 1, height-1}, 3);
  10:           g.setColor(comp.getBackground());
  11:           g.fillPolygon(new int[] {width-1, 1, width-1}, new int[] {1, height-1, height-1}, 3);
  12:         ...
  13:         g.fillRect(x+1, y+1, width-1, height-1);
  14:         g.setColor(comp.getBackground());

View Full Code Here