简体   繁体   中英

On Screen Keyboard gui is not working

I am making a trying to display a textarea at the top and Keyboard keys below it, but when I run this code, the whole thing is mixed. What am I doing wrong and how can I solve it? Here is the code:

public Keyboard()
{
    super("Typing Tutor");

    pane1= new JPanel();
    pane2= new JPanel();
    pane3= new JPanel();
    pane4= new JPanel();
    pane5= new JPanel();
    pane6= new JPanel();

    glayout= new GridLayout(5,14);
    text= new JTextArea(770,300);

    text.setFocusable(true);

    Handler = new HandlerClass();

    pane1.add(text);

    setLayout(glayout);

    but= new JButton[57];

    AssignLettersToButtons();

    text.addKeyListener(Handler);

    add(pane1,BorderLayout.NORTH);
    add(pane2);
    add(pane3);
    add(pane4);
    add(pane5);
    add(pane6);

}

private void AssignLettersToButtons()
{       
    for(int i=0;i<names.length;i++)
    {
        if(i<14)
        {
            but[i]=new JButton(names[i]);
            pane1.add(but[i]);
        }
  }

在此处输入图片说明

Design it may take at least 3 panels. As in following在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM