added WORKING back button on downloadSelection

This commit is contained in:
js 2020-04-07 11:08:58 +02:00
parent 3f3e7fd2f3
commit 69bfbb00d4

View File

@ -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,41 +65,59 @@ 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");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); jButton2.addActionListener(new java.awt.event.ActionListener() {
this.setLayout(layout); public void actionPerformed(java.awt.event.ActionEvent evt) {
layout.setHorizontalGroup( jButton2ActionPerformed(evt);
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) }
.addGroup(layout.createSequentialGroup() });
.addContainerGap()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(97, 97, 97)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(104, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(23, 23, 23))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap(24, Short.MAX_VALUE))
);
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
// TODO add your handling code here: this.setLayout(layout);
} layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(97, 97, 97)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(104, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.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)
.addGap(23, 23, 23))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addContainerGap(24, Short.MAX_VALUE))
);
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// 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);
}
} }