@@ -50,7 +50,7 @@ public class MCPFrame extends JFrame implements WindowListener {
50
50
private final List <TaskButton > buttons = new ArrayList <>();
51
51
public MenuBar menuBar ;
52
52
public boolean loadingVersions = true ;
53
- private JComponent verList ;
53
+ private JComboBox <?> verList ;
54
54
private JLabel verLabel ;
55
55
//private JButton verCleanup;
56
56
private JPanel topRightContainer ;
@@ -143,13 +143,9 @@ public void reloadVersionList() {
143
143
verLabel = new JLabel (MCP .TRANSLATOR .translateKey ("mcp.versionList.failure" ));
144
144
verLabel .setBorder (new EmptyBorder (4 , 0 , 0 , 2 ));
145
145
verLabel .setForeground (Color .RED );
146
- JButton verList = new JButton (MCP .TRANSLATOR .translateKey ("mcp.versionList.reloadVersionList" ));
147
- verList .addActionListener (e -> {
148
- reloadVersionList ();
149
- });
150
- this .verList = verList ;
146
+ verList = null ;
151
147
} else {
152
- JComboBox <?> verList = new JComboBox <>(versionParser .getVersions ().toArray ());
148
+ verList = new JComboBox <>(versionParser .getVersions ().toArray ());
153
149
verList .addPopupMenuListener (new PopupMenuListener () {
154
150
155
151
@ Override
@@ -169,7 +165,6 @@ public void popupMenuCanceled(PopupMenuEvent e) {
169
165
setCurrentVersion (mcp .currentVersion == null ? null : versionParser .getVersion (mcp .currentVersion .id ));
170
166
verList .setMaximumRowCount (20 );
171
167
verLabel = new JLabel (MCP .TRANSLATOR .translateKey ("mcp.versionList.currentVersion" ));
172
- this .verList = verList ;
173
168
}
174
169
topRightContainer .removeAll ();
175
170
topRightContainer .add (this .verLabel );
@@ -231,11 +226,8 @@ public void setCurrentVersion(VersionData versionData) {
231
226
if (verList == null ) {
232
227
return ;
233
228
}
234
- if (this .verList instanceof JComboBox ) {
235
- JComboBox <?> verList = (JComboBox <?>) this .verList ;
236
- verList .setSelectedItem (versionData );
237
- verList .repaint ();
238
- }
229
+ verList .setSelectedItem (versionData );
230
+ verList .repaint ();
239
231
}
240
232
241
233
/**
0 commit comments