public class Chat extends JFrame {
public static JTextField jt; public Chat(){ setLayout(new FlowLayout()));setLocation(200, 200); setSize(200, 200); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); Container con=this.getContentPane(); JLabel title=new JLabel(); title.setText("get the local IP"); title.setLocation(50, 0); JLabel tit=new JLabel("IP adress:"); tit.setLocation(0, 20); JButton jba=new JButton("yes"); JButton jb2=new JButton("exit"); jt=new JTextField(10); con.add(title); con.add(tit); con.add(jt); con.add(jba); con.add(jb2); //button listenering jba.addActionListener(new jbalistener()); jb2.addActionListener(new jblistener()); } public static JTextField getJt() { return jt; } public void setJt(JTextField jt) { this.jt = jt; } public static void main(String args[]){ new Chat(); }}