View unanswered posts | View active topics It is currently Thu Mar 30, 2017 3:43 am



Reply to topic  [ 3 posts ] 
 Unexpected pushy gap in split cell 
Author Message

Joined: Wed Sep 21, 2011 1:41 pm
Posts: 16
Post Unexpected pushy gap in split cell
Code:

/**
 * A split cell of a column with fill and grow, containing non-growing
 * components, excess space by default is given to the gap between the
 * components.
 *
 * My expectation would be to layout them with normal gap between, excess space
 * going to the end. Can be reached by explicitly adding a pushy gap to the last
 * component.
 *
 * @author Jeanette Winzenburg, Berlin
 */
public class UnexpectedPushyGap {

    private JComponent createContent() {
        MigLayout layout = new MigLayout("wrap 2, debug", "[fill, grow][]");
        JComponent content = new JPanel(layout);
        content.add(new JLabel("Options"), "split 2, grow 0");
        content.add(new JLabel("Undo"), "grow 0");

        content.add(new JButton("Stack in right"));

        return content;
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame frame = new JFrame("");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new UnexpectedPushyGap().createContent());
                frame.pack();
                frame.setSize(frame.getWidth() * 2, frame.getHeight());
                frame.setVisible(true);
            }
        });
    }

}



Bug or feature? If a feature, I'm curious for the why :-)

Thanks
Jeanette


Thu Jun 21, 2012 3:12 pm
Profile
Site Admin

Joined: Mon Dec 06, 2004 4:24 pm
Posts: 2485
Location: Sweden
Post Re: Unexpected pushy gap in split cell
put in work queue.


Sat Jun 23, 2012 11:08 am
Profile WWW
Site Admin

Joined: Mon Dec 06, 2004 4:24 pm
Posts: 2485
Location: Sweden
Post Re: Unexpected pushy gap in split cell
In a cell there are only gaps between the components. The inter cell gaps doesn't belong to the cell, so to say. So when the layout can't grow the components it start growing the gaps to fill the cell.

Cheers,
Mikael


Fri Feb 22, 2013 3:44 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.