GridBagLayout is not working

this.rootComponent.setLayout(new GridBagLayout()); GridBagConstraints gbc=new GridBagConstraints(); //gbc.gridwidth=2; gbc.gridx=0; gbc.gridy=0; gbc.gridwidth=8; gbc.anchor=GridBagConstraints.FIRST_LINE_START; this.rootComponent.add(new JLabel("Test label 1"),gbc); gbc.gridx=8; gbc.gridy=12; gbc.gridwidth=GridBagConstraints.REMAINDER; gbc.anchor=GridBagConstraints.FIRST_LINE_START; this.rootComponent.add(new JLabel("Test label"),gbc); Want to format it like this. grey part shows the jpanel part. Initially i want to layout the first 2 jpanel correctly . which is not working. how to fix it? ![enter image description here][1] [1]: http://i.stack.imgur.com/wNvsF.png
this could be job exactly for MigLayout, but no issue for GBC, you can to set percentual Dimension for GBC too

以上就是GridBagLayout is not working的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏