added support for displaying list of files but need scrollbar
parent
8bd0cb569f
commit
18bd90b362
@ -0,0 +1,43 @@
|
||||
package gui;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
public class downloadSelection extends JPanel {
|
||||
|
||||
private String[] listFilesToDownload;
|
||||
private JList<String> list1;
|
||||
private JLabel label1;
|
||||
private JButton downloadButton;
|
||||
|
||||
public downloadSelection(String[] listFilesToDownload){
|
||||
JPanel p1 = new JPanel();
|
||||
JPanel p2 = new JPanel();
|
||||
JPanel p3 = new JPanel();
|
||||
FlowLayout layout = new FlowLayout();
|
||||
this.listFilesToDownload = listFilesToDownload;
|
||||
this.list1 = new JList<>(listFilesToDownload);
|
||||
this.label1 = new JLabel("List of files you can download: ");
|
||||
this.downloadButton = new JButton("download");
|
||||
this.list1.setSelectedIndex(0);
|
||||
p1.setLayout(layout);
|
||||
p2.setLayout(layout);
|
||||
p3.setLayout(layout);
|
||||
this.setLayout(new GridLayout(3, 1));
|
||||
p1.add(label1);
|
||||
p2.add(list1);
|
||||
p3.add(downloadButton);
|
||||
this.add(p1, BorderLayout.NORTH);
|
||||
this.add(p2, BorderLayout.CENTER);
|
||||
this.add(p3, BorderLayout.SOUTH);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue