View unanswered posts | View active topics It is currently Sun May 28, 2017 7:42 am



Reply to topic  [ 1 post ] 
 Why does this label grow? 
Author Message

Joined: Tue Aug 19, 2008 11:51 pm
Posts: 4
Post Why does this label grow?
Why does "Label 1" grow in this example? This seems like a bug to me. Using version 3.7.4.
Also see http://stackoverflow.com/questions/1159400/span-grow-bug-in-miglayout

Code:
package dev.migplayground;

import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;

public class MigPlayground extends JFrame {

    public static void main(String args[]) {
        MigPlayground migPlayground = new MigPlayground();
        migPlayground.setSize(500, 500);
        migPlayground.setDefaultCloseOperation(EXIT_ON_CLOSE);
        migPlayground.setVisible(true);
    }

    public MigPlayground() {
        JPanel content = new JPanel();
        content.setLayout(new MigLayout("fill, debug"));

        content.add(new JScrollPane(new JPanel()), "grow, span, push"); //change to "pushy" and Label 1 doesn't grow
        content.add(new JLabel("Label 1"), "newline");
        content.add(new JTextField(), "growx, pushx");
        content.add(new JLabel("Label 2"));
        content.add(new JTextField(), "growx, pushx");
        content.add(new JLabel("Label 3"));
        content.add(new JTextField(), "growx, pushx");

        setContentPane(content);
    }
}


Wed Apr 13, 2011 7:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

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.