OK、セットアップは次のとおりです。パネル内の 3 つのコンポーネント (JScrollpane、JPanel、および JTabbedPane)。
this.plan = new JPanel();
this.plan.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
//The ScrollPane
this.SrsDocument = new JTextArea();
this.SrsDocument.setEditable(false);
this.SrsDocumentScroll = new JScrollPane(this.SrsDocument);
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.33;
c.weighty = 1.0;
c.gridx = 0;
this.plan.add(this.SrsDocumentScroll, c);
...
//The Panel
this.TreePanel = new JPanel();
this.TreePanel.setLayout(new BoxLayout(this.TreePanel, BoxLayout.Y_AXIS));
this.Tree = new JTree();
((DefaultTreeModel)(this.Tree.getModel())).setRoot(null);
this.Tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
this.TreeScroll = new JScrollPane(this.Tree);
this.TreePanel.add(this.TreeScroll);
c.gridx = 1;
c.weightx = 0.33;
this.plan.add(this.TreePanel, c);
...
//The TabbedPane
this.currentFunction = new JTabbedPane();
c.gridx = 2;
c.weightx = 0.33;
this.plan.add(this.currentFunction, c);
このレイアウトには 3 つの列があり、すべて幅が均等であると予想していました。それでも、最初の表示では this.SrsDocumentScroll の幅が他の 2 よりもはるかに狭くなっています。this.plan のサイズが変更されると、3 つすべてが均等にサイズ変更されると予想していました。weightx は、私が想定していたようにサイズ変更時にスペースを分散する方法を決定しませんか?
また、3 つの内容は次のとおりです。textArea はテキストで満たされ、tree は単なるルートであり、タブ付きペインには 1 つのタブしかありません。すべての内容は動的に変化しますが、そのサイズ変更は私が問題を抱えている動作ではなく、ウィンドウのサイズ変更だけであり、(ウィンドウが縮小するにつれて)均等ではなく左端->右端を消費します。
編集:これは、より多くのテストを行うためのものです。そのため、weightx に 0.33 を使用しました。最終的な結果は、他のペインよりもタブペインに重くのしかかることです。(0.25,0.25,0.5) に似ていますが、私をフォローすると、それらの値よりも扱いやすくなります。