From 8e0635810963bd5ee36942d41510aae11e8b8431 Mon Sep 17 00:00:00 2001 From: Metatheria Date: Thu, 3 Dec 2020 12:23:42 +0100 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20d'une=20fen=C3=AAtre=20popup=20?= =?UTF-8?q?pour=20entrer=20les=20param=C3=A8tres=20du=20programme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/ClientWindow.java | 41 +++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/src/chat/ClientWindow.java b/src/chat/ClientWindow.java index bda51f6..9e7b8ba 100644 --- a/src/chat/ClientWindow.java +++ b/src/chat/ClientWindow.java @@ -87,8 +87,16 @@ class ReceiveThread extends Thread { } } public class ClientWindow implements ActionListener { + JFrame popupWindow; + JPanel popupPanel; + JButton submitButton; + JPanel fieldLine[] = new JPanel[4]; + JTextField inputField[] = new JTextField[4]; + JLabel fieldLabel[] = new JLabel[4]; + JFrame chatWindow; + JPanel chatPanel; JTextArea chatText; JScrollPane textScroll; @@ -104,8 +112,35 @@ public class ClientWindow implements ActionListener { ClientWindow() { - /* System.out.println("Connecting to server..."); - System.out.println("Establishing I/O streams...");*/ + fieldLabel[0] = new JLabel("Destination IP address"); + fieldLabel[1] = new JLabel("Destination port"); + fieldLabel[2] = new JLabel("Source port"); + fieldLabel[3] = new JLabel("Username"); + + popupPanel = new JPanel(new GridLayout(5,1)); + + for(int i = 0;i < 4; i ++) + { + inputField[i] = new JTextField(); + fieldLine[i] = new JPanel(new GridLayout(1,2)); + fieldLine[i].add(fieldLabel[i]); + fieldLine[i].add(inputField[i]); + popupPanel.add(fieldLine[i]); + } + + submitButton = new JButton("OK"); + popupPanel.add(submitButton); + + popupWindow = new JFrame(); + popupWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + popupWindow.setSize(new Dimension(640, 480)); + + popupWindow.getContentPane().add(popupPanel, BorderLayout.CENTER); + + popupWindow.pack(); + popupWindow.setVisible(true); + + chatWindow = new JFrame("Système de clavardage 2.0.1"); chatPanel = new JPanel(new GridLayout(2, 2)); @@ -162,7 +197,7 @@ public class ClientWindow implements ActionListener { public static void main (String [] args) { JFrame.setDefaultLookAndFeelDecorated(true); - + ClientWindow window = new ClientWindow(); }