< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthBorder.java

Print this page




  51     }
  52 
  53     public void paintBorder(Component c, Graphics g, int x, int y,
  54                             int width, int height) {
  55         JComponent jc = (JComponent)c;
  56         SynthContext context = ui.getContext(jc);
  57         SynthStyle style = context.getStyle();
  58         if (style == null) {
  59             assert false: "SynthBorder is being used outside after the UI " +
  60                           "has been uninstalled";
  61             return;
  62         }
  63         ui.paintBorder(context, g, x, y, width, height);
  64         context.dispose();
  65     }
  66 
  67     /**
  68      * Reinitializes the insets parameter with this Border's current Insets.
  69      * @param c the component for which this border insets value applies
  70      * @param insets the object to be reinitialized
  71      * @return the <code>insets</code> object
  72      */
  73     public Insets getBorderInsets(Component c, Insets insets) {
  74         if (this.insets != null) {
  75             if (insets == null) {
  76                 insets = new Insets(this.insets.top, this.insets.left,
  77                                   this.insets.bottom, this.insets.right);
  78             }
  79             else {
  80                 insets.top    = this.insets.top;
  81                 insets.bottom = this.insets.bottom;
  82                 insets.left   = this.insets.left;
  83                 insets.right  = this.insets.right;
  84             }
  85         }
  86         else if (insets == null) {
  87             insets = new Insets(0, 0, 0, 0);
  88         }
  89         else {
  90             insets.top = insets.bottom = insets.left = insets.right = 0;
  91         }




  51     }
  52 
  53     public void paintBorder(Component c, Graphics g, int x, int y,
  54                             int width, int height) {
  55         JComponent jc = (JComponent)c;
  56         SynthContext context = ui.getContext(jc);
  57         SynthStyle style = context.getStyle();
  58         if (style == null) {
  59             assert false: "SynthBorder is being used outside after the UI " +
  60                           "has been uninstalled";
  61             return;
  62         }
  63         ui.paintBorder(context, g, x, y, width, height);
  64         context.dispose();
  65     }
  66 
  67     /**
  68      * Reinitializes the insets parameter with this Border's current Insets.
  69      * @param c the component for which this border insets value applies
  70      * @param insets the object to be reinitialized
  71      * @return the {@code insets} object
  72      */
  73     public Insets getBorderInsets(Component c, Insets insets) {
  74         if (this.insets != null) {
  75             if (insets == null) {
  76                 insets = new Insets(this.insets.top, this.insets.left,
  77                                   this.insets.bottom, this.insets.right);
  78             }
  79             else {
  80                 insets.top    = this.insets.top;
  81                 insets.bottom = this.insets.bottom;
  82                 insets.left   = this.insets.left;
  83                 insets.right  = this.insets.right;
  84             }
  85         }
  86         else if (insets == null) {
  87             insets = new Insets(0, 0, 0, 0);
  88         }
  89         else {
  90             insets.top = insets.bottom = insets.left = insets.right = 0;
  91         }


< prev index next >