right size for the frame
I have tryed to design a simple chatclient i Borland Jbuilder.
It looks realy good in the design mode, but When I run the aplication,
it gets so smal.. and I have to resize it manualy verytime to make it look good.
I dont know if there is somthing wrong/missing in the code.
Please look at he code and tell me what should I do to make it look better.
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.*;
import java.awt.event.*;
publicclass ChatClient2
extends JFrame
{
publicstaticvoid main(String args[])
{
new ChatClient2();//.setSize(600,600);
}
JPanel configs =new JPanel();
JTabbedPane JTABChatClient =new JTabbedPane();
JPanel chat =new JPanel();
JTextField JTXT_uname =new JTextField();
JTextField JTXT_server =new JTextField();
JLabel jlabel =new JLabel();
JLabel jLabel2 =new JLabel();
JButton JBTNLogin =new JButton();
JTextArea jTextArea1 =new JTextArea();
JList jList1 =new JList();
JTextField jTextField3 =new JTextField();
JButton jButton1 =new JButton();
BorderLayout borderLayout1 =new BorderLayout();
public ChatClient2()
{
try
{
jbInit();
}
catch (Exception e)
{
e.printStackTrace();
}
pack();
show();
}
privatevoid jbInit()throws Exception
{
this.getContentPane().setSize(600,600);
this.getContentPane().setLayout(borderLayout1);
configs.setLayout(null);
chat.setLayout(null);
JTXT_uname.setText("");
JTXT_uname.setBounds(new Rectangle(189, 98, 181, 26));
JTXT_server.setBounds(new Rectangle(189, 127, 181, 26));
JTXT_server.setText("192.168.17.130");
jlabel.setText("Username");
jlabel.setBounds(new Rectangle(90, 97, 100, 31));
jLabel2.setBounds(new Rectangle(88, 125, 100, 31));
jLabel2.setText("Server Adress");
JBTNLogin.setBounds(new Rectangle(274, 202, 108, 25));
JBTNLogin.setText("Login");
JBTNLogin.addActionListener(new ChatClient2_JBTNLogin_actionAdapter(this));
jTextArea1.setText("jTextArea1");
jTextArea1.setBounds(new Rectangle(10, 22, 396, 402));
jList1.setBounds(new Rectangle(418, 23, 97, 402));
jTextField3.setText("jTextField3");
jTextField3.setBounds(new Rectangle(9, 445, 400, 25));
jButton1.setBounds(new Rectangle(423, 444, 91, 27));
jButton1.setText("jButton1");
configs.add(JTXT_uname,null);
configs.add(JTXT_server,null);
configs.add(JBTNLogin,null);
configs.add(jLabel2,null);
configs.add(jlabel,null);
JTABChatClient.add(chat,"chat");
JTABChatClient.add(configs,"configs");
chat.add(jTextArea1,null);
chat.add(jList1,null);
chat.add(jTextField3,null);
chat.add(jButton1,null);
this.getContentPane().add(JTABChatClient, BorderLayout.CENTER);
chat.setEnabled(false);
}
void JBTNLogin_actionPerformed(ActionEvent e)
{
chat.setEnabled(true);
//koppla dig mot server.
JTABChatClient.setSelectedComponent(chat);
}
}
class ChatClient2_JBTNLogin_actionAdapter
implements java.awt.event.ActionListener
{
ChatClient2 adaptee;
ChatClient2_JBTNLogin_actionAdapter(ChatClient2 adaptee)
{
this.adaptee = adaptee;
}
publicvoid actionPerformed(ActionEvent e)
{
adaptee.JBTNLogin_actionPerformed(e);
}
}

