public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color logoColor = AbstractLookAndFeel.getMenuSelectionBackgroundColor(); Color borderColorLo = AbstractLookAndFeel.getFrameColor(); Color borderColorHi = ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40); g.setColor(logoColor); if (JTattooUtilities.isLeftToRight(c)) { int dx = getBorderInsets(c).left; g.fillRect(x, y, dx - 1, h - 1); paintLogo(c, g, x, y, w, h); // - highlight g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40)); g.drawLine(x + dx, y + 1, x + w - 2, y + 1); g.setColor(borderColorHi); g.drawLine(x + 1, y, x + 1, y + h - 2); // - outer frame g.setColor(borderColorLo); if (isMenuBarPopup(c)) { // top g.drawLine(x + dx - 1, y, x + w, y); // left g.drawLine(x, y, x, y + h - 1); // bottom g.drawLine(x, y + h - 1, x + w, y + h - 1); // right g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } else { g.drawRect(x, y, w - 1, h - 1); } // - logo separator g.drawLine(x + dx - 1, y + 1, x + dx - 1, y + h - 1); } else { int dx = getBorderInsets(c).right; g.fillRect(x + w - dx, y, dx, h - 1); paintLogo(c, g, x, y, w, h); // - highlight g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40)); g.drawLine(x + 1, y + 1, x + w - dx - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 2); // - outer frame g.setColor(borderColorLo); if (isMenuBarPopup(c)) { // top g.drawLine(x, y, x + w - dx, y); // left g.drawLine(x, y, x, y + h - 1); // bottom g.drawLine(x, y + h - 1, x + w, y + h - 1); // right g.drawLine(x + w - 1, y, x + w - 1, y + h - 1); } else { g.drawRect(x, y, w - 1, h - 1); } // - logo separator g.drawLine(x + w - dx, y + 1, x + w - dx, y + h - 1); } }
protected Color[] getContentBorderColors(int tabPlacement) { Color SEP_COLORS[] = { ColorHelper.brighter(AcrylLookAndFeel.getControlColorLight(), 20), AcrylLookAndFeel.getControlColorLight(), ColorHelper.brighter(AcrylLookAndFeel.getControlColorDark(), 20), AcrylLookAndFeel.getControlColorDark(), ColorHelper.darker(AcrylLookAndFeel.getControlColorDark(), 20), }; return SEP_COLORS; }
protected Color getFrameColor() { Color frameColor = ColorHelper.brighter(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 8); if (isDragging) { return ColorHelper.darker(frameColor, 8); } else if (isRollover) { return ColorHelper.brighter(frameColor, 16); } else { return frameColor; } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JMenuItem b = (JMenuItem) c; ButtonModel model = b.getModel(); Color borderColorLo = AbstractLookAndFeel.getFrameColor(); Color borderColorHi = ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40); if (c.getParent() instanceof JMenuBar) { if (model.isArmed() || model.isSelected()) { g.setColor(borderColorLo); g.drawLine(x, y, x + w - 1, y); g.drawLine(x, y, x, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); g.setColor(borderColorHi); g.drawLine(x + 1, y + 1, x + w - 2, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); } } else { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(borderColorLo); g.drawLine(x, y, x + w - 1, y); g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); g.setColor(borderColorHi); g.drawLine(x, y + 1, x + w - 2, y + 1); } } }
protected void paintIndeterminate(Graphics g, JComponent c) { if (!(g instanceof Graphics2D)) { return; } Graphics2D g2D = (Graphics2D) g; Insets b = progressBar.getInsets(); // area for border int barRectWidth = progressBar.getWidth() - (b.right + b.left); int barRectHeight = progressBar.getHeight() - (b.top + b.bottom); Color colors[]; if (progressBar.getForeground() instanceof UIResource) { if (!Utilities.isActive(c)) { colors = BaseLookAndFeel.getTheme().getInActiveColors(); } else if (c.isEnabled()) { colors = BaseLookAndFeel.getTheme().getProgressBarColors(); } else { colors = BaseLookAndFeel.getTheme().getDisabledColors(); } } else { Color hiColor = ColorHelper.brighter(progressBar.getForeground(), 40); Color loColor = ColorHelper.darker(progressBar.getForeground(), 20); colors = ColorHelper.createColorArr(hiColor, loColor, 20); } Color cHi = ColorHelper.darker(colors[colors.length - 1], 5); Color cLo = ColorHelper.darker(colors[colors.length - 1], 10); // Paint the bouncing box. Rectangle box = getBox(null); if (box != null) { g2D.setColor(progressBar.getForeground()); Utilities.draw3DBorder(g, cHi, cLo, box.x + 1, box.y + 1, box.width - 2, box.height - 2); if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { Utilities.fillHorGradient(g, colors, box.x + 2, box.y + 2, box.width - 4, box.height - 4); } else { Utilities.fillVerGradient(g, colors, box.x + 2, box.y + 2, box.width - 4, box.height - 4); } // Deal with possible text painting if (progressBar.isStringPainted()) { Object savedRenderingHint = null; if (BaseLookAndFeel.getTheme().isTextAntiAliasingOn()) { savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); g2D.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, BaseLookAndFeel.getTheme().getTextAntiAliasingHint()); } if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { paintString(g2D, b.left, b.top, barRectWidth, barRectHeight, box.width, b); } else { paintString(g2D, b.left, b.top, barRectWidth, barRectHeight, box.height, b); } if (BaseLookAndFeel.getTheme().isTextAntiAliasingOn()) { g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint); } } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (JTattooUtilities.isFrameActive((JComponent) c)) { g.setColor(AbstractLookAndFeel.getFrameColor()); } else { g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 40)); } g.drawRect(x, y, w - 1, h - 1); }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Color hiColor = ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFocusFrameColor(), 60); Color loColor = AbstractLookAndFeel.getTheme().getFocusFrameColor(); g.setColor(loColor); g.drawRect(x, y, width - 1, height - 1); g.setColor(hiColor); g.drawRect(x + 1, y + 1, width - 3, height - 3); }
protected void installDefaults() { super.installDefaults(); Color colors[] = AbstractLookAndFeel.getTheme().getThumbColors(); rolloverColors = new Color[colors.length]; dragColors = new Color[colors.length]; for (int i = 0; i < colors.length; i++) { rolloverColors[i] = ColorHelper.brighter(colors[i], 8); dragColors[i] = ColorHelper.darker(colors[i], 8); } }
public void paint(Graphics g, JComponent c) { boolean horizontal = true; if (c instanceof JSeparator) { horizontal = (((JSeparator) c).getOrientation() == JSeparator.HORIZONTAL); } if (horizontal) { int w = c.getWidth(); g.setColor(AbstractLookAndFeel.getBackgroundColor()); g.drawLine(0, 0, w, 0); g.setColor(ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30)); g.drawLine(0, 1, w, 1); g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getBackgroundColor(), 50)); g.drawLine(0, 2, w, 2); } else { int h = c.getHeight(); g.setColor(ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30)); g.drawLine(0, 0, 0, h); g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getBackgroundColor(), 50)); g.drawLine(1, 0, 1, h); } }
protected Color[] getTabColors(int tabIndex, boolean isSelected) { if ((tabIndex >= 0) && (tabIndex < tabPane.getTabCount())) { boolean isEnabled = tabPane.isEnabledAt(tabIndex); Color backColor = tabPane.getBackgroundAt(tabIndex); Color colorArr[] = AbstractLookAndFeel.getTheme().getTabColors(); if ((backColor instanceof UIResource)) { if (isSelected) { colorArr = AbstractLookAndFeel.getTheme().getDefaultColors(); } else if (tabIndex == rolloverIndex && isEnabled) { colorArr = AbstractLookAndFeel.getTheme().getRolloverColors(); } else { colorArr = AbstractLookAndFeel.getTheme().getTabColors(); } } else { if (isSelected) { if (tabPane.getTabPlacement() == BOTTOM) { colorArr = ColorHelper.createColorArr(backColor, ColorHelper.brighter(backColor, 50), 20); } else { colorArr = ColorHelper.createColorArr(ColorHelper.brighter(backColor, 50), backColor, 20); } } else { if (tabIndex == rolloverIndex && isEnabled) { colorArr = ColorHelper.createColorArr( ColorHelper.brighter(backColor, 80), ColorHelper.brighter(backColor, 20), 20); } else { colorArr = ColorHelper.createColorArr( ColorHelper.brighter(backColor, 40), ColorHelper.darker(backColor, 10), 20); } } } return colorArr; } return AbstractLookAndFeel.getTheme().getTabColors(); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; Graphics2D g2D = (Graphics2D) g; Color frameColor = AbstractLookAndFeel.getTheme().getFrameColor(); if (!JTattooUtilities.isFrameActive(button)) { frameColor = ColorHelper.brighter(frameColor, 40); } if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) { g2D.setColor(Color.white); g2D.drawRect(x, y, w - 1, h - 1); if (button.getRootPane() != null && button.equals(button.getRootPane().getDefaultButton()) && !button.hasFocus()) { g2D.setColor(ColorHelper.darker(frameColor, 20)); g2D.drawRect(x, y, w - 1, h - 2); if (!button.getModel().isRollover()) { g2D.setColor(defaultColorHi); g2D.drawRect(x + 1, y + 1, w - 3, h - 4); g2D.setColor(defaultColorLo); g2D.drawRect(x + 2, y + 2, w - 5, h - 6); } } else { g2D.setColor(frameColor); g2D.drawRect(x, y, w - 2, h - 2); } } else { Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (button.getRootPane() != null && button.equals(button.getRootPane().getDefaultButton())) { if (!button.getModel().isRollover()) { g2D.setColor(defaultColorHi); g2D.drawRoundRect(x + 1, y + 1, w - 4, h - 2, 6, 6); g2D.setColor(defaultColorLo); g2D.drawRoundRect(x + 2, y + 2, w - 6, h - 6, 6, 6); } } g2D.setColor(Color.white); g2D.drawRoundRect(x, y, w - 1, h - 1, 6, 6); g2D.setColor(frameColor); g2D.drawRoundRect(x, y, w - 2, h - 2, 6, 6); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = ColorHelper.brighter(frameColor, 10); Color frameLoColor = ColorHelper.darker(frameColor, 30); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h); if ((model.isPressed() && model.isArmed()) || model.isSelected()) { JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); } else { JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if (model.isEnabled()) { if ((model.isPressed() && model.isArmed()) || model.isSelected()) { Color frameColor = ColorHelper.darker(AbstractLookAndFeel.getToolbarBackgroundColor(), 30); g.setColor(frameColor); g.drawRect(x, y, w - 1, h - 1); Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f); g2D.setComposite(alpha); g.setColor(Color.black); g.fillRect(x + 1, y + 1, w - 2, h - 2); g2D.setComposite(composite); } else if (model.isRollover()) { Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = ColorHelper.darker(frameColor, 5); Color frameLoColor = ColorHelper.darker(frameColor, 20); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h); frameHiColor = Color.white; frameLoColor = ColorHelper.brighter(frameLoColor, 60); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2); Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f); g2D.setComposite(alpha); g.setColor(Color.white); g.fillRect(x + 2, y + 2, w - 4, h - 4); g2D.setComposite(composite); g.setColor(AbstractLookAndFeel.getFocusColor()); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 2, x + w - 2, y + 2); } else if (model.isSelected()) { Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = Color.white; Color frameLoColor = ColorHelper.darker(frameColor, 30); JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); } } }
protected void paintRoundedBottomTabBorder( int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) { Graphics2D g2D = (Graphics2D) g; Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int d = 2 * GAP; if (isSelected) { g.setColor(AbstractLookAndFeel.getTheme().getFrameColor()); } else { g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFrameColor(), 40)); } g.drawLine(x1 + GAP, y2, x2 - GAP, y2); g.drawArc(x1, y2 - d, d, d, 180, 90); g.drawArc(x2 - d, y2 - d, d, d, -90, 90); g.drawLine(x1, y1, x1, y2 - GAP - 1); g.drawLine(x2, y1, x2, y2 - GAP - 1); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint); }
protected Color[] getContentBorderColors(int tabPlacement) { Color controlColorLight = AbstractLookAndFeel.getTheme().getControlColorLight(); if (!controlColorLight.equals(new ColorUIResource(106, 150, 192))) { controlColorLight = ColorHelper.brighter(controlColorLight, 6); Color controlColorDark = AbstractLookAndFeel.getTheme().getControlColorDark(); if (sepColors == null) { sepColors = new Color[5]; sepColors[0] = controlColorDark; sepColors[1] = controlColorLight; sepColors[2] = controlColorLight; sepColors[3] = controlColorLight; sepColors[4] = controlColorDark; } return sepColors; } else { if (tabPlacement == TOP || tabPlacement == LEFT) { if (sepColors == null) { int len = AbstractLookAndFeel.getTheme().getDefaultColors().length; sepColors = new Color[5]; sepColors[0] = AbstractLookAndFeel.getTheme().getDefaultColors()[0]; sepColors[1] = AbstractLookAndFeel.getTheme().getDefaultColors()[len - 6]; sepColors[2] = AbstractLookAndFeel.getTheme().getDefaultColors()[2]; sepColors[3] = AbstractLookAndFeel.getTheme().getDefaultColors()[1]; sepColors[4] = AbstractLookAndFeel.getTheme().getDefaultColors()[0]; } return sepColors; } else { if (altSepColors == null) { altSepColors = new Color[5]; altSepColors[0] = AbstractLookAndFeel.getTheme().getDefaultColors()[9]; altSepColors[1] = AbstractLookAndFeel.getTheme().getDefaultColors()[8]; altSepColors[2] = AbstractLookAndFeel.getTheme().getDefaultColors()[7]; altSepColors[3] = AbstractLookAndFeel.getTheme().getDefaultColors()[6]; altSepColors[4] = AbstractLookAndFeel.getTheme().getDefaultColors()[0]; } return altSepColors; } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Graphics2D g2D = (Graphics2D) g; Composite savedComposite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance( AlphaComposite.SRC_OVER, AbstractLookAndFeel.getTheme().getMenuAlpha()); g2D.setComposite(alpha); Color logoColor = AbstractLookAndFeel.getTheme().getMenuSelectionBackgroundColor(); Color borderColorLo = AbstractLookAndFeel.getFrameColor(); Color borderColorHi = ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40); g.setColor(logoColor); if (JTattooUtilities.isLeftToRight(c)) { int dx = getBorderInsets(c).left; g.fillRect(x, y, dx - 1, h - 1 - shadowSize); paintLogo(c, g, x, y, w, h); // - highlight g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40)); g.drawLine(x + dx, y + 1, x + w - shadowSize - 2, y + 1); g.setColor(borderColorHi); g.drawLine(x + 1, y, x + 1, y + h - shadowSize - 2); // - outer frame g.setColor(borderColorLo); if (isMenuBarPopup(c)) { // top g.drawLine(x + dx - 1, y, x + w - shadowSize - 1, y); // left g.drawLine(x, y, x, y + h - shadowSize - 1); // bottom g.drawLine(x, y + h - shadowSize - 1, x + w - shadowSize - 1, y + h - shadowSize - 1); // right g.drawLine(x + w - shadowSize - 1, y + 1, x + w - shadowSize - 1, y + h - shadowSize - 1); } else { g.drawRect(x, y, w - shadowSize - 1, h - shadowSize - 1); } // - logo separator g.drawLine(x + dx - 1, y + 1, x + dx - 1, y + h - shadowSize - 1); } else { int dx = getBorderInsets(c).right - shadowSize; g.fillRect(x + w - dx - shadowSize, y, dx - 1, h - 1 - shadowSize); paintLogo(c, g, x, y, w, h); // - highlight g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40)); g.drawLine(x + 1, y + 1, x + w - dx - shadowSize - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - shadowSize - 2); // - outer frame g.setColor(borderColorLo); if (isMenuBarPopup(c)) { // top g.drawLine(x, y, x + w - dx - shadowSize, y); // left g.drawLine(x, y, x, y + h - shadowSize - 1); // bottom g.drawLine(x, y + h - shadowSize - 1, x + w - shadowSize - 1, y + h - shadowSize - 1); // right g.drawLine(x + w - shadowSize - 1, y, x + w - shadowSize - 1, y + h - shadowSize - 1); } else { g.drawRect(x, y, w - shadowSize - 1, h - shadowSize - 1); } // - logo separator g.drawLine(x + w - dx - shadowSize, y + 1, x + w - dx - shadowSize, y + h - shadowSize - 1); } // paint the shadow g2D.setColor(AbstractLookAndFeel.getTheme().getShadowColor()); float alphaValue = 0.4f; for (int i = 0; i < shadowSize; i++) { alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alphaValue); g2D.setComposite(alpha); g.drawLine( x + w - shadowSize + i, y + shadowSize, x + w - shadowSize + i, y + h - shadowSize - 1 + i); g.drawLine( x + shadowSize, y + h - shadowSize + i, x + w - shadowSize + i, y + h - shadowSize + i); alphaValue -= (alphaValue / 2); } g2D.setComposite(savedComposite); }
protected Color getContentBorderColor(int tabPlacement) { return ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFrameColor(), 50); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { g.setColor(AbstractLookAndFeel.getTheme().getFrameColor()); g.drawRect(x, y, w - 1, h - 1); g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getTheme().getBackgroundColor(), 50)); g.drawRect(x + 1, y + 1, w - 3, h - 3); }
protected void paintBackground(Graphics g, AbstractButton b) { if (!b.isContentAreaFilled() || (b.getParent() instanceof JMenuBar)) { return; } if (!(b.isBorderPainted() && (b.getBorder() instanceof UIResource))) { super.paintBackground(g, b); return; } int width = b.getWidth(); int height = b.getHeight(); ButtonModel model = b.getModel(); Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) { if (model.isSelected()) { Color color = ColorHelper.darker(b.getBackground(), 20); g2D.setColor(color); g2D.fillRect(0, 0, width - 1, height - 1); if (model.isEnabled()) { g2D.setColor(AbstractLookAndFeel.getFrameColor()); } else { g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20)); } g2D.drawRect(0, 0, width - 1, height - 1); } else { Color[] colors = null; if (b.getBackground() instanceof ColorUIResource) { if (!model.isEnabled()) { colors = AbstractLookAndFeel.getTheme().getDisabledColors(); } else if (b.isRolloverEnabled() && model.isRollover()) { colors = AbstractLookAndFeel.getTheme().getRolloverColors(); } else { colors = AbstractLookAndFeel.getTheme().getButtonColors(); } } else { colors = ColorHelper.createColorArr( ColorHelper.brighter(b.getBackground(), 20), ColorHelper.darker(b.getBackground(), 20), 20); } JTattooUtilities.fillHorGradient(g, colors, 0, 0, width - 1, height - 1); if (model.isEnabled()) { g2D.setColor(AbstractLookAndFeel.getFrameColor()); } else { g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20)); } g2D.drawRect(0, 0, width - 1, height - 1); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f); g2D.setComposite(alpha); g2D.setColor(Color.white); g2D.drawRect(1, 1, width - 3, height - 3); } } else if (model.isPressed() && model.isArmed()) { int d = height - 2; Color color = AbstractLookAndFeel.getTheme().getSelectionBackgroundColor(); g2D.setColor(color); g2D.fillRoundRect(0, 0, width - 1, height - 1, d, d); g2D.setColor(ColorHelper.darker(color, 40)); g2D.drawRoundRect(0, 0, width - 1, height - 1, d, d); } else if (model.isSelected()) { int d = height - 2; Color color = ColorHelper.darker(b.getBackground(), 20); g2D.setColor(color); g2D.fillRoundRect(0, 0, width - 1, height - 1, d, d); if (model.isEnabled()) { g2D.setColor(AbstractLookAndFeel.getFrameColor()); } else { g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20)); } g2D.drawRoundRect(0, 0, width - 1, height - 1, d, d); } else { int d = height - 2; Color[] colors = null; if (b.getBackground() instanceof ColorUIResource) { if (!model.isEnabled()) { colors = AbstractLookAndFeel.getTheme().getDisabledColors(); } else if (b.isRolloverEnabled() && model.isRollover()) { colors = AbstractLookAndFeel.getTheme().getRolloverColors(); } else { colors = AbstractLookAndFeel.getTheme().getButtonColors(); } } else { colors = ColorHelper.createColorArr( ColorHelper.brighter(b.getBackground(), 20), ColorHelper.darker(b.getBackground(), 20), 20); } Shape savedClip = g.getClip(); Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, width - 1, height - 1, d, d)); clipArea.intersect(new Area(savedClip)); g2D.setClip(clipArea); JTattooUtilities.fillHorGradient(g, colors, 0, 0, width, height); g2D.setClip(savedClip); if (model.isEnabled()) { g2D.setColor(AbstractLookAndFeel.getFrameColor()); } else { g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20)); } g2D.drawRoundRect(0, 0, width - 1, height - 1, d, d); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f); g2D.setComposite(alpha); g2D.setColor(Color.white); g2D.drawRoundRect(1, 1, width - 3, height - 3, d - 2, d - 2); } g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint); g2D.setComposite(composite); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color frameColor = AbstractLookAndFeel.getTheme().getBackgroundColor(); JTattooUtilities.draw3DBorder( g, ColorHelper.darker(frameColor, 20), ColorHelper.brighter(frameColor, 80), x, y, w, h); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Graphics2D g2D = (Graphics2D) g; boolean active = isActive(c); boolean resizable = isResizable(c); int th = getTitleHeight(c); Color frameColor = AbstractLookAndFeel.getWindowInactiveBorderColor(); Color titleColor = AbstractLookAndFeel.getWindowInactiveTitleColorLight(); if (active) { titleColor = AbstractLookAndFeel.getWindowTitleColorLight(); frameColor = AbstractLookAndFeel.getWindowBorderColor(); } if (!resizable) { Insets bi = getBorderInsets(c); g.setColor(frameColor); g.drawRect(x, y, w - 1, h - 1); if (active) { g.setColor(AbstractLookAndFeel.getWindowTitleColorDark()); } else { g.setColor(AbstractLookAndFeel.getWindowInactiveTitleColorDark()); } for (int i = 1; i < bi.left; i++) { g.drawRect(i, i, w - (2 * i) - 1, h - (2 * i) - 1); } g.setColor(frameColor); g.drawLine(bi.left - 1, y + th + bi.top, bi.left - 1, y + h - bi.bottom); g.drawLine(w - bi.right, y + th + bi.top, w - bi.right, y + h - bi.bottom); g.drawLine(bi.left - 1, y + h - bi.bottom, w - bi.right, y + h - bi.bottom); return; } g.setColor(titleColor); g.fillRect(x, y + 1, w, dw - 1); g.fillRect(x + 1, y + h - dw, w - 2, dw - 1); Color color = ColorHelper.brighter(AbstractLookAndFeel.getWindowTitleColorDark(), 30); if (active) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getWindowTitleColors(), 1, dw, dw, th + 1); JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getWindowTitleColors(), w - dw, dw, dw, th + 1); Color c1 = AbstractLookAndFeel.getTheme().getWindowTitleColorDark(); Color c2 = AbstractLookAndFeel.getTheme().getWindowTitleColorLight(); g2D.setPaint(new GradientPaint(0, dw + th + 1, c1, 0, h - th - (2 * dw), c2)); g.fillRect(1, dw + th + 1, dw - 1, h - th - (2 * dw)); g.fillRect(w - dw, dw + th + 1, dw - 1, h - th - (2 * dw)); g2D.setPaint(null); } else { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getWindowInactiveTitleColors(), 1, dw, dw, th + 1); JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getWindowInactiveTitleColors(), w - dw, dw, dw, th + 1); Color c1 = AbstractLookAndFeel.getTheme().getWindowInactiveTitleColorDark(); Color c2 = AbstractLookAndFeel.getTheme().getWindowInactiveTitleColorLight(); g2D.setPaint(new GradientPaint(0, dw + th + 1, c1, 0, h - th - (2 * dw), c2)); g.fillRect(1, dw + th + 1, dw - 1, h - th - (2 * dw)); g.fillRect(w - dw, dw + th + 1, dw - 1, h - th - (2 * dw)); g2D.setPaint(null); } if (active && resizable) { int d = dw + 12; // unten color = AbstractLookAndFeel.getWindowTitleColorDark(); Color cHi = ColorHelper.brighter(color, 30); Color cLo = ColorHelper.darker(color, 20); // links g.setColor(color); g.fillRect(x + 1, y + h - d, dw - 1, d - 1); g.fillRect(x + dw, y + h - dw, d - dw - 1, d - dw - 1); g.setColor(cLo); g.drawLine(x + 1, y + h - d - 2, x + dw - 2, y + h - d - 2); g.drawLine(x + dw - 2, y + h - d - 2, x + dw - 2, y + h - dw); g.drawLine(x + dw - 2, y + h - dw, x + d - 1, y + h - dw); g.drawLine(x + d - 1, y + h - dw, x + d - 1, y + h - 1); g.setColor(cHi); g.drawLine(x + 1, y + h - d - 1, x + dw - 3, y + h - d - 1); g.drawLine(x + dw - 1, y + h - d - 1, x + dw - 1, y + h - dw - 1); g.drawLine(x + dw - 1, y + h - dw + 1, x + d - 2, y + h - dw + 1); g.drawLine(x + d - 2, y + h - dw + 1, x + d - 2, y + h - 1); // rechts g.setColor(color); g.fillRect(x + w - d - 1, y + h - dw, d, dw - 1); g.fillRect(x + w - dw, y + h - d - 1, dw - 1, d); g.setColor(cLo); g.drawLine(x + w - dw - 1, y + h - d - 2, x + w - 1, y + h - d - 2); g.drawLine(x + w - dw, y + h - d - 2, x + w - dw, y + h - dw); g.drawLine(x + w - d - 1, y + h - dw, x + w - dw, y + h - dw); g.drawLine(x + w - d - 1, y + h - dw, x + w - d - 1, y + h - 1); g.setColor(cHi); g.drawLine(x + w - dw + 1, y + h - d - 1, x + w - 1, y + h - d - 1); g.drawLine(x + w - dw + 1, y + h - d - 1, x + w - dw + 1, y + h - dw); g.drawLine(x + w - d, y + h - dw + 1, x + w - dw + 1, y + h - dw + 1); g.drawLine(x + w - d, y + h - dw + 1, x + w - d, y + h - 1); } g.setColor(frameColor); g.drawRect(x, y, w - 1, h - 1); g.drawLine(x + dw - 1, y + dw + th, x + dw - 1, y + h - dw); g.drawLine(x + w - dw, y + dw + th, x + w - dw, y + h - dw); g.drawLine(x + dw - 1, y + h - dw, x + w - dw, y + h - dw); }
protected void initComponentDefaults(UIDefaults table) { super.initComponentDefaults(table); BaseBorders.initDefaults(); BaseIcons.initDefaults(); Object textFieldBorder = getBorderFactory().getTextFieldBorder(); Object comboBoxBorder = getBorderFactory().getComboBoxBorder(); Object scrollPaneBorder = getBorderFactory().getScrollPaneBorder(); Object tableScrollPaneBorder = getBorderFactory().getTableScrollPaneBorder(); Object tabbedPaneBorder = getBorderFactory().getTabbedPaneBorder(); Object buttonBorder = getBorderFactory().getButtonBorder(); Object toggleButtonBorder = getBorderFactory().getToggleButtonBorder(); Object titledBorderBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.BorderUIResource$LineBorderUIResource", new Object[] {getFrameColor()}); Object menuBarBorder = getBorderFactory().getMenuBarBorder(); Object popupMenuBorder = getBorderFactory().getPopupMenuBorder(); Object menuItemBorder = getBorderFactory().getMenuItemBorder(); Object toolBarBorder = getBorderFactory().getToolBarBorder(); Object progressBarBorder = getBorderFactory().getProgressBarBorder(); Object toolTipBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.BorderUIResource$LineBorderUIResource", new Object[] {getFrameColor()}); Object focusCellHighlightBorder = new UIDefaults.ProxyLazyValue( "javax.swing.plaf.BorderUIResource$LineBorderUIResource", new Object[] {getFocusCellColor()}); Object optionPaneBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0); Object optionPaneMessageAreaBorder = BorderFactory.createEmptyBorder(8, 8, 8, 8); Object optionPaneButtonAreaBorder = BorderFactory.createEmptyBorder(0, 8, 8, 8); Object windowBorder = getBorderFactory().getInternalFrameBorder(); Color c = getBackgroundColor(); ColorUIResource progressBarBackground = new ColorUIResource(ColorHelper.brighter(c, 20)); // DEFAULTS TABLE Object[] defaults = { "controlTextFont", getControlTextFont(), "systemTextFont ", getSystemTextFont(), "userTextFont", getUserTextFont(), "menuTextFont", getMenuTextFont(), "windowTitleFont", getWindowTitleFont(), "subTextFont", getSubTextFont(), "Label.font", getUserTextFont(), "Label.background", getBackgroundColor(), "Label.foreground", getForegroundColor(), "Label.disabledText", getDisabledForegroundColor(), "Label.disabledShadow", getWhite(), // Text (Note: many are inherited) "TextField.border", textFieldBorder, "TextField.foreground", getInputForegroundColor(), "TextField.background", getInputBackgroundColor(), "TextField.disabledForeground", getDisabledForegroundColor(), "TextField.disabledBackground", getDisabledBackgroundColor(), "TextField.inactiveForeground", getDisabledForegroundColor(), "TextField.inactiveBackground", getDisabledBackgroundColor(), "TextArea.foreground", getInputForegroundColor(), "TextArea.background", getInputBackgroundColor(), "TextArea.disabledForeground", getDisabledForegroundColor(), "TextArea.disabledBackground", getDisabledBackgroundColor(), "TextArea.inactiveForeground", getDisabledForegroundColor(), "TextArea.inactiveBackground", getDisabledBackgroundColor(), "EditorPane.foreground", getInputForegroundColor(), "EditorPane.background", getInputBackgroundColor(), "EditorPane.disabledForeground", getDisabledForegroundColor(), "EditorPane.disabledBackground", getDisabledBackgroundColor(), "EditorPane.inactiveForeground", getDisabledForegroundColor(), "EditorPane.inactiveBackground", getDisabledBackgroundColor(), "FormattedTextField.border", textFieldBorder, "FormattedTextField.foreground", getInputForegroundColor(), "FormattedTextField.background", getInputBackgroundColor(), "FormattedTextField.disabledForeground", getDisabledForegroundColor(), "FormattedTextField.disabledBackground", getDisabledBackgroundColor(), "FormattedTextField.inactiveForeground", getDisabledForegroundColor(), "FormattedTextField.inactiveBackground", getDisabledBackgroundColor(), "PasswordField.border", textFieldBorder, "PasswordField.foreground", getInputForegroundColor(), "PasswordField.background", getInputBackgroundColor(), "PasswordField.disabledForeground", getDisabledForegroundColor(), "PasswordField.disabledBackground", getDisabledBackgroundColor(), "PasswordField.inactiveForeground", getDisabledForegroundColor(), "PasswordField.inactiveBackground", getDisabledBackgroundColor(), // Buttons "Button.background", getButtonBackgroundColor(), "Button.foreground", getButtonForegroundColor(), "Button.disabledText", getDisabledForegroundColor(), "Button.disabledShadow", getWhite(), "Button.select", getSelectionBackgroundColor(), "Button.border", buttonBorder, "Button.frame", getFrameColor(), "Button.focus", getFocusColor(), "Button.rolloverColor", getTheme().getRolloverColor(), "CheckBox.font", getUserTextFont(), "CheckBox.background", getBackgroundColor(), "CheckBox.foreground", getForegroundColor(), "CheckBox.disabledText", getDisabledForegroundColor(), "CheckBox.disabledShadow", getWhite(), "Checkbox.select", getSelectionBackgroundColor(), "CheckBox.focus", getFocusColor(), "CheckBox.icon", getIconFactory().getCheckBoxIcon(), "RadioButton.font", getUserTextFont(), "RadioButton.background", getBackgroundColor(), "RadioButton.foreground", getForegroundColor(), "RadioButton.disabledText", getDisabledForegroundColor(), "RadioButton.disabledShadow", getWhite(), "RadioButton.select", getSelectionBackgroundColor(), "RadioButton.icon", getIconFactory().getRadioButtonIcon(), "RadioButton.focus", getFocusColor(), "ToggleButton.background", getButtonBackgroundColor(), "ToggleButton.foreground", getButtonForegroundColor(), "ToggleButton.select", getSelectionBackgroundColor(), "ToggleButton.text", getButtonForegroundColor(), "ToggleButton.disabledText", getDisabledForegroundColor(), "ToggleButton.disabledShadow", getWhite(), "ToggleButton.disabledSelectedText", getDisabledForegroundColor(), "ToggleButton.disabledBackground", getButtonBackgroundColor(), "ToggleButton.disabledSelectedBackground", getSelectionBackgroundColor(), "ToggleButton.focus", getFocusColor(), "ToggleButton.border", toggleButtonBorder, // ToolTip "ToolTip.border", toolTipBorder, "ToolTip.foreground", getTooltipForegroundColor(), "ToolTip.background", getTooltipBackgroundColor(), // Slider "Slider.border", null, "Slider.foreground", getFrameColor(), "Slider.background", getBackgroundColor(), "Slider.focus", getFocusColor(), "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0), "Slider.trackWidth", new Integer(7), "Slider.majorTickLength", new Integer(6), // Progress Bar "ProgressBar.border", progressBarBorder, "ProgressBar.background", progressBarBackground, "ProgressBar.selectionForeground", getSelectionForegroundColor(), "ProgressBar.selectionBackground", getForegroundColor(), // Combo Box "ComboBox.border", comboBoxBorder, "ComboBox.background", getInputBackgroundColor(), "ComboBox.foreground", getInputForegroundColor(), "ComboBox.selectionBackground", getSelectionBackgroundColor(), "ComboBox.selectionForeground", getSelectionForegroundColor(), "ComboBox.selectionBorderColor", getFocusColor(), "ComboBox.disabledBackground", getDisabledBackgroundColor(), "ComboBox.disabledForeground", getDisabledForegroundColor(), "ComboBox.listBackground", getInputBackgroundColor(), "ComboBox.listForeground", getInputForegroundColor(), "ComboBox.font", getUserTextFont(), // Panel "Panel.foreground", getForegroundColor(), "Panel.background", getBackgroundColor(), "Panel.darkBackground", getTheme().getBackgroundColorDark(), "Panel.lightBackground", getTheme().getBackgroundColorLight(), "Panel.alterBackground", getTheme().getAlterBackgroundColor(), "Panel.font", getUserTextFont(), // RootPane "RootPane.frameBorder", windowBorder, "RootPane.plainDialogBorder", windowBorder, "RootPane.informationDialogBorder", windowBorder, "RootPane.errorDialogBorder", windowBorder, "RootPane.colorChooserDialogBorder", windowBorder, "RootPane.fileChooserDialogBorder", windowBorder, "RootPane.questionDialogBorder", windowBorder, "RootPane.warningDialogBorder", windowBorder, // InternalFrame "InternalFrame.border", getBorderFactory().getInternalFrameBorder(), "InternalFrame.font", getWindowTitleFont(), "InternalFrame.paletteBorder", getBorderFactory().getPaletteBorder(), "InternalFrame.paletteTitleHeight", new Integer(11), "InternalFrame.paletteCloseIcon", getIconFactory().getPaletteCloseIcon(), "InternalFrame.icon", getIconFactory().getMenuIcon(), "InternalFrame.iconifyIcon", getIconFactory().getIconIcon(), "InternalFrame.maximizeIcon", getIconFactory().getMaxIcon(), "InternalFrame.minimizeIcon", getIconFactory().getMinIcon(), "InternalFrame.closeIcon", getIconFactory().getCloseIcon(), // Titled Border "TitledBorder.titleColor", getForegroundColor(), "TitledBorder.border", titledBorderBorder, // List "List.focusCellHighlightBorder", focusCellHighlightBorder, "List.font", getUserTextFont(), "List.foreground", getInputForegroundColor(), "List.background", getInputBackgroundColor(), "List.selectionForeground", getSelectionForegroundColor(), "List.selectionBackground", getSelectionBackgroundColor(), "List.disabledForeground", getDisabledForegroundColor(), "List.disabledBackground", getDisabledBackgroundColor(), // ScrollBar "ScrollBar.background", getControlBackgroundColor(), "ScrollBar.highlight", getControlHighlightColor(), "ScrollBar.shadow", getControlShadowColor(), "ScrollBar.darkShadow", getControlDarkShadowColor(), "ScrollBar.thumb", getControlBackgroundColor(), "ScrollBar.thumbShadow", getControlShadowColor(), "ScrollBar.thumbHighlight", getControlHighlightColor(), "ScrollBar.width", new Integer(17), "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE, // ScrollPane "ScrollPane.border", scrollPaneBorder, "ScrollPane.foreground", getForegroundColor(), "ScrollPane.background", getBackgroundColor(), // Viewport "Viewport.foreground", getForegroundColor(), "Viewport.background", getBackgroundColor(), "Viewport.font", getUserTextFont(), // Tabbed Pane "TabbedPane.boder", tabbedPaneBorder, "TabbedPane.background", getBackgroundColor(), "TabbedPane.tabAreaBackground", getTabAreaBackgroundColor(), "TabbedPane.unselectedBackground", getControlColorDark(), "TabbedPane.foreground", getControlForegroundColor(), "TabbedPane.selected", getBackgroundColor(), "TabbedPane.selectedForeground", getTabSelectionForegroundColor(), "TabbedPane.tabAreaInsets", new InsetsUIResource(5, 5, 5, 5), "TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0), "TabbedPane.tabInsets", new InsetsUIResource(1, 6, 1, 6), "TabbedPane.focus", getFocusColor(), // TabbedPane ScrollButton "TabbedPane.selected", getButtonBackgroundColor(), "TabbedPane.shadow", new ColorUIResource(180, 180, 180), "TabbedPane.darkShadow", new ColorUIResource(120, 120, 120), "TabbedPane.highlight", new ColorUIResource(Color.white), // Tab Colors in Netbeans "tab_unsel_fill", getControlBackgroundColor(), "tab_sel_fill", getControlBackgroundColor(), // Table "Table.focusCellHighlightBorder", focusCellHighlightBorder, "Table.scrollPaneBorder", tableScrollPaneBorder, "Table.foreground", getInputForegroundColor(), "Table.background", getInputBackgroundColor(), "Table.gridColor", getGridColor(), "TableHeader.foreground", getControlForegroundColor(), "TableHeader.background", getBackgroundColor(), "TableHeader.cellBorder", getBorderFactory().getTableHeaderBorder(), // MenuBar "MenuBar.border", menuBarBorder, "MenuBar.foreground", getMenuForegroundColor(), "MenuBar.background", getMenuBackgroundColor(), // Menu "Menu.border", menuItemBorder, "Menu.borderPainted", Boolean.TRUE, "Menu.foreground", getMenuForegroundColor(), "Menu.background", getMenuBackgroundColor(), "Menu.selectionForeground", getMenuSelectionForegroundColor(), "Menu.selectionBackground", getMenuSelectionBackgroundColor(), "Menu.disabledForeground", getDisabledForegroundColor(), "Menu.acceleratorForeground", getMenuForegroundColor(), "Menu.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "Menu.arrowIcon", getIconFactory().getMenuArrowIcon(), // Popup Menu "PopupMenu.background", getMenuBackgroundColor(), "PopupMenu.border", popupMenuBorder, // Menu Item "MenuItem.border", menuItemBorder, "MenuItem.borderPainted", Boolean.TRUE, "MenuItem.foreground", getMenuForegroundColor(), "MenuItem.background", getMenuBackgroundColor(), "MenuItem.selectionForeground", getMenuSelectionForegroundColor(), "MenuItem.selectionBackground", getMenuSelectionBackgroundColor(), "MenuItem.disabledForeground", getDisabledForegroundColor(), "MenuItem.disabledShadow", getWhite(), "MenuItem.acceleratorForeground", getMenuForegroundColor(), "MenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "CheckBoxMenuItem.border", menuItemBorder, "CheckBoxMenuItem.borderPainted", Boolean.TRUE, "CheckBoxMenuItem.foreground", getMenuForegroundColor(), "CheckBoxMenuItem.background", getMenuBackgroundColor(), "CheckBoxMenuItem.selectionForeground", getMenuSelectionForegroundColor(), "CheckBoxMenuItem.selectionBackground", getMenuSelectionBackgroundColor(), "CheckBoxMenuItem.disabledForeground", getDisabledForegroundColor(), "CheckBoxMenuItem.disabledShadow", getWhite(), "CheckBoxMenuItem.acceleratorForeground", getMenuForegroundColor(), "CheckBoxMenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "CheckBoxMenuItem.checkIcon", getIconFactory().getMenuCheckBoxIcon(), "RadioButtonMenuItem.border", menuItemBorder, "RadioButtonMenuItem.borderPainted", Boolean.TRUE, "RadioButtonMenuItem.foreground", getMenuForegroundColor(), "RadioButtonMenuItem.background", getMenuBackgroundColor(), "RadioButtonMenuItem.selectionForeground", getMenuSelectionForegroundColor(), "RadioButtonMenuItem.selectionBackground", getMenuSelectionBackgroundColor(), "RadioButtonMenuItem.disabledForeground", getDisabledForegroundColor(), "RadioButtonMenuItem.disabledShadow", getWhite(), "RadioButtonMenuItem.acceleratorForeground", getMenuForegroundColor(), "RadioButtonMenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "RadioButtonMenuItem.checkIcon", getIconFactory().getMenuRadioButtonIcon(), // OptionPane. "OptionPane.errorIcon", getIconFactory().getOptionPaneErrorIcon(), "OptionPane.informationIcon", getIconFactory().getOptionPaneInformationIcon(), "OptionPane.warningIcon", getIconFactory().getOptionPaneWarningIcon(), "OptionPane.questionIcon", getIconFactory().getOptionPaneQuestionIcon(), "OptionPane.border", optionPaneBorder, "OptionPane.messageAreaBorder", optionPaneMessageAreaBorder, "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder, // File View "FileView.directoryIcon", getIconFactory().getTreeFolderIcon(), "FileView.fileIcon", getIconFactory().getTreeLeafIcon(), "FileView.computerIcon", getIconFactory().getTreeComputerIcon(), "FileView.hardDriveIcon", getIconFactory().getTreeHardDriveIcon(), "FileView.floppyDriveIcon", getIconFactory().getTreeFloppyDriveIcon(), // File Chooser "FileChooser.detailsViewIcon", getIconFactory().getFileChooserDetailViewIcon(), "FileChooser.homeFolderIcon", getIconFactory().getFileChooserHomeFolderIcon(), "FileChooser.listViewIcon", getIconFactory().getFileChooserListViewIcon(), "FileChooser.newFolderIcon", getIconFactory().getFileChooserNewFolderIcon(), "FileChooser.upFolderIcon", getIconFactory().getFileChooserUpFolderIcon(), // Separator "Separator.background", getBackgroundColor(), "Separator.foreground", getControlForegroundColor(), // SplitPane "SplitPane.centerOneTouchButtons", Boolean.TRUE, "SplitPane.dividerSize", new Integer(7), "SplitPane.border", BorderFactory.createEmptyBorder(), // Tree "Tree.background", getInputBackgroundColor(), "Tree.foreground", getInputForegroundColor(), "Tree.textForeground", getInputForegroundColor(), "Tree.textBackground", getInputBackgroundColor(), "Tree.openIcon", getIconFactory().getTreeFolderIcon(), "Tree.closedIcon", getIconFactory().getTreeFolderIcon(), "Tree.leafIcon", getIconFactory().getTreeLeafIcon(), "Tree.expandedIcon", getIconFactory().getTreeExpandedIcon(), "Tree.collapsedIcon", getIconFactory().getTreeCollapsedIcon(), "Tree.selectionBorderColor", getFocusCellColor(), "Tree.line", getFrameColor(), // horiz lines "Tree.hash", getFrameColor(), // legs // ToolBar "JToolBar.isRollover", Boolean.TRUE, "ToolBar.border", toolBarBorder, "ToolBar.background", getToolbarBackgroundColor(), "ToolBar.foreground", getToolbarForegroundColor(), "ToolBar.dockingBackground", getToolbarBackgroundColor(), "ToolBar.dockingForeground", getToolbarDockingColor(), "ToolBar.floatingBackground", getToolbarBackgroundColor(), "ToolBar.floatingForeground", getToolbarForegroundColor(), }; table.putDefaults(defaults); if (JTattooUtilities.getJavaVersion() >= 1.5) { table.put("Spinner.font", getControlTextFont()); table.put("Spinner.background", getButtonBackgroundColor()); table.put("Spinner.foreground", getButtonForegroundColor()); table.put("Spinner.border", getBorderFactory().getSpinnerBorder()); table.put("Spinner.arrowButtonInsets", null); table.put("Spinner.arrowButtonBorder", BorderFactory.createEmptyBorder()); table.put("Spinner.editorBorderPainted", Boolean.FALSE); } }
public void paintIcon(Component c, Graphics g, int x, int y) { if (!JTattooUtilities.isLeftToRight(c)) { x += GAP; } int w = getIconWidth() - GAP; int h = getIconHeight(); AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); Graphics2D g2D = (Graphics2D) g; if (button.isEnabled()) { if ((button.isRolloverEnabled() && model.isRollover())) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getRolloverColors(), x + 1, y + 1, w - 1, h - 1); } else { if (AbstractLookAndFeel.getTheme().doShowFocusFrame() && button.hasFocus()) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getFocusColors(), x + 1, y + 1, w - 1, h - 1); } else { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getCheckBoxColors(), x + 1, y + 1, w - 1, h - 1); } } } else { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getDisabledColors(), x + 1, y + 1, w - 1, h - 1); } Color frameColor = ColorHelper.brighter(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 6); Color loFrameColor = ColorHelper.darker(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 50); g.setColor(frameColor); g.drawRect(x, y, w, h); Composite savedComposite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); g2D.setComposite(alpha); g.setColor(loFrameColor); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); g2D.setComposite(savedComposite); Icon checkIcon; Icon checkDisabledIcon; Icon checkInverseIcon; if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { checkIcon = SMALL_CHECK_ICON; checkDisabledIcon = SMALL_CHECK_DISABLED_ICON; checkInverseIcon = SMALL_CHECK_INVERSE_ICON; } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { checkIcon = MEDIUM_CHECK_ICON; checkDisabledIcon = MEDIUM_CHECK_DISABLED_ICON; checkInverseIcon = MEDIUM_CHECK_INVERSE_ICON; } else { checkIcon = LARGE_CHECK_ICON; checkDisabledIcon = LARGE_CHECK_DISABLED_ICON; checkInverseIcon = LARGE_CHECK_INVERSE_ICON; } int xi = x + ((w - checkIcon.getIconWidth()) / 2) + 1; int yi = y + ((h - checkIcon.getIconHeight()) / 2); int gv = ColorHelper.getGrayValue(AbstractLookAndFeel.getButtonForegroundColor()); if (model.isPressed() && model.isArmed()) { Color bc = gv > 128 ? AbstractLookAndFeel.getTheme().getSelectionForegroundColor() : AbstractLookAndFeel.getTheme().getSelectionBackgroundColor(); Color fc = gv > 128 ? ColorHelper.brighter(bc, 20) : ColorHelper.darker(bc, 40); g.setColor(fc); g.drawRect(x + 4, y + 4, w - 8, h - 8); g.setColor(bc); g.fillRect(x + 5, y + 5, w - 9, h - 9); } else if (model.isSelected()) { if (!model.isEnabled()) { checkDisabledIcon.paintIcon(c, g, xi + 1, yi); } else { if (gv > 128) { checkIcon.paintIcon(c, g, xi, yi); } else { checkInverseIcon.paintIcon(c, g, xi + 1, yi + 1); } } } }
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { if (!c.isEnabled()) { return; } g.translate(thumbBounds.x, thumbBounds.y); Color colors[] = getThumbColors(); Color frameColorHi = ColorHelper.brighter(colors[1], 20); Color frameColorLo = ColorHelper.darker(colors[colors.length - 1], 10); Graphics2D g2D = (Graphics2D) g; Composite savedComposite = g2D.getComposite(); if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { JTattooUtilities.fillVerGradient( g, colors, 1, 1, thumbBounds.width - 1, thumbBounds.height - 1); JTattooUtilities.draw3DBorder( g, frameColorLo, ColorHelper.darker(frameColorLo, 15), 0, 0, thumbBounds.width, thumbBounds.height); g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f)); g.setColor(frameColorHi); g.drawLine(1, 1, thumbBounds.width - 2, 1); g.drawLine(1, 1, 1, thumbBounds.height - 2); int dx = 5; int dy = thumbBounds.height / 2 - 3; int dw = thumbBounds.width - 11; Color c1 = Color.white; Color c2 = Color.darkGray; for (int i = 0; i < 4; i++) { g.setColor(c1); g.drawLine(dx, dy, dx + dw, dy); dy++; g.setColor(c2); g.drawLine(dx, dy, dx + dw, dy); dy++; } g2D.setComposite(savedComposite); } else { // HORIZONTAL JTattooUtilities.fillHorGradient( g, colors, 1, 1, thumbBounds.width - 1, thumbBounds.height - 1); JTattooUtilities.draw3DBorder( g, frameColorLo, ColorHelper.darker(frameColorLo, 10), 0, 0, thumbBounds.width, thumbBounds.height); g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f)); g.setColor(frameColorHi); g.drawLine(1, 1, thumbBounds.width - 2, 1); g.drawLine(1, 1, 1, thumbBounds.height - 2); int dx = thumbBounds.width / 2 - 3; int dy = 5; int dh = thumbBounds.height - 11; Color c1 = Color.white; Color c2 = Color.darkGray; for (int i = 0; i < 4; i++) { g.setColor(c1); g.drawLine(dx, dy, dx, dy + dh); dx++; g.setColor(c2); g.drawLine(dx, dy, dx, dy + dh); dx++; } } g2D.setComposite(savedComposite); g.translate(-thumbBounds.x, -thumbBounds.y); }
protected void paintDeterminate(Graphics g, JComponent c) { if (!(g instanceof Graphics2D)) { return; } Graphics2D g2D = (Graphics2D) g; Insets b = progressBar.getInsets(); // area for border int w = progressBar.getWidth() - (b.right + b.left); int h = progressBar.getHeight() - (b.top + b.bottom); // amount of progress to draw int amountFull = getAmountFull(b, w, h); Color colors[]; if (progressBar.getForeground() instanceof UIResource) { if (!Utilities.isActive(c)) { colors = BaseLookAndFeel.getTheme().getInActiveColors(); } else if (c.isEnabled()) { colors = BaseLookAndFeel.getTheme().getProgressBarColors(); } else { colors = BaseLookAndFeel.getTheme().getDisabledColors(); } } else { Color hiColor = ColorHelper.brighter(progressBar.getForeground(), 40); Color loColor = ColorHelper.darker(progressBar.getForeground(), 20); colors = ColorHelper.createColorArr(hiColor, loColor, 20); } Color cHi = ColorHelper.darker(colors[colors.length - 1], 5); Color cLo = ColorHelper.darker(colors[colors.length - 1], 10); if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { if (Utilities.isLeftToRight(progressBar)) { Utilities.draw3DBorder(g, cHi, cLo, 1 + b.left, 2, amountFull - 2, h - 2); Utilities.fillHorGradient(g, colors, 2 + b.left, 3, amountFull - 4, h - 4); } else { Utilities.draw3DBorder( g, cHi, cLo, progressBar.getWidth() - amountFull - b.right + 2, 2, amountFull - 2, h - 2); Utilities.fillHorGradient( g, colors, progressBar.getWidth() - amountFull - b.right + 3, 3, amountFull - 4, h - 4); } } else { // VERTICAL Utilities.draw3DBorder(g, cHi, cLo, 2, h - amountFull + 2, w - 2, amountFull - 2); Utilities.fillVerGradient(g, colors, 3, h - amountFull + 3, w - 4, amountFull - 4); } // Deal with possible text painting if (progressBar.isStringPainted()) { Object savedRenderingHint = null; if (BaseLookAndFeel.getTheme().isTextAntiAliasingOn()) { savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); g2D.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, BaseLookAndFeel.getTheme().getTextAntiAliasingHint()); } paintString(g, b.left, b.top, w, h, amountFull, b); if (BaseLookAndFeel.getTheme().isTextAntiAliasingOn()) { g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint); } } }
public void paintIcon(Component c, Graphics g, int x, int y) { if (!JTattooUtilities.isLeftToRight(c)) { x += GAP; } int w = getIconWidth() - GAP; int h = getIconHeight(); Graphics2D g2D = (Graphics2D) g; AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); Color colors[]; if (button.isEnabled()) { if ((button.isRolloverEnabled() && model.isRollover()) || (model.isPressed() && model.isArmed())) { colors = AbstractLookAndFeel.getTheme().getRolloverColors(); } else { if (AbstractLookAndFeel.getTheme().doShowFocusFrame() && button.hasFocus()) { colors = AbstractLookAndFeel.getTheme().getFocusColors(); } else { colors = AbstractLookAndFeel.getTheme().getCheckBoxColors(); } } } else { colors = AbstractLookAndFeel.getTheme().getDisabledColors(); } Color frameColor = ColorHelper.brighter(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 6); Shape savedClip = g.getClip(); Area clipArea = new Area(new Ellipse2D.Double(x, y, w + 1, h + 1)); if (savedClip != null) { clipArea.intersect(new Area(savedClip)); } g2D.setClip(clipArea); JTattooUtilities.fillHorGradient(g, colors, x, y, w, h); g2D.setClip(savedClip); Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(frameColor); g.drawOval(x, y, w, h); if (model.isSelected()) { if (model.isEnabled()) { Color fc = AbstractLookAndFeel.getForegroundColor(); if (ColorHelper.getGrayValue(colors[0]) < 128) { if (ColorHelper.getGrayValue(fc) < 128) { g2D.setColor(Color.white); } else { g2D.setColor(fc); } } else { if (ColorHelper.getGrayValue(fc) > 128) { g2D.setColor(Color.black); } else { g2D.setColor(fc); } } } else { g.setColor(AbstractLookAndFeel.getDisabledForegroundColor()); } if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { g2D.fillOval(x + 4, y + 4, w - 7, h - 7); } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { g2D.fillOval(x + 4, y + 4, w - 7, h - 7); } else { g2D.fillOval(x + 5, y + 5, w - 9, h - 9); } } g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint); }