java - How to get JButton below the JTextFields -


i have created gridlayout gui show 6 rows , 4 columns. trying 2 buttons have "calculate" , "exit" show in 6th row. have 2 pane.add of 4 row 5 (which weight label , textfield). i'm trying calculate , exit buttons on own row. tried pane.add(); fill gap , couldn't work. missing can buttons on own row?

basically have

    pane.setlayout(new gridlayout(6, 4));       pane.add(score1l);     pane.add(score1tf);     pane.add(weight1l);     pane.add(weight1tf);     pane.add(score2l);     pane.add(score2tf);     pane.add(weight2l);     pane.add(weight2tf);     pane.add(score3l);     pane.add(score3tf);     pane.add(weight3l);     pane.add(weight3tf);     pane.add(score4l);     pane.add(score4tf);     pane.add(weight4l);     pane.add(weight4tf);      pane.add(weightavgl);     pane.add(weightavgtf);      pane.add(calculateb);     pane.add(exitb); 

possible options:

  • add empty jlabels fill in gaps.
  • use mixed layouts -- nest jpanels, each using own layout , add components them. example, overall jpanel use borderlayout. textfields/labels in gridlayout or gridbaglayout using jpanel added borderlayout.center main jpanel. jbuttons held in own gridlayout using jpanel added borderlayout.page_end main jpanel.
  • use layout manager allows more complex layouts such gridbaglayout, or better perhaps, 3rd party layout manager such miglayout.
  • perhaps best of --use jtable hold data grid, add jscrollpane, , place buttons below jscrollpane.

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -