contentPane.add(hyperlink, new CC().dockNorth().gapLeft("10px").gapBottom("10px").gapTop("10px")); contentPane.add(southPanel, new CC().dockSouth().pad(10, 10, 10, 10).alignX("center")); contentPane.add(c, new CC().growX().gap("10px", "10px", "10px", "10px")); dialog.setSize(800, 400); dialog.setVisible(true);
protected String layoutBeforeChild( Control control, String labelText, String elementName, Map<String, String> attributes, Control container, SwtMetawidget metawidget ) { State state = getState( (Composite) container ); // Add label if ( SimpleLayoutUtils.needsLabel( labelText, elementName ) ) { Label label = new Label( (Composite) container, SWT.None ); // Required if ( attributes != null && TRUE.equals( attributes.get( REQUIRED ) ) && !WidgetBuilderUtils.isReadOnly( attributes ) && !metawidget.isReadOnly() ) { label.setText( labelText + "*" + StringUtils.SEPARATOR_COLON ); } else { label.setText( labelText + StringUtils.SEPARATOR_COLON ); } CC labelConstraints = new CC(); labelConstraints.cell( state.currentColumn * 2, state.currentRow ); labelConstraints.growX(); // Top align all labels, not just those belonging to 'tall' controls, // so that tall controls, regular controls and nested Metawidget // controls all line up labelConstraints.alignY( "top" ); // Apply some vertical padding so the label lines up with the control nicely labelConstraints.pad( state.defaultLabelVerticalPadding, 0, state.defaultLabelVerticalPadding, 0 ); // Add it label.setLayoutData( labelConstraints ); label.moveAbove( control ); } return labelText; }
CC labelConstraints = new CC(); labelConstraints.cell( state.currentColumn * 2, state.currentRow ); labelConstraints.growX();
public void onEndBuild( SwingMetawidget metawidget ) { // Buttons Facet buttonsFacet = metawidget.getFacet( "buttons" ); if ( buttonsFacet != null ) { State state = getState( metawidget ); if ( state.currentColumn > 0 ) { state.currentColumn = 0; state.currentRow++; } metawidget.add( buttonsFacet, new CC().cell( 0, state.currentRow ).spanX().growX() ); } }
colorsPanel.add(listOfColorsInSchme, new CC().alignY("top")); colorsPanel.add(colorChooser, new CC().alignY("top")); colorsPanel.add(logDetailsTextPane, new CC().spanX().growX()); updateLogDetails(); panel.add(colorsPanel, new CC().spanX().wrap()); addLabel("Default colors", new JXHyperlink(new AbstractAction("Reset to defaults") { @Override
public void onEndBuild( SwtMetawidget metawidget ) { // Buttons Facet buttonsFacet = metawidget.getFacet( "buttons" ); if ( buttonsFacet != null ) { State state = getState( metawidget ); if ( state.currentColumn > 0 ) { state.currentColumn = 0; state.currentRow++; } buttonsFacet.setLayoutData( new CC().cell( 0, state.currentRow ).spanX().growX() ); buttonsFacet.moveBelow( null ); } }
private void initComponents() { setLayout(new MigLayout( "wrap 1, insets 5 15", // Layout Constraints "[grow]", // Column constraints with default align "[min!][grow]" // Row constraints with default align )); setBackground(Color.white); // TODO add padding to asbodypanel // TODO change look&feel of tabs (overview/visual) bodyPanel.setBackground(Color.white); header = new AgroSenseHeader(); super.add(header); super.add(bodyPanel, "grow"); super.add(footer, new CC().dockSouth().width("707px").height("140px")); }
buttons.add(btn); bGroup.add(btn); p.add(btn, new CC().growX().gapBottom("8"));
CC cc = new CC();
CC componentConstraints = new CC();