Exemple #1
0
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {

      JInternalFrame jif = null;
      if (c instanceof JInternalFrame) {
        jif = (JInternalFrame) c;
      } else if (c instanceof JInternalFrame.JDesktopIcon) {
        jif = ((JInternalFrame.JDesktopIcon) c).getInternalFrame();
      } else {
        return;
      }

      if (jif.isSelected()) {
        // Set the line color so the line border gets the correct
        // color.
        lineColor = activeColor;
        super.paintBorder(c, g, x, y, width, height);
      } else {
        lineColor = inactiveColor;
        super.paintBorder(c, g, x, y, width, height);
      }
    }
Exemple #2
0
    /** Draws the InternalFrameBorder's top border. */
    protected boolean drawTopBorder(Component c, Graphics g, int x, int y, int width, int height) {
      if (super.drawTopBorder(c, g, x, y, width, height) && frame.isResizable()) {
        g.setColor(getFrameShadow());
        g.drawLine(CORNER_SIZE - 1, y + 1, CORNER_SIZE - 1, y + 4);
        g.drawLine(width - CORNER_SIZE - 1, y + 1, width - CORNER_SIZE - 1, y + 4);

        g.setColor(getFrameHighlight());
        g.drawLine(CORNER_SIZE, y, CORNER_SIZE, y + 4);
        g.drawLine(width - CORNER_SIZE, y, width - CORNER_SIZE, y + 4);
        return true;
      }
      return false;
    }
Exemple #3
0
 /** Draws the InternalFrameBorder's left border. */
 protected boolean drawLeftBorder(Component c, Graphics g, int x, int y, int width, int height) {
   if (super.drawLeftBorder(c, g, x, y, width, height) && frame.isResizable()) {
     g.setColor(getFrameHighlight());
     int topY = y + CORNER_SIZE;
     g.drawLine(x, topY, x + 4, topY);
     int bottomY = height - CORNER_SIZE;
     g.drawLine(x + 1, bottomY, x + 5, bottomY);
     g.setColor(getFrameShadow());
     g.drawLine(x + 1, topY - 1, x + 5, topY - 1);
     g.drawLine(x + 1, bottomY - 1, x + 5, bottomY - 1);
     return true;
   }
   return false;
 }
Exemple #4
0
    /** Draws the InternalFrameBorder's bottom border. */
    protected boolean drawBottomBorder(
        Component c, Graphics g, int x, int y, int width, int height) {
      if (super.drawBottomBorder(c, g, x, y, width, height) && frame.isResizable()) {
        int startY = height - getBorderInsets(c).bottom;

        g.setColor(getFrameShadow());
        g.drawLine(CORNER_SIZE - 1, startY + 1, CORNER_SIZE - 1, height - 1);
        g.drawLine(width - CORNER_SIZE, startY + 1, width - CORNER_SIZE, height - 1);

        g.setColor(getFrameHighlight());
        g.drawLine(CORNER_SIZE, startY, CORNER_SIZE, height - 2);
        g.drawLine(width - CORNER_SIZE + 1, startY, width - CORNER_SIZE + 1, height - 2);
        return true;
      }
      return false;
    }
Exemple #5
0
 /** Draws the InternalFrameBorder's right border. */
 protected boolean drawRightBorder(
     Component c, Graphics g, int x, int y, int width, int height) {
   if (super.drawRightBorder(c, g, x, y, width, height) && frame.isResizable()) {
     int startX = width - getBorderInsets(c).right;
     g.setColor(getFrameHighlight());
     int topY = y + CORNER_SIZE;
     g.drawLine(startX, topY, width - 2, topY);
     int bottomY = height - CORNER_SIZE;
     g.drawLine(startX + 1, bottomY, startX + 3, bottomY);
     g.setColor(getFrameShadow());
     g.drawLine(startX + 1, topY - 1, width - 2, topY - 1);
     g.drawLine(startX + 1, bottomY - 1, startX + 3, bottomY - 1);
     return true;
   }
   return false;
 }
Exemple #6
0
 // Returns true if the associated internal frame has focus.
 protected boolean isActiveFrame() {
   return frame.isSelected();
 }
Exemple #7
0
 /**
  * Returns the width of the InternalFrameBorder's resize controls, appearing along the
  * InternalFrameBorder's bottom border. Clicking and dragging within these controls lets the
  * user change both the InternalFrame's width and height, while dragging between the controls
  * constrains resizing to just the vertical dimension. Override this method if you implement
  * your own bottom border painting and use a resize control with a different size.
  */
 public int resizePartWidth() {
   if (!frame.isResizable()) {
     return 0;
   }
   return FrameBorder.BORDER_SIZE;
 }