protected void paintBackground(Graphics g) { int draggedColumn = -1; if ((header != null) && (header.getTable() != null) && header.getDraggedColumn() != null) { draggedColumn = header.getColumnModel().getColumnIndex(header.getDraggedColumn().getIdentifier()); } int w = getWidth(); int h = getHeight(); if ((table != null) && table.isEnabled() && (col == rolloverCol || col == draggedColumn)) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getRolloverColors(), 0, 0, w, h); if (drawRolloverBar()) { g.setColor(AbstractLookAndFeel.getFocusColor()); g.drawLine(0, 0, w - 1, 0); g.drawLine(0, 1, w - 1, 1); g.drawLine(0, 2, w - 1, 2); } } else if (drawAllwaysActive() || JTattooUtilities.isFrameActive(header)) { if (header.getBackground() instanceof ColorUIResource) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getColHeaderColors(), 0, 0, w, h); } else { g.setColor(header.getBackground()); g.fillRect(0, 0, w, h); } } else { if (header.getBackground() instanceof ColorUIResource) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getInActiveColors(), 0, 0, w, h); } else { g.setColor(header.getBackground()); g.fillRect(0, 0, w, h); } } }
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { int w = c.getWidth(); int h = c.getHeight(); if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { JTattooUtilities.fillVerGradient( g, AbstractLookAndFeel.getTheme().getTrackColors(), 0, 0, w, h); } else { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getTrackColors(), 0, 0, w, h); } }
protected void paintBackground(Graphics g, Rectangle cellRect, int col) { Component component = getHeaderRenderer(col); int x = cellRect.x; int y = cellRect.y; int w = cellRect.width; int h = cellRect.height; if (header.getBackground() instanceof ColorUIResource) { if ((col == rolloverCol) && (component != null) && component.isEnabled()) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getRolloverColors(), x, y, w, h); } else if (drawAllwaysActive() || JTattooUtilities.isFrameActive(header)) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getColHeaderColors(), x, y, w, h); } else { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getInActiveColors(), x, y, w, h); } } else { g.setColor(header.getBackground()); g.fillRect(x, y, w, h); } }
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); }
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); }