ajout de fenêtres popup pour entrer les informations de l'utilisateur
这个提交包含在:
父节点
8e06358109
当前提交
55f7d26a0f
共有 6 个文件被更改,包括 79 次插入 和 51 次删除
|
@ -6,5 +6,10 @@
|
||||||
<attribute name="module" value="true"/>
|
<attribute name="module" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
二进制
src/chat/ClientWindow.class
普通文件
二进制
src/chat/ClientWindow.class
普通文件
二进制文件未显示。
|
@ -53,6 +53,7 @@ class SendThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ReceiveThread extends Thread {
|
class ReceiveThread extends Thread {
|
||||||
|
|
||||||
int port;
|
int port;
|
||||||
|
@ -86,7 +87,8 @@ class ReceiveThread extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class ClientWindow implements ActionListener {
|
|
||||||
|
/*class PopupWindow implements ActionListener {
|
||||||
JFrame popupWindow;
|
JFrame popupWindow;
|
||||||
JPanel popupPanel;
|
JPanel popupPanel;
|
||||||
JButton submitButton;
|
JButton submitButton;
|
||||||
|
@ -94,6 +96,46 @@ public class ClientWindow implements ActionListener {
|
||||||
JTextField inputField[] = new JTextField[4];
|
JTextField inputField[] = new JTextField[4];
|
||||||
JLabel fieldLabel[] = new JLabel[4];
|
JLabel fieldLabel[] = new JLabel[4];
|
||||||
|
|
||||||
|
PopupWindow()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
public class ClientWindow implements ActionListener {
|
||||||
|
|
||||||
|
|
||||||
JFrame chatWindow;
|
JFrame chatWindow;
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,35 +154,6 @@ public class ClientWindow implements ActionListener {
|
||||||
|
|
||||||
ClientWindow()
|
ClientWindow()
|
||||||
{
|
{
|
||||||
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");
|
chatWindow = new JFrame("Système de clavardage 2.0.1");
|
||||||
|
|
||||||
chatPanel = new JPanel(new GridLayout(2, 2));
|
chatPanel = new JPanel(new GridLayout(2, 2));
|
||||||
|
@ -163,37 +176,37 @@ public class ClientWindow implements ActionListener {
|
||||||
chatText.setLineWrap(true);
|
chatText.setLineWrap(true);
|
||||||
chatText.setEditable(false);
|
chatText.setEditable(false);
|
||||||
|
|
||||||
|
|
||||||
chatPanel.add(textScroll);
|
chatPanel.add(textScroll);
|
||||||
chatPanel.add(sendPanel);
|
chatPanel.add(sendPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
chatWindow.getContentPane().add(chatPanel, BorderLayout.CENTER);
|
chatWindow.getContentPane().add(chatPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
|
||||||
//Display the window.
|
//Display the window.
|
||||||
|
|
||||||
|
|
||||||
|
address = JOptionPane.showInputDialog(chatWindow,
|
||||||
|
"Enter the destination address",
|
||||||
|
"POPOPOPOPUPUPOPOPUP",
|
||||||
|
JOptionPane.PLAIN_MESSAGE);
|
||||||
|
sport = Integer.parseInt(JOptionPane.showInputDialog(chatWindow,
|
||||||
|
"Enter the source port",
|
||||||
|
"POPOPOPOPUPUPOPOPUP",
|
||||||
|
JOptionPane.PLAIN_MESSAGE));
|
||||||
|
dport = Integer.parseInt(JOptionPane.showInputDialog(chatWindow,
|
||||||
|
"Enter the destination port",
|
||||||
|
"POPOPOPOPUPUPOPOPUP",
|
||||||
|
JOptionPane.PLAIN_MESSAGE));
|
||||||
|
username = JOptionPane.showInputDialog(chatWindow,
|
||||||
|
"Enter a username",
|
||||||
|
"POPOPOPOPUPUPOPOPUP",
|
||||||
|
JOptionPane.PLAIN_MESSAGE);
|
||||||
chatWindow.pack();
|
chatWindow.pack();
|
||||||
chatWindow.setVisible(true);
|
chatWindow.setVisible(true);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
|
|
||||||
System.out.print("Entrez l'adresse de destination:");
|
|
||||||
address = console.readLine();
|
|
||||||
System.out.print("Entrez le numéro de port source:");
|
|
||||||
sport = Integer.parseInt(console.readLine());
|
|
||||||
System.out.print("Entrez le numéro de port destination:");
|
|
||||||
dport = Integer.parseInt(console.readLine());
|
|
||||||
System.out.print("Entrez votre nom d'utilisateur:");
|
|
||||||
username = console.readLine();
|
|
||||||
|
|
||||||
ReceiveThread t2 = new ReceiveThread(sport, chatText);
|
ReceiveThread t2 = new ReceiveThread(sport, chatText);
|
||||||
t2.start();
|
t2.start();
|
||||||
}
|
}
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
System.out.println("nik3!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void main (String [] args)
|
public static void main (String [] args)
|
||||||
{
|
{
|
||||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||||
|
|
二进制文件未显示。
二进制文件未显示。
正在加载…
在新工单中引用