public void loadVersions() { SwingUtilities.invokeLater( () -> { synchronized (InstallerPanel.this) { DefaultTableModel model = (DefaultTableModel) lstInstallers.getModel(); String mcver = StrUtils.formatVersion(gsp.getMinecraftVersionFormatted()); versions = list.getVersions(mcver); SwingUtils.clearDefaultTable(lstInstallers); if (versions != null) for (InstallerVersionList.InstallerVersion v : versions) if (v != null) model.addRow( new Object[] { v.selfVersion == null ? "null" : v.selfVersion, v.mcVersion == null ? "null" : v.mcVersion }); } }); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btnInstall = new javax.swing.JButton(); jScrollPane12 = new javax.swing.JScrollPane(); lstInstallers = new javax.swing.JTable(); btnRefresh = new javax.swing.JButton(); btnInstall.setText(C.i18n("ui.button.install")); // NOI18N btnInstall.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnInstallActionPerformed(evt); } }); lstInstallers.setModel( SwingUtils.makeDefaultTableModel( new String[] {C.i18n("install.version"), C.i18n("install.mcversion")}, new Class[] {String.class, String.class}, new boolean[] {false, false})); lstInstallers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane12.setViewportView(lstInstallers); btnRefresh.setText(C.i18n("ui.button.refresh")); // NOI18N btnRefresh.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnRefreshActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent( jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( btnRefresh, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( btnInstall, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addComponent(btnInstall) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnRefresh) .addGap(0, 0, Short.MAX_VALUE))); } // </editor-fold>//GEN-END:initComponents