On Screen Keyboard gui is not working

喜夏-厌秋 提交于 2019-12-04 04:47:51

问题


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]);
        }
  }


回答1:


Design it may take at least 3 panels. As in following



来源:https://stackoverflow.com/questions/13428104/on-screen-keyboard-gui-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!