@Override @SuppressWarnings("unchecked") public void paintIcon(final Component c, final Graphics g, final int x, final int y) { JCheckBox cb = (JCheckBox) c; javax.swing.ButtonModel model = cb.getModel(); if (ThemeManager.isLookAndFeelNimbus()) { icon.paintIcon(c, g, x, y); if (c.hasFocus()) { nimbusFocusBorder.paintBorder(g, x, y, iconWidth, iconHeight); } drawIndeterminateNimbusLine(g, x, y); } else { if (model.isEnabled()) { if (model.isPressed() && model.isArmed()) { g.setColor(MetalLookAndFeel.getControlShadow()); g.fillRect(x, y, iconWidth - 1, iconHeight - 1); drawPressed3DBorder(g, x, y, iconWidth, iconHeight); } else { drawFlush3DBorder(g, x, y, iconWidth, iconHeight); } g.setColor(MetalLookAndFeel.getControlInfo()); } else { g.setColor(MetalLookAndFeel.getControlShadow()); g.drawRect(x, y, iconWidth - 1, iconHeight - 1); } drawIndeterminateLine(g, x, y); } }
private void paintOceanIcon(Component c, Graphics g, int x, int y) { ButtonModel model = ((JCheckBoxMenuItem) c).getModel(); g.translate(x, y); int w = getIconWidth(); int h = getIconHeight(); if (model.isEnabled()) { if (model.isPressed() && model.isArmed()) { g.setColor(MetalLookAndFeel.getControlShadow()); g.fillRect(0, 0, w, h); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.fillRect(0, 0, w, 2); g.fillRect(0, 2, 2, h - 2); g.fillRect(w - 1, 1, 1, h - 1); g.fillRect(1, h - 1, w - 2, 1); } else if (model.isRollover()) { MetalUtilsCustom.drawGradient(c, g, "CheckBox.gradient", 0, 0, w, h, true); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 1, h - 1); g.setColor(MetalLookAndFeel.getPrimaryControl()); g.drawRect(1, 1, w - 3, h - 3); g.drawRect(2, 2, w - 5, h - 5); } else { MetalUtilsCustom.drawGradient(c, g, "CheckBox.gradient", 0, 0, w, h, true); g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 1, h - 1); } g.setColor(MetalLookAndFeel.getControlInfo()); } else { g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 1, h - 1); } g.translate(-x, -y); if (model.isSelected()) { drawCheck(g, x, y); } }