Commit 540e806b authored by 9731065's avatar 9731065

massageArea created

parent ecfc3940
Pipeline #651 canceled with stages
import javax.swing.*;
import java.awt.*;
public class MessageArea extends JPanel {
public MessageArea(){
super();
setLayout(new BorderLayout());
JTextField jTextField = new JTextField();
jTextField.setEditable(true);
this.add(jTextField , BorderLayout.CENTER);
JLabel jLabel = new JLabel("Text:");
this.add(jLabel , BorderLayout.WEST);
JButton jButton = new JButton("Send");
jButton.setBackground(Color.CYAN);
this.add(jButton , BorderLayout.EAST);
jTextField.setToolTipText("Enter Text :");
}
}
import javax.swing.*;
import java.awt.*;
public class UsernameFrame extends JFrame {
private static final String BTN_TXT = "Start chatting...";
private static final String LABEL_TXT = "Choose your name ";
private static final int WIDTH = 300 , HEIGHT = 100 ;
JTextField textField;
JButton button ;
public UsernameFrame() throws HeadlessException{
super();this.setLayout(new BorderLayout());
JLabel label = new JLabel("choose your name");
add(label , BorderLayout.PAGE_START);
textField = new JTextField();
add(textField , BorderLayout.CENTER);
button = new JButton(LABEL_TXT);
add(button , BorderLayout.PAGE_END);
setSize(WIDTH , HEIGHT);
setVisible(true);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment