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); } } }
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, 0.8f); g2D.setComposite(alpha); Color cHi = AbstractLookAndFeel.getTheme().getControlHighlightColor(); Color cLo = AbstractLookAndFeel.getTheme().getControlShadowColor(); JTattooUtilities.draw3DBorder(g, cHi, cLo, x, y, w, h); g2D.setComposite(savedComposite); }
public void paintTrack(Graphics g) { boolean leftToRight = JTattooUtilities.isLeftToRight(slider); g.translate(trackRect.x, trackRect.y); int overhang = 4; int trackLeft = 0; int trackTop = 0; int trackRight = 0; int trackBottom = 0; if (slider.getOrientation() == JSlider.HORIZONTAL) { trackBottom = (trackRect.height - 1) - overhang; trackTop = trackBottom - (getTrackWidth() - 1); trackRight = trackRect.width - 1; } else { if (leftToRight) { trackLeft = (trackRect.width - overhang) - getTrackWidth(); trackRight = (trackRect.width - overhang) - 1; } else { trackLeft = overhang; trackRight = overhang + getTrackWidth() - 1; } trackBottom = trackRect.height - 1; } g.setColor(AbstractLookAndFeel.getFrameColor()); g.drawRect(trackLeft, trackTop, (trackRight - trackLeft) - 1, (trackBottom - trackTop) - 1); int middleOfThumb = 0; int fillTop = 0; int fillLeft = 0; int fillBottom = 0; int fillRight = 0; if (slider.getOrientation() == JSlider.HORIZONTAL) { middleOfThumb = thumbRect.x + (thumbRect.width / 2); middleOfThumb -= trackRect.x; fillTop = trackTop + 1; fillBottom = trackBottom - 2; if (!drawInverted()) { fillLeft = trackLeft + 1; fillRight = middleOfThumb; } else { fillLeft = middleOfThumb; fillRight = trackRight - 2; } Color colors[] = null; if (!JTattooUtilities.isActive(slider)) { colors = AbstractLookAndFeel.getTheme().getInActiveColors(); } else { if (slider.isEnabled()) { colors = AbstractLookAndFeel.getTheme().getSliderColors(); } else { colors = AbstractLookAndFeel.getTheme().getDisabledColors(); } } JTattooUtilities.fillHorGradient( g, colors, fillLeft + 2, fillTop + 2, fillRight - fillLeft - 2, fillBottom - fillTop - 2); Color cHi = ColorHelper.darker(colors[colors.length - 1], 5); Color cLo = ColorHelper.darker(colors[colors.length - 1], 10); JTattooUtilities.draw3DBorder( g, cHi, cLo, fillLeft + 1, fillTop + 1, fillRight - fillLeft - 1, fillBottom - fillTop - 1); } else { middleOfThumb = thumbRect.y + (thumbRect.height / 2); middleOfThumb -= trackRect.y; fillLeft = trackLeft + 1; fillRight = trackRight - 2; if (!drawInverted()) { fillTop = middleOfThumb; fillBottom = trackBottom - 2; } else { fillTop = trackTop + 1; fillBottom = middleOfThumb; } Color colors[] = null; if (!JTattooUtilities.isActive(slider)) { colors = AbstractLookAndFeel.getTheme().getInActiveColors(); } else { if (slider.isEnabled()) { colors = AbstractLookAndFeel.getTheme().getSliderColors(); } else { colors = AbstractLookAndFeel.getTheme().getDisabledColors(); } } JTattooUtilities.fillVerGradient( g, colors, fillLeft + 2, fillTop + 2, fillRight - fillLeft - 2, fillBottom - fillTop - 2); Color cHi = ColorHelper.darker(colors[colors.length - 1], 5); Color cLo = ColorHelper.darker(colors[colors.length - 1], 10); JTattooUtilities.draw3DBorder( g, cHi, cLo, fillLeft + 1, fillTop + 1, fillRight - fillLeft - 1, fillBottom - fillTop - 1); } g.translate(-trackRect.x, -trackRect.y); }
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); }
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); }