Exemplo n.º 1
2
 /**
  * Returns a border instance for a Windows ToolBar
  *
  * @return a border used for the toolbar
  * @since 1.4
  */
 public static Border getToolBarBorder() {
   UIDefaults table = UIManager.getLookAndFeelDefaults();
   Border toolBarBorder =
       new WindowsBorders.ToolBarBorder(
           table.getColor("ToolBar.shadow"), table.getColor("ToolBar.highlight"));
   return toolBarBorder;
 }
Exemplo n.º 2
0
    public void paintIcon(Component c, Graphics g, int x, int y) {
      g.setColor(UIManager.getColor("InternalFrame.resizeIconHighlight"));
      g.drawLine(0, 11, 11, 0);
      g.drawLine(4, 11, 11, 4);
      g.drawLine(8, 11, 11, 8);

      g.setColor(UIManager.getColor("InternalFrame.resizeIconShadow"));
      g.drawLine(1, 11, 11, 1);
      g.drawLine(2, 11, 11, 2);
      g.drawLine(5, 11, 11, 5);
      g.drawLine(6, 11, 11, 6);
      g.drawLine(9, 11, 11, 9);
      g.drawLine(10, 11, 11, 10);
    }
Exemplo n.º 3
0
 /**
  * Check if developer changed icon in the UI table.
  *
  * @return the icon to use or {@code null} if the current one is to be used
  */
 private Icon getLaFIcon() {
   // use icon from the UI table if it does not match this one.
   Icon rv = (Icon) UIManager.getDefaults().get(typeToString(type));
   if (rv instanceof VistaMenuItemCheckIcon && ((VistaMenuItemCheckIcon) rv).type == type) {
     rv = null;
   }
   return rv;
 }
Exemplo n.º 4
0
 /**
  * Returns a border instance for a Windows Progress Bar
  *
  * @since 1.4
  */
 public static Border getProgressBarBorder() {
   UIDefaults table = UIManager.getLookAndFeelDefaults();
   Border progressBarBorder =
       new BorderUIResource.CompoundBorderUIResource(
           new WindowsBorders.ProgressBarBorder(
               table.getColor("ProgressBar.shadow"), table.getColor("ProgressBar.highlight")),
           new EmptyBorder(1, 1, 1, 1));
   return progressBarBorder;
 }
Exemplo n.º 5
0
 public int getIconWidth() {
   int width;
   if (XPStyle.getXP() != null) {
     // Fix for XP bug where sometimes these sizes aren't updated properly
     // Assume for now that height is correct and derive width using the
     // ratio from the uxtheme part
     width = UIManager.getInt("InternalFrame.titleButtonHeight") - 2;
     Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
     if (d != null && d.width != 0 && d.height != 0) {
       width = (int) ((float) width * d.width / d.height);
     }
   } else {
     width = UIManager.getInt("InternalFrame.titleButtonWidth") - 2;
   }
   if (XPStyle.getXP() != null) {
     width -= 2;
   }
   return width;
 }
Exemplo n.º 6
0
 public static Border getTableHeaderBorder() {
   UIDefaults table = UIManager.getLookAndFeelDefaults();
   Border tableHeaderBorder =
       new BorderUIResource.CompoundBorderUIResource(
           new BasicBorders.ButtonBorder(
               table.getColor("Table.shadow"),
               table.getColor("Table.darkShadow"),
               table.getColor("Table.light"),
               table.getColor("Table.highlight")),
           new BasicBorders.MarginBorder());
   return tableHeaderBorder;
 }
Exemplo n.º 7
0
  public static Border getInternalFrameBorder() {
    UIDefaults table = UIManager.getLookAndFeelDefaults();
    Border internalFrameBorder =
        new BorderUIResource.CompoundBorderUIResource(
            BorderFactory.createBevelBorder(
                BevelBorder.RAISED,
                table.getColor("InternalFrame.borderColor"),
                table.getColor("InternalFrame.borderHighlight"),
                table.getColor("InternalFrame.borderDarkShadow"),
                table.getColor("InternalFrame.borderShadow")),
            new WindowsBorders.InternalFrameLineBorder(
                table.getColor("InternalFrame.activeBorderColor"),
                table.getColor("InternalFrame.inactiveBorderColor"),
                table.getInt("InternalFrame.borderWidth")));

    return internalFrameBorder;
  }
Exemplo n.º 8
0
    public void paintIcon(Component c, Graphics g, int x, int y) {
      AbstractButton b = (AbstractButton) c;
      ButtonModel model = b.getModel();
      XPStyle xp = XPStyle.getXP();

      if (xp != null) {
        Part part = Part.BP_RADIOBUTTON;
        Skin skin = xp.getSkin(b, part);
        State state;
        int index = 0;
        if (model.isSelected()) {
          state = State.CHECKEDNORMAL;
          if (!model.isEnabled()) {
            state = State.CHECKEDDISABLED;
          } else if (model.isPressed() && model.isArmed()) {
            state = State.CHECKEDPRESSED;
          } else if (model.isRollover()) {
            state = State.CHECKEDHOT;
          }
        } else {
          state = State.UNCHECKEDNORMAL;
          if (!model.isEnabled()) {
            state = State.UNCHECKEDDISABLED;
          } else if (model.isPressed() && model.isArmed()) {
            state = State.UNCHECKEDPRESSED;
          } else if (model.isRollover()) {
            state = State.UNCHECKEDHOT;
          }
        }
        skin.paintSkin(g, x, y, state);
      } else {
        // fill interior
        if ((model.isPressed() && model.isArmed()) || !model.isEnabled()) {
          g.setColor(UIManager.getColor("RadioButton.background"));
        } else {
          g.setColor(UIManager.getColor("RadioButton.interiorBackground"));
        }
        g.fillRect(x + 2, y + 2, 8, 8);

        // outter left arc
        g.setColor(UIManager.getColor("RadioButton.shadow"));
        g.drawLine(x + 4, y + 0, x + 7, y + 0);
        g.drawLine(x + 2, y + 1, x + 3, y + 1);
        g.drawLine(x + 8, y + 1, x + 9, y + 1);
        g.drawLine(x + 1, y + 2, x + 1, y + 3);
        g.drawLine(x + 0, y + 4, x + 0, y + 7);
        g.drawLine(x + 1, y + 8, x + 1, y + 9);

        // outter right arc
        g.setColor(UIManager.getColor("RadioButton.highlight"));
        g.drawLine(x + 2, y + 10, x + 3, y + 10);
        g.drawLine(x + 4, y + 11, x + 7, y + 11);
        g.drawLine(x + 8, y + 10, x + 9, y + 10);
        g.drawLine(x + 10, y + 9, x + 10, y + 8);
        g.drawLine(x + 11, y + 7, x + 11, y + 4);
        g.drawLine(x + 10, y + 3, x + 10, y + 2);

        // inner left arc
        g.setColor(UIManager.getColor("RadioButton.darkShadow"));
        g.drawLine(x + 4, y + 1, x + 7, y + 1);
        g.drawLine(x + 2, y + 2, x + 3, y + 2);
        g.drawLine(x + 8, y + 2, x + 9, y + 2);
        g.drawLine(x + 2, y + 3, x + 2, y + 3);
        g.drawLine(x + 1, y + 4, x + 1, y + 7);
        g.drawLine(x + 2, y + 8, x + 2, y + 8);

        // inner right arc
        g.setColor(UIManager.getColor("RadioButton.light"));
        g.drawLine(x + 2, y + 9, x + 3, y + 9);
        g.drawLine(x + 4, y + 10, x + 7, y + 10);
        g.drawLine(x + 8, y + 9, x + 9, y + 9);
        g.drawLine(x + 9, y + 8, x + 9, y + 8);
        g.drawLine(x + 10, y + 7, x + 10, y + 4);
        g.drawLine(x + 9, y + 3, x + 9, y + 3);

        // indicate whether selected or not
        if (model.isSelected()) {
          if (model.isEnabled()) {
            g.setColor(UIManager.getColor("RadioButton.foreground"));
          } else {
            g.setColor(UIManager.getColor("RadioButton.shadow"));
          }
          g.fillRect(x + 4, y + 5, 4, 2);
          g.fillRect(x + 5, y + 4, 2, 4);
        }
      }
    }
Exemplo n.º 9
0
    public void paintIcon(Component c, Graphics g, int x, int y) {
      JCheckBox cb = (JCheckBox) c;
      ButtonModel model = cb.getModel();
      XPStyle xp = XPStyle.getXP();

      if (xp != null) {
        State state;
        if (model.isSelected()) {
          state = State.CHECKEDNORMAL;
          if (!model.isEnabled()) {
            state = State.CHECKEDDISABLED;
          } else if (model.isPressed() && model.isArmed()) {
            state = State.CHECKEDPRESSED;
          } else if (model.isRollover()) {
            state = State.CHECKEDHOT;
          }
        } else {
          state = State.UNCHECKEDNORMAL;
          if (!model.isEnabled()) {
            state = State.UNCHECKEDDISABLED;
          } else if (model.isPressed() && model.isArmed()) {
            state = State.UNCHECKEDPRESSED;
          } else if (model.isRollover()) {
            state = State.UNCHECKEDHOT;
          }
        }
        Part part = Part.BP_CHECKBOX;
        xp.getSkin(c, part).paintSkin(g, x, y, state);
      } else {
        // outer bevel
        if (!cb.isBorderPaintedFlat()) {
          // Outer top/left
          g.setColor(UIManager.getColor("CheckBox.shadow"));
          g.drawLine(x, y, x + 11, y);
          g.drawLine(x, y + 1, x, y + 11);

          // Outer bottom/right
          g.setColor(UIManager.getColor("CheckBox.highlight"));
          g.drawLine(x + 12, y, x + 12, y + 12);
          g.drawLine(x, y + 12, x + 11, y + 12);

          // Inner top.left
          g.setColor(UIManager.getColor("CheckBox.darkShadow"));
          g.drawLine(x + 1, y + 1, x + 10, y + 1);
          g.drawLine(x + 1, y + 2, x + 1, y + 10);

          // Inner bottom/right
          g.setColor(UIManager.getColor("CheckBox.light"));
          g.drawLine(x + 1, y + 11, x + 11, y + 11);
          g.drawLine(x + 11, y + 1, x + 11, y + 10);

          // inside box
          if ((model.isPressed() && model.isArmed()) || !model.isEnabled()) {
            g.setColor(UIManager.getColor("CheckBox.background"));
          } else {
            g.setColor(UIManager.getColor("CheckBox.interiorBackground"));
          }
          g.fillRect(x + 2, y + 2, csize - 4, csize - 4);
        } else {
          g.setColor(UIManager.getColor("CheckBox.shadow"));
          g.drawRect(x + 1, y + 1, csize - 3, csize - 3);

          if ((model.isPressed() && model.isArmed()) || !model.isEnabled()) {
            g.setColor(UIManager.getColor("CheckBox.background"));
          } else {
            g.setColor(UIManager.getColor("CheckBox.interiorBackground"));
          }
          g.fillRect(x + 2, y + 2, csize - 4, csize - 4);
        }

        if (model.isEnabled()) {
          g.setColor(UIManager.getColor("CheckBox.foreground"));
        } else {
          g.setColor(UIManager.getColor("CheckBox.shadow"));
        }

        // paint check
        if (model.isSelected()) {
          g.drawLine(x + 9, y + 3, x + 9, y + 3);
          g.drawLine(x + 8, y + 4, x + 9, y + 4);
          g.drawLine(x + 7, y + 5, x + 9, y + 5);
          g.drawLine(x + 6, y + 6, x + 8, y + 6);
          g.drawLine(x + 3, y + 7, x + 7, y + 7);
          g.drawLine(x + 4, y + 8, x + 6, y + 8);
          g.drawLine(x + 5, y + 9, x + 5, y + 9);
          g.drawLine(x + 3, y + 5, x + 3, y + 5);
          g.drawLine(x + 3, y + 6, x + 4, y + 6);
        }
      }
    }
Exemplo n.º 10
0
 public int getIconHeight() {
   int height = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;
   return height;
 }