LC layoutConstraints = new LC(); layoutConstraints.setFillX(true); super.setLayout(new MigLayout(layoutConstraints);
LC lc_Y = (new LC()).fill().flowY(); lc_Y.setWrapAfter(ITEMS_PER_COLUMN); JPanel panel = new JPanel(new MigLayout(lc_Y));
public static void main(String[] args) { JPanel panel1 = new JPanel(new MigLayout(new LC().fill())); panel1.add(new JTextField("text1"), "span, growx"); panel1.add(new JTextField("another text field"), "span, growx"); panel1.add(new JTextField("text3"), "span, growx"); JPanel panel2 = new JPanel(new MigLayout()); JTextArea textArea = new JTextArea(); textArea.setColumns(15); textArea.setRows(7); JScrollPane jsp = new JScrollPane(textArea); panel2.add(jsp, "span, grow"); JFrame frame = new JFrame(); frame.setLayout(new GridLayout(1, 2)); frame.add(panel1); frame.add(panel2); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
JButton closeButton = new JButton("Close"); JButton mainMenuButton = new JButton("Menu"); JLabel labelTitle = new JLabel("Application"); JPanel panel = new JPanel(); panel.setLayout(new MigLayout(new LC().fillX())); panel.add(labelTitle, new CC().alignX("center").spanX()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new MigLayout(new LC().fillX())); buttonPanel.add(closeButton, new CC().alignX("right").split()); buttonPanel.add(mainMenuButton, new CC().alignX("right")); buttonPanel.setOpaque(false); JXLayer<JPanel> mainPanel = new JXLayer<JPanel>(); mainPanel.setView(panel); mainPanel.setGlassPane(buttonPanel); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(mainPanel); frame.setSize(400, 600); frame.setVisible(true);
LC layoutConstraints = new LC(); layoutConstraints.setFillX(true); layoutConstraints.setDebugMillis(500); super.setLayout(new MigLayout(layoutConstraints);
southPanel.setBackground(Color.YELLOW); LC layoutContraints = new LC().wrapAfter(2) .debug(1000); AC columnContraints = new AC()
panelCenter.setLayout( new MigLayout( new LC().wrapAfter(4), new AC().size(":80:", 0).size("115:115:115", 1, 2, 3).align("right", 0, 2), new AC().size("19:19:19")
JFrame frame = new JFrame("MigLayout"); JPanel panel = new JPanel(new MigLayout(new LC().debug(1000).flowY().fillX()));
public void setMiglayout() { setMiglayout(new LC(), new AC(), new AC()); }
cPnl = new JPanel(); rPnl = new JPanel(); lPnl.setLayout(new MigLayout(new LC().fillY())); lPnl.add(enabledModsLbl, GuiConstants.WRAP); lPnl.add(enabledModsScl, "pushy, " + GuiConstants.GROW + GuiConstants.SEP + GuiConstants.WRAP); cPnl.add(enableMod, GuiConstants.WRAP); cPnl.add(disableMod); rPnl.setLayout(new MigLayout(new LC().fillY())); rPnl.add(disabledModsLbl, GuiConstants.WRAP); rPnl.add(disabledModsScl, "pushy, " + GuiConstants.GROW + GuiConstants.SEP + GuiConstants.WRAP); rPnl.add(addMod, GuiConstants.FILL_SINGLE_LINE); formPnl.setLayout(new MigLayout(new LC().fillY())); formPnl.add(lPnl, "push, grow, " + GuiConstants.SPLIT_3); formPnl.add(cPnl, "push, grow, center");
LC layoutConstraints = new LC().insets( "0" );
public SimpleFrame() { setMiglayout(new LC().wrapAfter(1), new AC().align("center"), new AC()); JButton okButton = new JButton("OK"); okButton.setName("ok"); add(okButton); pack(); } }
final JPanel p = new JPanel(new MigLayout(new LC().flowY().noGrid())); p.setOpaque(false); for (final CommandLink link : choices)
public void startContainerLayout( Composite container, SwtMetawidget metawidget ) { container.setData( MigLayout.class.getName(), null ); State state = getState( container ); // The entire layout should fill both horizontally and vertically, // with no insets. This allows us to be properly nested, as well as // embedded within existing UIs, without alignment problems LC layoutConstraints = new LC().insets( "0" ); // Debug Info (draws the red and blue lines) if ( mDebugMode ) { layoutConstraints.debug( 500 ); } // Create the Layout // // Note: we don't use column/row constraints, because we don't know // what the controls will be in advance. Rather, we use 'cell' and 'push' org.eclipse.swt.widgets.Layout layout = new net.miginfocom.swt.MigLayout( layoutConstraints ); container.setLayout( layout ); // Calculate default label inset // // We top align all our labels, not just those belonging to 'tall' controls, // so that tall controls, regular controls and nested Metawidget controls all line up. // However, we still want the Labels to be middle aligned for one-line controls (such as // Text boxes), so we top inset them a bit state.defaultLabelVerticalPadding = new GC( container ).getFontMetrics().getLeading(); }
); panel = new JPanel(new MigLayout(new LC().fill())); model = new SpinnerNumberModel(12, 8, 30, 1);
public TableFrame() { setMiglayout(new LC().wrapAfter(1), new AC(), new AC()); final JTable table = newTable("records", data(), columns()); add(table); pack(); }
public MainFrame(String name) { super("main"); setTitle("News: " + getTitle()); setMiglayout(new LC().wrapAfter(1), new AC().align("center"), new AC()); add(newLabel("name", "The user has the name: '" + name + "'")); add(newLabel("pw", "and the password: '***")); pack(); } }
public LoginFrame() { setMiglayout(new LC().wrapAfter(2), new AC().align("right"), new AC()); final JLabel nameLabel = newLabel("username", "Username"); final JTextField textField = newTextField("username"); final JLabel pwLabel = newLabel("password", "Password"); final JTextField pwField = newPasswordField("password"); JButton loginButton = newButton("login", "Login"); loginButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { LoginFrame.this.dispose(); login(textField); } }); add(nameLabel); add(textField); add(pwLabel); add(pwField); add(loginButton); pack(); }
if (layoutConstraints == null) setLayoutConstraints(new LC()); if (rowConstraints == null) setRowConstraints(new AC()); if (columnConstraints == null) setColumnConstraints(new AC());
public SimpleCopyApplication() { setMiglayout(new LC().wrapAfter(1), new AC().align("center"), new AC()); final JTextField textField = newTextField("textToCopy"); JButton button = newButton("copyButton", "Copy text to label"); final JLabel label = newLabel("copiedText"); addActionToButton(button, new Runnable() { @Override public void run() { label.setText(textField.getText()); } }); add(textField); add(button); add(label); pack(); }