From 8bd0cb569f45763f872bdd62d0250255a5ee0dee Mon Sep 17 00:00:00 2001 From: js Date: Fri, 3 Apr 2020 13:07:05 +0200 Subject: [PATCH] fix constructor --- src/gui/Parameters.java | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gui/Parameters.java b/src/gui/Parameters.java index eff88e8..6db54e1 100644 --- a/src/gui/Parameters.java +++ b/src/gui/Parameters.java @@ -11,6 +11,11 @@ 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 protocolSelector; + public Parameters(){ JPanel p1 = new JPanel(); p1.setLayout(new GridLayout(5, 2)); @@ -18,20 +23,17 @@ public class Parameters extends JPanel{ JPanel p2 = new JPanel(); p2.setLayout(layout); String[] elements = {"TCP", "UDP"}; - JLabel label1, label2, label3, label4, label5; - JTextField field1, field2, field3, field4; - JButton connectButton; - JComboBox protocolSelector = new JComboBox<>(elements); - label1 = new JLabel("Server hostname: "); - label2 = new JLabel("Server port: "); - label3 = new JLabel("Tracker hostname: "); - label4 = new JLabel("Tracker port: "); - label5 = new JLabel("Protocol: "); - field1 = new JTextField(20); - field2 = new JTextField(20); - field3 = new JTextField(20); - field4 = new JTextField(20); - connectButton = new JButton("Connect"); + 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);