Browse Source

Add a status bar popup panel that is toggled by clicking not mouseover.

Change-Id: I08c81b81908d4b5af623da90ad7816e5c3668d7a
Reviewed-on: http://gerrit.dmdirc.com/1881
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.7rc1
Greg Holmes 13 years ago
parent
commit
0723cfa836

+ 2
- 7
src/com/dmdirc/addons/lagdisplay/LagDisplayPanel.java View File

@@ -27,8 +27,6 @@ import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupWindow;
27 27
 /**
28 28
  * Shows the user's lag in the status bar, and reveals details of all servers
29 29
  * when the user hovers over it.
30
- * 
31
- * @author chris
32 30
  */
33 31
 public class LagDisplayPanel extends StatusbarPopupPanel {
34 32
 
@@ -38,9 +36,8 @@ public class LagDisplayPanel extends StatusbarPopupPanel {
38 36
      * objects being unserialized with the new class).
39 37
      */
40 38
     private static final long serialVersionUID = 2;
41
-
42 39
     /** Lag display plugin. */
43
-    private LagDisplayPlugin plugin;
40
+    private final LagDisplayPlugin plugin;
44 41
 
45 42
     /**
46 43
      * Creates a new {@link LagDisplayPanel} for the specified plugin.
@@ -58,6 +55,4 @@ public class LagDisplayPanel extends StatusbarPopupPanel {
58 55
     protected StatusbarPopupWindow getWindow() {
59 56
         return new ServerInfoDialog(plugin, this);
60 57
     }
61
-    
62
-  
63
-}
58
+}

+ 2
- 2
src/com/dmdirc/addons/lagdisplay/ServerInfoDialog.java View File

@@ -26,7 +26,7 @@ import com.dmdirc.Server;
26 26
 import com.dmdirc.ServerManager;
27 27
 import com.dmdirc.ServerState;
28 28
 import com.dmdirc.addons.ui_swing.SwingController;
29
-import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupPanel;
29
+import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPanel;
30 30
 import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupWindow;
31 31
 import com.dmdirc.plugins.PluginManager;
32 32
 
@@ -60,7 +60,7 @@ public class ServerInfoDialog extends StatusbarPopupWindow {
60 60
      * @param ldp The {@link LagDisplayPlugin} we're using for info
61 61
      * @param parent The {@link JPanel} to use for positioning
62 62
      */
63
-    public ServerInfoDialog(final LagDisplayPlugin ldp, final StatusbarPopupPanel parent) {
63
+    public ServerInfoDialog(final LagDisplayPlugin ldp, final StatusbarPanel parent) {
64 64
         super(parent, ((SwingController) PluginManager.getPluginManager()
65 65
                 .getPluginInfoByName("ui_swing").getPlugin()).getMainFrame());
66 66
 

+ 157
- 0
src/com/dmdirc/addons/ui_swing/components/statusbar/StatusbarPanel.java View File

@@ -0,0 +1,157 @@
1
+/*
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.ui_swing.components.statusbar;
24
+
25
+import com.dmdirc.addons.ui_swing.UIUtilities;
26
+import com.dmdirc.ui.interfaces.StatusBarComponent;
27
+
28
+import java.awt.event.MouseListener;
29
+
30
+import javax.swing.BorderFactory;
31
+import javax.swing.JLabel;
32
+import javax.swing.JPanel;
33
+
34
+import net.miginfocom.swing.MigLayout;
35
+
36
+/**
37
+ * A panel shown in the status bar which displays a {@link StatusbarPopupWindow}
38
+ * when the user mouses over it.
39
+ *
40
+ * @since 0.6.3m1
41
+ */
42
+public abstract class StatusbarPanel extends JPanel
43
+        implements StatusBarComponent, MouseListener {
44
+
45
+    /** The label we use to show information. */
46
+    protected final JLabel label;
47
+    /**
48
+     * A version number for this class. It should be changed whenever the class
49
+     * structure is changed (or anything else that would prevent serialized
50
+     * objects being unserialized with the new class).
51
+     */
52
+    private static final long serialVersionUID = 2;
53
+    /** The popup window we're using to show extra info. */
54
+    private StatusbarPopupWindow dialog;
55
+
56
+    /**
57
+     * Creates a new {@link StatusbarPanel}, using a default text label.
58
+     */
59
+    public StatusbarPanel() {
60
+        this(new JLabel("Unknown"));
61
+    }
62
+
63
+    /**
64
+     * Creates a new {@link StatusbarPanel}, using the specified label.
65
+     *
66
+     * @param label The label to be displayed in the status bar
67
+     */
68
+    public StatusbarPanel(final JLabel label) {
69
+        super();
70
+
71
+        this.label = label;
72
+
73
+        setBorder(BorderFactory.createEtchedBorder());
74
+        setLayout(new MigLayout("ins 0 rel 0 rel, aligny center"));
75
+        add(label);
76
+
77
+        addMouseListener(this);
78
+    }
79
+
80
+    /**
81
+     * Closes and reopens the dialog to update information and border positions.
82
+     */
83
+    public final void refreshDialog() {
84
+        UIUtilities.invokeLater(new Runnable() {
85
+            @Override
86
+            public void run() {
87
+                synchronized (StatusbarPanel.this) {
88
+                    if (dialog != null) {
89
+                        closeDialog();
90
+                        openDialog();
91
+                    }
92
+                }
93
+            }
94
+        });
95
+    }
96
+
97
+    /**
98
+     * Opens the information dialog.
99
+     */
100
+    protected final void openDialog() {
101
+        synchronized (StatusbarPanel.this) {
102
+            dialog = getWindow();
103
+            dialog.setVisible(true);
104
+        }
105
+    }
106
+
107
+    /**
108
+     * Closes the information dialog.
109
+     */
110
+    protected final void closeDialog() {
111
+        synchronized (StatusbarPanel.this) {
112
+            if (dialog != null) {
113
+                dialog.setVisible(false);
114
+                dialog.dispose();
115
+                dialog = null;
116
+            }
117
+        }
118
+    }
119
+
120
+    /**
121
+     * Checks if this dialog is open.
122
+     *
123
+     * @return is the dialog open
124
+     */
125
+    protected final boolean isDialogOpen() {
126
+        synchronized (StatusbarPanel.this) {
127
+            if (dialog != null) {
128
+                return dialog.isVisible();
129
+            }
130
+            return false;
131
+        }
132
+    }
133
+
134
+    /**
135
+     * Sets the text for this label.
136
+     *
137
+     * @param text New text
138
+     */
139
+    public void setText(final String text) {
140
+        UIUtilities.invokeLater(new Runnable() {
141
+
142
+            /** {@inheritDoc} */
143
+            @Override
144
+            public void run() {
145
+                label.setText(text);
146
+            }
147
+        });
148
+    }
149
+
150
+    /**
151
+     * Retrieves the implementation of {@link StatusbarPopupWindow} that should
152
+     * be shown by this panel when the user mouses over it.
153
+     *
154
+     * @return A concrete {@link StatusbarPopupWindow} implementation to use
155
+     */
156
+    protected abstract StatusbarPopupWindow getWindow();
157
+}

+ 14
- 141
src/com/dmdirc/addons/ui_swing/components/statusbar/StatusbarPopupPanel.java View File

@@ -19,34 +19,22 @@
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
21 21
  */
22
-package com.dmdirc.addons.ui_swing.components.statusbar;
23 22
 
24
-import com.dmdirc.addons.ui_swing.UIUtilities;
25
-import com.dmdirc.ui.interfaces.StatusBarComponent;
23
+package com.dmdirc.addons.ui_swing.components.statusbar;
26 24
 
27
-import java.awt.Color;
28
-import java.awt.Component;
29
-import java.awt.Graphics;
30 25
 import java.awt.event.MouseEvent;
31
-import java.awt.event.MouseListener;
32
-import javax.swing.BorderFactory;
33
-import javax.swing.JLabel;
34
-import javax.swing.JPanel;
35 26
 
27
+import javax.swing.JLabel;
36 28
 import javax.swing.UIManager;
37 29
 import javax.swing.border.EtchedBorder;
38 30
 
39
-import net.miginfocom.swing.MigLayout;
40
-
41 31
 /**
42 32
  * A panel shown in the status bar which displays a {@link StatusbarPopupWindow}
43 33
  * when the user mouses over it.
44 34
  *
45 35
  * @since 0.6.3m1
46
- * @author chris
47 36
  */
48
-public abstract class StatusbarPopupPanel extends JPanel
49
-        implements StatusBarComponent, MouseListener {
37
+public abstract class StatusbarPopupPanel extends StatusbarPanel {
50 38
 
51 39
     /**
52 40
      * A version number for this class. It should be changed whenever the class
@@ -54,12 +42,6 @@ public abstract class StatusbarPopupPanel extends JPanel
54 42
      * objects being unserialized with the new class).
55 43
      */
56 44
     private static final long serialVersionUID = 2;
57
-    
58
-    /** The label we use to show information. */
59
-    protected final JLabel label;
60
-
61
-    /** The popup window we're using to show extra info. */
62
-    private StatusbarPopupWindow dialog;
63 45
 
64 46
     /**
65 47
      * Creates a new {@link StatusbarPopupPanel}, using a default text label.
@@ -74,84 +56,12 @@ public abstract class StatusbarPopupPanel extends JPanel
74 56
      * @param label The label to be displayed in the status bar
75 57
      */
76 58
     public StatusbarPopupPanel(final JLabel label) {
77
-        super();
78
-
79
-        this.label = label;
80
-
81
-        setBorder(BorderFactory.createEtchedBorder());
82
-        setLayout(new MigLayout("ins 0 rel 0 rel, aligny center"));
83
-        add(label);
84
-        
85
-        addMouseListener(this);
86
-    }
87
-    
88
-    /**
89
-     * Closes and reopens the dialog to update information and border positions.
90
-     */
91
-    public final void refreshDialog() {
92
-        UIUtilities.invokeLater(new Runnable() {
93
-            @Override
94
-            public void run() {
95
-                synchronized (StatusbarPopupPanel.this) {
96
-                    if (dialog != null) {
97
-                        closeDialog();
98
-                        openDialog();
99
-                    }
100
-                }
101
-            }
102
-        });
103
-    }
104
-
105
-    /**
106
-     * Opens the information dialog.
107
-     */
108
-    protected final void openDialog() {
109
-        synchronized (StatusbarPopupPanel.this) {
110
-            dialog = getWindow();
111
-            dialog.setVisible(true);
112
-        }
113
-    }
114
-
115
-    /**
116
-     * Closes the information dialog.
117
-     */
118
-    protected final void closeDialog() {
119
-        synchronized (StatusbarPopupPanel.this) {
120
-            if (dialog != null) {
121
-                dialog.setVisible(false);
122
-                dialog.dispose();
123
-                dialog = null;
124
-            }
125
-        }
126
-    }
127
-    
128
-    /**
129
-     * Sets the text for this label.
130
-     * 
131
-     * @param text New text
132
-     */
133
-    public void setText(final String text) {
134
-        UIUtilities.invokeLater(new Runnable() {
135
-
136
-            /** {@inheritDoc} */
137
-            @Override
138
-            public void run() {
139
-                label.setText(text);
140
-            }
141
-        });
59
+        super(label);
142 60
     }
143 61
 
144 62
     /**
145
-     * Retrieves the implementation of {@link StatusbarPopupWindow} that should
146
-     * be shown by this panel when the user mouses over it.
147
-     *
148
-     * @return A concrete {@link StatusbarPopupWindow} implementation to use
149
-     */
150
-    protected abstract StatusbarPopupWindow getWindow();
151
-    
152
-    /** 
153 63
      * {@inheritDoc}
154
-     * 
64
+     *
155 65
      * @param e Mouse event
156 66
      */
157 67
     @Override
@@ -159,9 +69,9 @@ public abstract class StatusbarPopupPanel extends JPanel
159 69
         // Don't care
160 70
     }
161 71
 
162
-    /** 
72
+    /**
163 73
      * {@inheritDoc}
164
-     * 
74
+     *
165 75
      * @param e Mouse event
166 76
      */
167 77
     @Override
@@ -169,9 +79,9 @@ public abstract class StatusbarPopupPanel extends JPanel
169 79
         // Don't care
170 80
     }
171 81
 
172
-    /** 
82
+    /**
173 83
      * {@inheritDoc}
174
-     * 
84
+     *
175 85
      * @param e Mouse event
176 86
      */
177 87
     @Override
@@ -179,9 +89,9 @@ public abstract class StatusbarPopupPanel extends JPanel
179 89
         // Don't care
180 90
     }
181 91
 
182
-    /** 
92
+    /**
183 93
      * {@inheritDoc}
184
-     * 
94
+     *
185 95
      * @param e Mouse event
186 96
      */
187 97
     @Override
@@ -189,13 +99,12 @@ public abstract class StatusbarPopupPanel extends JPanel
189 99
         setBackground(UIManager.getColor("ToolTip.background"));
190 100
         setForeground(UIManager.getColor("ToolTip.foreground"));
191 101
         setBorder(new ToplessEtchedBorder());
192
-
193 102
         openDialog();
194 103
     }
195 104
 
196
-    /** 
105
+    /**
197 106
      * {@inheritDoc}
198
-     * 
107
+     *
199 108
      * @param e Mouse event
200 109
      */
201 110
     @Override
@@ -203,42 +112,6 @@ public abstract class StatusbarPopupPanel extends JPanel
203 112
         setBackground(null);
204 113
         setForeground(null);
205 114
         setBorder(new EtchedBorder());
206
-
207 115
         closeDialog();
208 116
     }
209
-    
210
-    /**
211
-     * An {@link EtchedBorder} with no top.
212
-     */
213
-    private static class ToplessEtchedBorder extends EtchedBorder {
214
-
215
-        /**
216
-         * A version number for this class. It should be changed whenever the class
217
-         * structure is changed (or anything else that would prevent serialized
218
-         * objects being unserialized with the new class).
219
-         */
220
-        private static final long serialVersionUID = 1;
221
-
222
-        /** {@inheritDoc} */
223
-        @Override
224
-        public void paintBorder(final Component c, final Graphics g,
225
-                final int x, final int y, final int width, final int height) {
226
-            int w = width;
227
-            int h = height;
228
-
229
-            g.translate(x, y);
230
-
231
-            g.setColor(etchType == LOWERED? getShadowColor(c) : getHighlightColor(c));
232
-            g.drawLine(0, h-2, w, h-2);
233
-            g.drawLine(0, 0, 0, h-1);
234
-            g.drawLine(w-2, 0, w-2, h-1);
235
-
236
-            g.setColor(Color.WHITE);
237
-            g.drawLine(0, h-1, w, h-1);
238
-            g.drawLine(w-1, 0, w-1, h-1);
239
-
240
-            g.translate(-x, -y);
241
-        }
242
-
243
-    }
244
-}
117
+}

+ 150
- 0
src/com/dmdirc/addons/ui_swing/components/statusbar/StatusbarTogglePanel.java View File

@@ -0,0 +1,150 @@
1
+/*
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.ui_swing.components.statusbar;
24
+
25
+import java.awt.event.ComponentEvent;
26
+import java.awt.event.ComponentListener;
27
+import java.awt.event.MouseEvent;
28
+
29
+import javax.swing.JLabel;
30
+import javax.swing.UIManager;
31
+import javax.swing.border.EtchedBorder;
32
+
33
+/**
34
+ * A panel shown in the status bar which displays a {@link StatusbarPopupWindow}
35
+ * when the clicks it.
36
+ *
37
+ * @since 0.6.6
38
+ */
39
+public abstract class StatusbarTogglePanel extends StatusbarPanel
40
+        implements ComponentListener {
41
+
42
+    /**
43
+     * A version number for this class. It should be changed whenever the class
44
+     * structure is changed (or anything else that would prevent serialized
45
+     * objects being unserialized with the new class).
46
+     */
47
+    private static final long serialVersionUID = 2;
48
+
49
+    /**
50
+     * Creates a new {@link StatusbarTogglePanel}, using a default text label.
51
+     */
52
+    public StatusbarTogglePanel() {
53
+        this(new JLabel("Unknown"));
54
+    }
55
+
56
+    /**
57
+     * Creates a new {@link StatusbarTogglePanel}, using the specified label.
58
+     *
59
+     * @param label The label to be displayed in the status bar
60
+     */
61
+    public StatusbarTogglePanel(final JLabel label) {
62
+        super(label);
63
+
64
+        addComponentListener(this);
65
+    }
66
+
67
+    /**
68
+     * {@inheritDoc}
69
+     *
70
+     * @param e Mouse event
71
+     */
72
+    @Override
73
+    public void mouseClicked(final MouseEvent e) {
74
+        if (isDialogOpen()) {
75
+            setBackground(null);
76
+            setForeground(null);
77
+            setBorder(new EtchedBorder());
78
+            closeDialog();
79
+        } else {
80
+            setBackground(UIManager.getColor("ToolTip.background"));
81
+            setForeground(UIManager.getColor("ToolTip.foreground"));
82
+            setBorder(new ToplessEtchedBorder());
83
+            openDialog();
84
+        }
85
+    }
86
+
87
+    /**
88
+     * {@inheritDoc}
89
+     *
90
+     * @param e Mouse event
91
+     */
92
+    @Override
93
+    public void mousePressed(final MouseEvent e) {
94
+        // Don't care
95
+    }
96
+
97
+    /**
98
+     * {@inheritDoc}
99
+     *
100
+     * @param e Mouse event
101
+     */
102
+    @Override
103
+    public void mouseReleased(final MouseEvent e) {
104
+        // Don't care
105
+    }
106
+
107
+    /**
108
+     * {@inheritDoc}
109
+     *
110
+     * @param e Mouse event
111
+     */
112
+    @Override
113
+    public void mouseEntered(final MouseEvent e) {
114
+        // Don't care
115
+    }
116
+
117
+    /**
118
+     * {@inheritDoc}
119
+     *
120
+     * @param e Mouse event
121
+     */
122
+    @Override
123
+    public void mouseExited(final MouseEvent e) {
124
+        // Don't care
125
+    }
126
+
127
+    /** {@inheritDoc} */
128
+    @Override
129
+    public void componentResized(final ComponentEvent e) {
130
+        refreshDialog();
131
+    }
132
+
133
+    /** {@inheritDoc} */
134
+    @Override
135
+    public void componentMoved(final ComponentEvent e) {
136
+        refreshDialog();
137
+    }
138
+
139
+    /** {@inheritDoc} */
140
+    @Override
141
+    public void componentShown(final ComponentEvent e) {
142
+        // Don't care
143
+    }
144
+
145
+    /** {@inheritDoc} */
146
+    @Override
147
+    public void componentHidden(final ComponentEvent e) {
148
+        // Don't care
149
+    }
150
+}

+ 57
- 0
src/com/dmdirc/addons/ui_swing/components/statusbar/ToplessEtchedBorder.java View File

@@ -0,0 +1,57 @@
1
+/*
2
+ * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.addons.ui_swing.components.statusbar;
24
+
25
+import java.awt.Color;
26
+import java.awt.Component;
27
+import java.awt.Graphics;
28
+
29
+import javax.swing.border.EtchedBorder;
30
+
31
+/**
32
+ * An {@link EtchedBorder} with no top.
33
+ */
34
+class ToplessEtchedBorder extends EtchedBorder {
35
+
36
+    /**
37
+     * A version number for this class. It should be changed whenever the class
38
+     * structure is changed (or anything else that would prevent serialized
39
+     * objects being unserialized with the new class).
40
+     */
41
+    private static final long serialVersionUID = 1;
42
+
43
+    /** {@inheritDoc} */
44
+    @Override
45
+    public void paintBorder(final Component c, final Graphics g, final int x,
46
+            final int y, final int width, final int height) {
47
+        g.translate(x, y);
48
+        g.setColor(etchType == LOWERED ? getShadowColor(c) : getHighlightColor(c));
49
+        g.drawLine(0, height - 2, width, height - 2);
50
+        g.drawLine(0, 0, 0, height - 1);
51
+        g.drawLine(width - 2, 0, width - 2, height - 1);
52
+        g.setColor(Color.WHITE);
53
+        g.drawLine(0, height - 1, width, height - 1);
54
+        g.drawLine(width - 1, 0, width - 1, height - 1);
55
+        g.translate(-x, -y);
56
+    }
57
+}

Loading…
Cancel
Save