@@ -50,7 +50,7 @@ public class MCPFrame extends JFrame implements WindowListener {
5050 private final List <TaskButton > buttons = new ArrayList <>();
5151 public MenuBar menuBar ;
5252 public boolean loadingVersions = true ;
53- private JComboBox <?> verList ;
53+ private JComponent verList ;
5454 private JLabel verLabel ;
5555 //private JButton verCleanup;
5656 private JPanel topRightContainer ;
@@ -143,9 +143,13 @@ public void reloadVersionList() {
143143 verLabel = new JLabel (MCP .TRANSLATOR .translateKey ("mcp.versionList.failure" ));
144144 verLabel .setBorder (new EmptyBorder (4 , 0 , 0 , 2 ));
145145 verLabel .setForeground (Color .RED );
146- verList = null ;
146+ JButton verList = new JButton (MCP .TRANSLATOR .translateKey ("mcp.versionList.reloadVersionList" ));
147+ verList .addActionListener (e -> {
148+ reloadVersionList ();
149+ });
150+ this .verList = verList ;
147151 } else {
148- verList = new JComboBox <>(versionParser .getVersions ().toArray ());
152+ JComboBox <?> verList = new JComboBox <>(versionParser .getVersions ().toArray ());
149153 verList .addPopupMenuListener (new PopupMenuListener () {
150154
151155 @ Override
@@ -165,6 +169,7 @@ public void popupMenuCanceled(PopupMenuEvent e) {
165169 setCurrentVersion (mcp .currentVersion == null ? null : versionParser .getVersion (mcp .currentVersion .id ));
166170 verList .setMaximumRowCount (20 );
167171 verLabel = new JLabel (MCP .TRANSLATOR .translateKey ("mcp.versionList.currentVersion" ));
172+ this .verList = verList ;
168173 }
169174 topRightContainer .removeAll ();
170175 topRightContainer .add (this .verLabel );
@@ -226,8 +231,11 @@ public void setCurrentVersion(VersionData versionData) {
226231 if (verList == null ) {
227232 return ;
228233 }
229- verList .setSelectedItem (versionData );
230- verList .repaint ();
234+ if (this .verList instanceof JComboBox ) {
235+ JComboBox <?> verList = (JComboBox <?>) this .verList ;
236+ verList .setSelectedItem (versionData );
237+ verList .repaint ();
238+ }
231239 }
232240
233241 /**
0 commit comments