Fixed layout list + tab
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
This commit is contained in:
parent
18bd90b362
commit
ee35381837
@ -4,9 +4,9 @@ import javax.swing.JFrame;
|
|||||||
|
|
||||||
public class Gui{
|
public class Gui{
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
MainWindow win = new MainWindow();
|
MainWindow win = new MainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,16 @@ import javax.swing.JFrame;
|
|||||||
|
|
||||||
public class MainWindow extends JFrame{
|
public class MainWindow extends JFrame{
|
||||||
|
|
||||||
public MainWindow(){
|
public MainWindow(){
|
||||||
JFrame fenetre = new JFrame();
|
JFrame fenetre = new JFrame();
|
||||||
fenetre.setTitle("Client");
|
fenetre.setTitle("Client");
|
||||||
fenetre.setSize(550, 200);
|
fenetre.setSize(550, 200);
|
||||||
fenetre.setLocationRelativeTo(null);
|
fenetre.setLocationRelativeTo(null);
|
||||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
//fenetre.add(new Parameters());
|
//fenetre.add(new Parameters());
|
||||||
String[] listTest = {"test", "test2", "test3", "test4", "test5", "test6", "test7"};
|
String[] listTest = {"test", "test2", "test3", "test4", "test5", "test6", "test7"};
|
||||||
fenetre.add(new downloadSelection(listTest));
|
fenetre.add(new downloadSelection(listTest));
|
||||||
fenetre.setVisible(true);
|
fenetre.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,43 +11,43 @@ import java.awt.GridLayout;
|
|||||||
|
|
||||||
public class Parameters extends JPanel{
|
public class Parameters extends JPanel{
|
||||||
|
|
||||||
private JLabel label1, label2, label3, label4, label5;
|
private JLabel label1, label2, label3, label4, label5;
|
||||||
private JTextField field1, field2, field3, field4;
|
private JTextField field1, field2, field3, field4;
|
||||||
private JButton connectButton;
|
private JButton connectButton;
|
||||||
private JComboBox<String> protocolSelector;
|
private JComboBox<String> protocolSelector;
|
||||||
|
|
||||||
public Parameters(){
|
public Parameters(){
|
||||||
JPanel p1 = new JPanel();
|
JPanel p1 = new JPanel();
|
||||||
p1.setLayout(new GridLayout(5, 2));
|
p1.setLayout(new GridLayout(5, 2));
|
||||||
FlowLayout layout = new FlowLayout();
|
FlowLayout layout = new FlowLayout();
|
||||||
JPanel p2 = new JPanel();
|
JPanel p2 = new JPanel();
|
||||||
p2.setLayout(layout);
|
p2.setLayout(layout);
|
||||||
String[] elements = {"TCP", "UDP"};
|
String[] elements = {"TCP", "UDP"};
|
||||||
this.label1 = new JLabel("Server hostname: ");
|
this.label1 = new JLabel("Server hostname: ");
|
||||||
this.label2 = new JLabel("Server port: ");
|
this.label2 = new JLabel("Server port: ");
|
||||||
this.label3 = new JLabel("Tracker hostname: ");
|
this.label3 = new JLabel("Tracker hostname: ");
|
||||||
this.label4 = new JLabel("Tracker port: ");
|
this.label4 = new JLabel("Tracker port: ");
|
||||||
this.label5 = new JLabel("Protocol: ");
|
this.label5 = new JLabel("Protocol: ");
|
||||||
this.field1 = new JTextField(20);
|
this.field1 = new JTextField(20);
|
||||||
this.field2 = new JTextField(20);
|
this.field2 = new JTextField(20);
|
||||||
this.field3 = new JTextField(20);
|
this.field3 = new JTextField(20);
|
||||||
this.field4 = new JTextField(20);
|
this.field4 = new JTextField(20);
|
||||||
this.connectButton = new JButton("Connect");
|
this.connectButton = new JButton("Connect");
|
||||||
protocolSelector = new JComboBox<>(elements);
|
protocolSelector = new JComboBox<>(elements);
|
||||||
p1.add(label1);
|
p1.add(label1);
|
||||||
p1.add(field1);
|
p1.add(field1);
|
||||||
p1.add(label2);
|
p1.add(label2);
|
||||||
p1.add(field2);
|
p1.add(field2);
|
||||||
p1.add(label3);
|
p1.add(label3);
|
||||||
p1.add(field3);
|
p1.add(field3);
|
||||||
p1.add(label4);
|
p1.add(label4);
|
||||||
p1.add(field4);
|
p1.add(field4);
|
||||||
p1.add(label5);
|
p1.add(label5);
|
||||||
p1.add(protocolSelector);
|
p1.add(protocolSelector);
|
||||||
p2.add(connectButton);
|
p2.add(connectButton);
|
||||||
this.add(p1, BorderLayout.NORTH);
|
this.add(p1, BorderLayout.NORTH);
|
||||||
this.add(p2, BorderLayout.SOUTH);
|
this.add(p2, BorderLayout.SOUTH);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,26 +18,23 @@ public class downloadSelection extends JPanel {
|
|||||||
private JButton downloadButton;
|
private JButton downloadButton;
|
||||||
|
|
||||||
public downloadSelection(String[] listFilesToDownload){
|
public downloadSelection(String[] listFilesToDownload){
|
||||||
JPanel p1 = new JPanel();
|
JPanel p1 = new JPanel();
|
||||||
JPanel p2 = new JPanel();
|
JPanel p3 = new JPanel();
|
||||||
JPanel p3 = new JPanel();
|
FlowLayout layout = new FlowLayout();
|
||||||
FlowLayout layout = new FlowLayout();
|
this.listFilesToDownload = listFilesToDownload;
|
||||||
this.listFilesToDownload = listFilesToDownload;
|
this.list1 = new JList<>(listFilesToDownload);
|
||||||
this.list1 = new JList<>(listFilesToDownload);
|
this.label1 = new JLabel("List of files you can download: ");
|
||||||
this.label1 = new JLabel("List of files you can download: ");
|
this.downloadButton = new JButton("download");
|
||||||
this.downloadButton = new JButton("download");
|
this.list1.setSelectedIndex(0);
|
||||||
this.list1.setSelectedIndex(0);
|
p1.setLayout(new GridLayout(1, 2));
|
||||||
p1.setLayout(layout);
|
p3.setLayout(layout);
|
||||||
p2.setLayout(layout);
|
this.setLayout(new GridLayout(2, 1));
|
||||||
p3.setLayout(layout);
|
p1.add(label1);
|
||||||
this.setLayout(new GridLayout(3, 1));
|
p1.add(list1);
|
||||||
p1.add(label1);
|
p3.add(downloadButton);
|
||||||
p2.add(list1);
|
this.add(p1);
|
||||||
p3.add(downloadButton);
|
this.add(p3);
|
||||||
this.add(p1, BorderLayout.NORTH);
|
setVisible(true);
|
||||||
this.add(p2, BorderLayout.CENTER);
|
|
||||||
this.add(p3, BorderLayout.SOUTH);
|
|
||||||
setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user