@@ -66,11 +66,10 @@ public class EditorHeader extends JComponent {
66
66
static final int UNSELECTED = 0 ;
67
67
static final int SELECTED = 1 ;
68
68
69
- static final String WHERE [] = { "left" , "mid" , "right" , "menu" };
69
+ static final String WHERE [] = { "left" , "mid" , "right" };
70
70
static final int LEFT = 0 ;
71
71
static final int MIDDLE = 1 ;
72
72
static final int RIGHT = 2 ;
73
- static final int MENU = 3 ;
74
73
75
74
static final int PIECE_WIDTH = scale (4 );
76
75
static final int PIECE_HEIGHT = scale (33 );
@@ -79,6 +78,7 @@ public class EditorHeader extends JComponent {
79
78
static final int GRID_SIZE = scale (33 );
80
79
81
80
static Image [][] pieces ;
81
+ static Image menuButtons [];
82
82
83
83
Image offscreen ;
84
84
int sizeW , sizeH ;
@@ -149,15 +149,16 @@ public EditorHeader(Editor eddie) {
149
149
150
150
if (pieces == null ) {
151
151
pieces = new Image [STATUS .length ][WHERE .length ];
152
+ menuButtons = new Image [STATUS .length ];
152
153
for (int i = 0 ; i < STATUS .length ; i ++) {
153
154
for (int j = 0 ; j < WHERE .length ; j ++) {
154
155
String path = "tab-" + STATUS [i ] + "-" + WHERE [j ];
155
- pieces [i ][j ] = Theme .getThemeImage (path , this ,
156
- // TODO: Refactor this mess...
157
- j == MENU ? PIECE_HEIGHT
158
- : PIECE_WIDTH ,
156
+ pieces [i ][j ] = Theme .getThemeImage (path , this , PIECE_WIDTH ,
159
157
PIECE_HEIGHT );
160
158
}
159
+ String path = "tab-" + STATUS [i ] + "-menu" ;
160
+ menuButtons [i ] = Theme .getThemeImage (path , this , PIECE_HEIGHT ,
161
+ PIECE_HEIGHT );
161
162
}
162
163
}
163
164
@@ -284,10 +285,10 @@ public void paintComponent(Graphics screen) {
284
285
x += PIECE_WIDTH - 1 ; // overlap by 1 pixel
285
286
}
286
287
287
- menuLeft = sizeW - (16 + pieces [ 0 ][ MENU ].getWidth (this ));
288
+ menuLeft = sizeW - (16 + menuButtons [ 0 ].getWidth (this ));
288
289
menuRight = sizeW - 16 ;
289
290
// draw the dropdown menu target
290
- g .drawImage (pieces [popup .isVisible () ? SELECTED : UNSELECTED ][ MENU ],
291
+ g .drawImage (menuButtons [popup .isVisible () ? SELECTED : UNSELECTED ],
291
292
menuLeft , 0 , null );
292
293
293
294
screen .drawImage (offscreen , 0 , 0 , null );
0 commit comments