GridBagLayoutをNetBeansのGUIエディタでは扱えないGridBagLayoutをNetBeansのGUIエディタでも使えたー>後で書く
以下の記事は嘘を書いていますので見ないように^^;
GridBagLayoutはGridLayoutを拡張した形で、
格子の連結ができるレイアウトです。
しかし、NetBeansのGUIエディタでは扱えないみたいです。
高度な使い方でしょうからね。
仕方ないのでinitComponentsの下でゴニョゴニョ書くしかないようです。
public class DesktopApplication1View extends FrameView { public DesktopApplication1View(SingleFrameApplication app) { super(app); initComponents(); gridBagConstraints=new GridBagConstraints(); gridBagLayout=new GridBagLayout(); JLabel jlabel; jPanel2.setLayout(gridBagLayout); gridBagConstraints.gridx=0; gridBagConstraints.gridy=0; gridBagConstraints.gridwidth=1; gridBagConstraints.gridheight=1; jlabel=new JLabel("hoge"); gridBagLayout.setConstraints(jlabel, gridBagConstraints); jPanel2.add(jlabel); gridBagConstraints.gridx=1; gridBagConstraints.gridy=0; gridBagConstraints.gridwidth=1; gridBagConstraints.gridheight=1; jlabel=new JLabel("fuga"); gridBagLayout.setConstraints(jlabel, gridBagConstraints); jPanel2.add(jlabel); gridBagConstraints.gridx=0; gridBagConstraints.gridy=1; gridBagConstraints.gridwidth=1; gridBagConstraints.gridheight=1; jlabel=new JLabel("moge"); gridBagLayout.setConstraints(jlabel, gridBagConstraints); jPanel2.add(jlabel);
こんな感じでゴニョゴニョ書かなきゃならないようです。
たったこれだけを書くためにこの量のコードは
めんどくさ過ぎる。これは却下ですなぁ。