home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1BP8WFS (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  2.4 KB  |  84 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.JSplitPane;
  4. import com.sun.java.swing.border.Border;
  5. import java.awt.Color;
  6. import java.awt.Component;
  7. import java.awt.Graphics;
  8. import java.awt.Insets;
  9. import java.awt.Rectangle;
  10. import java.io.Serializable;
  11.  
  12. public class BasicSplitPaneUI$SplitBorder implements Border, Serializable {
  13.    private Color highlightColor;
  14.    private Color shadowColor;
  15.  
  16.    public BasicSplitPaneUI$SplitBorder(Color highlight, Color shadow) {
  17.       this.highlightColor = highlight;
  18.       this.shadowColor = shadow;
  19.    }
  20.  
  21.    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  22.       JSplitPane splitPane = (JSplitPane)c;
  23.       Component child = splitPane.getLeftComponent();
  24.       if (splitPane.getOrientation() == 1) {
  25.          if (child != null) {
  26.             Rectangle cBounds = child.getBounds();
  27.             g.setColor(this.shadowColor);
  28.             g.drawLine(0, 0, cBounds.width + 1, 0);
  29.             g.drawLine(0, 1, 0, cBounds.height + 2);
  30.             g.setColor(this.highlightColor);
  31.             g.drawLine(1, cBounds.height + 1, cBounds.width + 2, cBounds.height + 1);
  32.             g.drawLine(cBounds.width + 1, 1, cBounds.width + 1, cBounds.height + 2);
  33.          }
  34.  
  35.          child = splitPane.getRightComponent();
  36.          if (child != null) {
  37.             Rectangle var14 = child.getBounds();
  38.             int maxX = var14.x + var14.width;
  39.             int maxY = var14.y + var14.height;
  40.             g.setColor(this.shadowColor);
  41.             g.drawLine(var14.x - 1, 0, maxX, 0);
  42.             g.drawLine(var14.x - 1, maxY, var14.x, maxY);
  43.             g.drawLine(var14.x - 1, 0, var14.x - 1, maxY);
  44.             g.setColor(this.highlightColor);
  45.             g.drawLine(var14.x, maxY, maxX, maxY);
  46.             g.drawLine(maxX, 0, maxX, maxY + 1);
  47.          }
  48.       } else {
  49.          if (child != null) {
  50.             Rectangle var15 = child.getBounds();
  51.             g.setColor(this.shadowColor);
  52.             g.drawLine(0, 0, var15.width + 1, 0);
  53.             g.drawLine(0, 1, 0, var15.height + 1);
  54.             g.setColor(this.highlightColor);
  55.             g.drawLine(1 + var15.width, 0, 1 + var15.width, var15.height + 1);
  56.             g.drawLine(0, var15.height + 1, var15.width, var15.height + 1);
  57.          }
  58.  
  59.          child = splitPane.getRightComponent();
  60.          if (child != null) {
  61.             Rectangle var16 = child.getBounds();
  62.             int maxX = var16.x + var16.width;
  63.             int maxY = var16.y + var16.height;
  64.             g.setColor(this.shadowColor);
  65.             g.drawLine(0, var16.y - 1, 0, maxY);
  66.             g.drawLine(maxX, var16.y - 1, maxX, var16.y);
  67.             g.drawLine(0, var16.y - 1, var16.width, var16.y - 1);
  68.             g.setColor(this.highlightColor);
  69.             g.drawLine(0, maxY, var16.width + 1, maxY);
  70.             g.drawLine(maxX, var16.y, maxX, maxY);
  71.          }
  72.       }
  73.  
  74.    }
  75.  
  76.    public Insets getBorderInsets(Component c) {
  77.       return new Insets(1, 1, 1, 1);
  78.    }
  79.  
  80.    public boolean isBorderOpaque() {
  81.       return true;
  82.    }
  83. }
  84.