troubleshooting Question

How do i reder the buttons in the center of panel in java

Avatar of Anj78
Anj78 asked on
JavaEditors IDEs
12 Comments1 Solution272 ViewsLast Modified:
I have to render two buttons in the center of panel and at the top of it. I have the following code and it shows the button on the left top of panel.
How do i use the padding or insets ?I really don't understand the difference between them?
BasicCompositePane wAnswer = new BasicCompositePane(ChannelMode.WRITE);
    wAnswer.setLayout(new GridBagLayout());
   
    wAnswer.setOpaque(false);

    wAnswer.add(getTracButton(), ViewUtilities.getGridBagConstraints(
        3, 0, 5, 1, .50, 0.5, GridBagConstraints.CENTER,
        GridBagConstraints.HORIZONTAL, new Insets(0,10, 0, 10), 20, 0));
   
    wAnswer.add(getAuditButton(), ViewUtilities.getGridBagConstraints(
        3, 1, 5, 1, .50, 0.5, GridBagConstraints.CENTER,
        GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 10), 20, 0));
   
    wAnswer.add(Box.createVerticalGlue(), ViewUtilities.getGridBagConstraints(
        40, 60, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
        GridBagConstraints.VERTICAL, new Insets(0, 5, 0, 5), 0, 0));
ASKER CERTIFIED SOLUTION
Bart Cremers
Java Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros