Debut du codage de l'interface
This commit is contained in:
parent
08a649b27a
commit
334fe1a14d
9 changed files with 135 additions and 0 deletions
BIN
chat/bin/gui/FenetreChat$1.class
Normal file
BIN
chat/bin/gui/FenetreChat$1.class
Normal file
Binary file not shown.
BIN
chat/bin/gui/FenetreChat.class
Normal file
BIN
chat/bin/gui/FenetreChat.class
Normal file
Binary file not shown.
BIN
chat/bin/gui/FenetreLogin$1.class
Normal file
BIN
chat/bin/gui/FenetreLogin$1.class
Normal file
Binary file not shown.
BIN
chat/bin/gui/FenetreLogin$2.class
Normal file
BIN
chat/bin/gui/FenetreLogin$2.class
Normal file
Binary file not shown.
BIN
chat/bin/gui/FenetreLogin.class
Normal file
BIN
chat/bin/gui/FenetreLogin.class
Normal file
Binary file not shown.
Binary file not shown.
58
chat/src/gui/FenetreChat.java
Normal file
58
chat/src/gui/FenetreChat.java
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
package gui;
|
||||||
|
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class FenetreChat extends JFrame{
|
||||||
|
|
||||||
|
private JPanel contentPane;
|
||||||
|
/**
|
||||||
|
* Launch the application.
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
FenetreChat window = new FenetreChat();
|
||||||
|
window.setVisible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the application.
|
||||||
|
*/
|
||||||
|
public FenetreChat() {
|
||||||
|
initialize2();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the contents of the frame.
|
||||||
|
*/
|
||||||
|
private void initialize2() {
|
||||||
|
contentPane = new JPanel();
|
||||||
|
setContentPane(contentPane);
|
||||||
|
setTitle("Chat Window");
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(400, 300);
|
||||||
|
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
JLabel label = new JLabel("Enter text");
|
||||||
|
JTextField tf = new JTextField(10);
|
||||||
|
JButton send = new JButton("Send");
|
||||||
|
panel.add(label);
|
||||||
|
panel.add(tf);
|
||||||
|
panel.add(send);
|
||||||
|
JTextArea ta = new JTextArea();
|
||||||
|
contentPane.add(BorderLayout.SOUTH, panel);
|
||||||
|
contentPane.add(BorderLayout.CENTER, ta);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
76
chat/src/gui/FenetreLogin.java
Normal file
76
chat/src/gui/FenetreLogin.java
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
package gui;
|
||||||
|
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class FenetreLogin extends JFrame{
|
||||||
|
|
||||||
|
private JPanel contentPane;
|
||||||
|
/**
|
||||||
|
* Launch the application.
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
FenetreLogin window = new FenetreLogin();
|
||||||
|
window.setVisible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the application.
|
||||||
|
*/
|
||||||
|
public FenetreLogin() {
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the contents of the frame.
|
||||||
|
*/
|
||||||
|
private void initialize() {
|
||||||
|
contentPane = new JPanel();
|
||||||
|
setContentPane(contentPane);
|
||||||
|
setTitle("Login Frame");
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(400, 300);
|
||||||
|
|
||||||
|
JTextField pseudo = new JTextField(4);
|
||||||
|
JLabel txt = new JLabel("Pseudo", SwingConstants.LEFT);
|
||||||
|
JButton connect = new JButton("Connect");
|
||||||
|
connect.addActionListener(new ActionListener(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
FenetreChat windowChat = new FenetreChat();
|
||||||
|
windowChat.setVisible(true);
|
||||||
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//Listen to events from the Convert button.
|
||||||
|
// convertTemp.addActionListener(this);
|
||||||
|
|
||||||
|
//Add the widgets to the container.
|
||||||
|
/*converterPanel.add(tempCelsius);
|
||||||
|
converterPanel.add(celsiusLabel);
|
||||||
|
converterPanel.add(convertTemp);
|
||||||
|
converterPanel.add(fahrenheitLabel);
|
||||||
|
*/
|
||||||
|
txt.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||||
|
|
||||||
|
contentPane.add(pseudo);
|
||||||
|
contentPane.add(txt);
|
||||||
|
contentPane.add(connect);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
module chat {
|
module chat {
|
||||||
|
requires java.desktop;
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue