Possible Duplicate:
On Screen Keyboard gui is not working
I am making a keyboard using Jbutton in java. The problem I am unable to set the layout of keyboard with layout of the original keyboard. How can I do this? I am learning java and I have been sitting to solve this problem for the last 3 hours and couldn’t find a solution.Here is the code:
public Keyboard()
{
super("Keyboard");
pane1= new JPanel();
pane2= new JPanel();
pane3= new JPanel();
glayout= new GridLayout(5,14,2,5);
text= new JTextArea(15,65);
text.setFocusable(true);
Handler = new HandlerClass();
pane1.add(text);
pane2.setLayout(glayout);
pane3.setLayout(new BorderLayout(5,5));
but= new JButton[57];
for(int i=0;i<names.length;i++)
{
but[i]=new JButton(names[i]);
pane2.add(but[i]);
}
text.addKeyListener(Handler);
pane3.add(pane1,BorderLayout.NORTH);
pane3.add(pane2,BorderLayout.SOUTH);
add(pane3);
}

How can I solve this problem?
Regards
I found answer to my question myself. I just made panels for each row in keyboard. It is a lengthy way to solve this problem but It gets the job done. If any other person has better solution post it in answer and I will select that answer.