fix warning
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/head This commit looks good

This commit is contained in:
js 2020-04-03 12:30:20 +02:00
parent 81824267a7
commit 820ddd84bb

View File

@ -1,7 +1,13 @@
package gui; package gui;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; 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{ public class Parameters extends JPanel{
@ -11,12 +17,11 @@ public class Parameters extends JPanel{
FlowLayout layout = new FlowLayout(); FlowLayout layout = new FlowLayout();
JPanel p2 = new JPanel(); JPanel p2 = new JPanel();
p2.setLayout(layout); p2.setLayout(layout);
Object[] elements = new Object[]{"TCP", "UDP"}; String[] elements = {"TCP", "UDP"};
// JSplitPane split;
JLabel label1, label2, label3, label4, label5; JLabel label1, label2, label3, label4, label5;
JTextField field1, field2, field3, field4; JTextField field1, field2, field3, field4;
JComboBox protocolSelector;
JButton connectButton; JButton connectButton;
JComboBox<String> protocolSelector = new JComboBox<>(elements);
label1 = new JLabel("Server hostname: "); label1 = new JLabel("Server hostname: ");
label2 = new JLabel("Server port: "); label2 = new JLabel("Server port: ");
label3 = new JLabel("Tracker hostname: "); label3 = new JLabel("Tracker hostname: ");
@ -26,7 +31,6 @@ public class Parameters extends JPanel{
field2 = new JTextField(20); field2 = new JTextField(20);
field3 = new JTextField(20); field3 = new JTextField(20);
field4 = new JTextField(20); field4 = new JTextField(20);
protocolSelector = new JComboBox(elements);
connectButton = new JButton("Connect"); connectButton = new JButton("Connect");
p1.add(label1); p1.add(label1);
p1.add(field1); p1.add(field1);
@ -39,8 +43,6 @@ public class Parameters extends JPanel{
p1.add(label5); p1.add(label5);
p1.add(protocolSelector); p1.add(protocolSelector);
p2.add(connectButton); p2.add(connectButton);
//split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, p1, p2);
//this.add(split, BorderLayout.CENTER);
this.add(p1, BorderLayout.NORTH); this.add(p1, BorderLayout.NORTH);
this.add(p2, BorderLayout.SOUTH); this.add(p2, BorderLayout.SOUTH);
setVisible(true); setVisible(true);