first panel of GUI
parent
b39eaf270b
commit
05a2967645
@ -0,0 +1,12 @@
|
||||
package gui;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class Gui{
|
||||
|
||||
public static void main(String[] args) {
|
||||
MainWindow win = new MainWindow();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package gui;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class MainWindow extends JFrame{
|
||||
|
||||
public MainWindow(){
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setTitle("Client");
|
||||
fenetre.setSize(550, 200);
|
||||
fenetre.setLocationRelativeTo(null);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(new Parameters());
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package gui;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JComboBox;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
public class Parameters extends JPanel{
|
||||
|
||||
private JLabel label1, label2, label3, label4, label5;
|
||||
private JTextField field1, field2, field3, field4;
|
||||
private JButton connectButton;
|
||||
private JComboBox<String> protocolSelector;
|
||||
|
||||
public Parameters(){
|
||||
JPanel p1 = new JPanel();
|
||||
p1.setLayout(new GridLayout(5, 2));
|
||||
FlowLayout layout = new FlowLayout();
|
||||
JPanel p2 = new JPanel();
|
||||
p2.setLayout(layout);
|
||||
String[] elements = {"TCP", "UDP"};
|
||||
this.label1 = new JLabel("Server hostname: ");
|
||||
this.label2 = new JLabel("Server port: ");
|
||||
this.label3 = new JLabel("Tracker hostname: ");
|
||||
this.label4 = new JLabel("Tracker port: ");
|
||||
this.label5 = new JLabel("Protocol: ");
|
||||
this.field1 = new JTextField(20);
|
||||
this.field2 = new JTextField(20);
|
||||
this.field3 = new JTextField(20);
|
||||
this.field4 = new JTextField(20);
|
||||
this.connectButton = new JButton("Connect");
|
||||
protocolSelector = new JComboBox<>(elements);
|
||||
p1.add(label1);
|
||||
p1.add(field1);
|
||||
p1.add(label2);
|
||||
p1.add(field2);
|
||||
p1.add(label3);
|
||||
p1.add(field3);
|
||||
p1.add(label4);
|
||||
p1.add(field4);
|
||||
p1.add(label5);
|
||||
p1.add(protocolSelector);
|
||||
p2.add(connectButton);
|
||||
this.add(p1, BorderLayout.NORTH);
|
||||
this.add(p2, BorderLayout.SOUTH);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue