création d'une fenêtre popup pour entrer les paramètres du programme
This commit is contained in:
父節點
3a8a8ef7f1
當前提交
8e06358109
共有 1 個文件被更改,包括 38 次插入 和 3 次删除
|
@ -87,8 +87,16 @@ class ReceiveThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class ClientWindow implements ActionListener {
|
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;
|
JFrame chatWindow;
|
||||||
|
|
||||||
|
|
||||||
JPanel chatPanel;
|
JPanel chatPanel;
|
||||||
JTextArea chatText;
|
JTextArea chatText;
|
||||||
JScrollPane textScroll;
|
JScrollPane textScroll;
|
||||||
|
@ -104,8 +112,35 @@ public class ClientWindow implements ActionListener {
|
||||||
|
|
||||||
ClientWindow()
|
ClientWindow()
|
||||||
{
|
{
|
||||||
/* System.out.println("Connecting to server...");
|
fieldLabel[0] = new JLabel("Destination IP address");
|
||||||
System.out.println("Establishing I/O streams...");*/
|
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");
|
chatWindow = new JFrame("Système de clavardage 2.0.1");
|
||||||
|
|
||||||
chatPanel = new JPanel(new GridLayout(2, 2));
|
chatPanel = new JPanel(new GridLayout(2, 2));
|
||||||
|
@ -162,7 +197,7 @@ public class ClientWindow implements ActionListener {
|
||||||
public static void main (String [] args)
|
public static void main (String [] args)
|
||||||
{
|
{
|
||||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||||
|
|
||||||
ClientWindow window = new ClientWindow();
|
ClientWindow window = new ClientWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
載入中…
Reference in a new issue