• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help... my anchor's dragging in my JSplitPane!  RSS feed

Bob Dobalina
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I'm trying to position a component within a JSplitPane such that it expands horizontally if the JSplitPane is stretched, but I want for it to stay glued to the top of it's portion of the JSplitPane. This is what my code looks like:

GridBagConstraints gbc = new GridBagConstraints();
GridBagLayout gbl = new GridBagLayout();
JPanel outerPanel = new JPanel(gbl);
gbc.anchor = GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbl.setConstraints(getRulePanel(), gbc);

(The result of getRulePanel() is just a custom JPanel, and "this" in this case is the JSplitPane.) For whatever reason, this anchor won't work. I've tried turning off the fill, and a dozen other things to try to get it to work, but no luck. Is it something to do with the JSplitPane? I've been using Swing for years, but this is frustrating!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!