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 paintFocus( Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { Graphics2D g2D = (Graphics2D) g; int width = b.getWidth(); int height = b.getHeight(); if (((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) { g.setColor(AbstractLookAndFeel.getFocusColor()); BasicGraphicsUtils.drawDashedRect(g, 4, 3, width - 8, height - 6); } else { Object savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setColor(AbstractLookAndFeel.getFocusColor()); int d = b.getHeight() - 4; g2D.drawRoundRect(2, 2, b.getWidth() - 5, b.getHeight() - 5, d, d); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRenderingHint); } }
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); } } }