Ez Hudsy

Greenhorn
+ Follow
since Mar 29, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ez Hudsy

Oddly enough, your latest += margin snippet gives me a negative margin integer, and the buttons are off the frame. I think I just have a GUI setup thats too convoluted -- boxes insides panels inside frames, each having various layouts, etc. In time, I must try to clean it up.

I am so happy with how this worked out, though, I'm interested in how far one can take this glassPane technique. Is it possible to specify a second component and place it absolutely on the same glasspane? I don't get the impression that multiple glasspanes are possible, is that so?
12 years ago
I would center the column of buttons ideally. And you were correct, sure enough, I threw in a frame.pack() before this bit of code, and the buttons appeared beneath the tabs as expected.
12 years ago
I compiled your example, and its perfect. When I add those changes into my app verbatim, the column of buttons is actually floating in the middle of the JTabbedPane. There must be additional settings (setPreferredSizes?) in my GUI that effect things.

When I take out the tabBounds completely, and just set the fourth Inset parameter to 10, it nicely sets in the middle of the space and looks great. My question would be what is the purpose of getting the Rectangle tabBounds and adjusting the Inset to that?
12 years ago
Wow, this glasspane is great! I hadn't come across it before now.

So I fumbled around with your original code and got it working perfectly! This ended up being enough:

Rectangle tabBounds = tabbedPaneLibrary.getBoundsAt(0);
Container glassPane = (Container) frame.getRootPane().getGlassPane();
glassPane.setVisible(true);
glassPane.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.NONE;
gbc.insets = new Insets(tabBounds.y, 0, 0, 15);
gbc.anchor = GridBagConstraints.SOUTHEAST;
glassPane.add(boxLibraryButtons, gbc);

I see you took out the tabBounds in your latest post's code. I wasn't sure what that was doing anyway so I'll see what it does without it. I am amazed at how quick and on it you guys are. I'll be stopping by the Big Moose again soon... =)
12 years ago
hey john,

I certainly would rather stick with a Layout if it were possible. I am currently using BoxLayout:

panelOfEverything.setLayout(new BoxLayout(panelOfEverything, BoxLayout.PAGE_AXIS));

I would love to see an example of how you did this!

Ez
12 years ago
So I just stumbled across placement of tabs in a JTabbedPane to the right and left (i.e. setTabPlacement(JTabbedPane.RIGHT)) which I love the look of. What I need is to utilize the space this leaves beneath the tabs. I currently have a column of JButtons, but they get pushed to the side, leaving a lot of blank space.

Any thoughts on how to do this? some kind of custom overlay or something? I've place with absolute position some (setBounds) but that doesn't seem to do it.

I've attached a screenshot... in the code I basically have one horizontally aligned Box, with the JTabbedPane added to it, then the column of buttons after that.

boxOfEverything.add(tabbedPane);
boxOfEverything.add(boxColumnButtons);

I am excited to see if someone knows how to pull this off. =)
12 years ago