01: package com.opensymphony.workflow.designer.swing.plaf;
02:
03: import java.awt.*;
04: import javax.swing.*;
05: import javax.swing.plaf.basic.BasicButtonUI;
06:
07: public class BlueButtonUI extends BasicButtonUI {
08: private Color blueishBackground = new Color(220, 225, 234);
09: private Color blueishBorder = new Color(10, 36, 106);
10:
11: public BlueButtonUI() {
12: super ();
13: }
14:
15: public void installUI(JComponent c) {
16: super .installUI(c);
17:
18: AbstractButton button = (AbstractButton) c;
19: button.setRolloverEnabled(true);
20: button.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
21: if (c.getClientProperty("showtext") != Boolean.TRUE)
22: button.setText(null);
23: }
24:
25: public void paint(Graphics g, JComponent c) {
26: AbstractButton button = (AbstractButton) c;
27: if (button.getModel().isRollover()
28: || button.getModel().isArmed()
29: || button.getModel().isSelected()) {
30: Color oldColor = g.getColor();
31: g.setColor(blueishBackground);
32: g.fillRect(0, 0, c.getWidth() - 1, c.getHeight() - 1);
33:
34: g.setColor(blueishBorder);
35: g.drawRect(0, 0, c.getWidth() - 1, c.getHeight() - 1);
36:
37: g.setColor(oldColor);
38: }
39: super .paint(g, c);
40: }
41:
42: protected void paintButtonPressed(Graphics g, AbstractButton b) {
43: setTextShiftOffset();
44: }
45:
46: protected int getTextShiftOffset() {
47: return 1;
48: }
49: }
|