Projet_JAVA_P2P_STRI2A/src/gui/DownloadSelection.java
js 8138fd5966
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
added new panels done with NetBeans
2020-04-06 11:03:45 +02:00

51 lines
1.4 KiB
Java

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 javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
public class DownloadSelection extends JPanel {
private static final long serialVersionUID = 13L;
private String[] listFilesToDownload;
private JList<String> list1;
private JLabel label1;
private JButton downloadButton;
private JScrollPane scroll;
public DownloadSelection(String[] listFilesToDownload){
JPanel p1 = new JPanel();
JPanel p3 = new JPanel();
JPanel container = new JPanel();
FlowLayout layout = new FlowLayout();
p1.setLayout(new GridLayout(1, 2));
container.setLayout(layout);
p3.setLayout(layout);
this.setLayout(new GridLayout(2, 1));
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);
scroll = new JScrollPane(list1);
int verticalPolicy = JScrollPane.VERTICAL_SCROLLBAR_ALWAYS;
scroll.setVerticalScrollBarPolicy(verticalPolicy);
//container.add(list1);
container.add(scroll);
p1.add(label1);
p1.add(container);
p3.add(downloadButton);
this.add(p1);
this.add(p3);
setVisible(true);
}
}