added WORKING back button on downloadSelection

pull/108/head
js 5 years ago
parent 3f3e7fd2f3
commit 69bfbb00d4

@ -6,6 +6,10 @@ package gui;
* and open the template in the editor. * and open the template in the editor.
*/ */
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
/** /**
* @author Louis Royer * @author Louis Royer
* @author Flavien Haas * @author Flavien Haas
@ -15,6 +19,7 @@ public class DownloadSelectionGen extends javax.swing.JPanel {
// Variables declaration - do not modify // Variables declaration - do not modify
private javax.swing.JButton jButton1; private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JList<String> jList1; private javax.swing.JList<String> jList1;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
@ -43,6 +48,7 @@ public class DownloadSelectionGen extends javax.swing.JPanel {
jButton1 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList<>(); jList1 = new javax.swing.JList<>();
jButton2 = new javax.swing.JButton();
jLabel1.setText("Select a file to download:"); jLabel1.setText("Select a file to download:");
@ -59,7 +65,15 @@ public class DownloadSelectionGen extends javax.swing.JPanel {
public String getElementAt(int i) { return strings[i]; } public String getElementAt(int i) { return strings[i]; }
}); });
jScrollPane1.setViewportView(jList1); jScrollPane1.setViewportView(jList1);
jList1.setSelectedIndex(0); jList1.setSelectedIndex(0);
jButton2.setText("Back");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
@ -74,7 +88,9 @@ public class DownloadSelectionGen extends javax.swing.JPanel {
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(104, Short.MAX_VALUE)) .addContainerGap(104, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(25, 25, 25)
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(23, 23, 23)) .addGap(23, 23, 23))
); );
@ -86,14 +102,22 @@ public class DownloadSelectionGen extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1) .addComponent(jButton1)
.addComponent(jButton2))
.addContainerGap(24, Short.MAX_VALUE)) .addContainerGap(24, Short.MAX_VALUE))
); );
}// </editor-fold> }// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: // TODO add your handling code here:
} }
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
ArgumentsGen a = new ArgumentsGen();
JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this);
topFrame.add(a);
this.setVisible(false);
}
} }

Loading…
Cancel
Save