Package net.miginfocom.swt

Examples of net.miginfocom.swt.MigLayout


  public Node open() {
    Shell parent = getParent();
    final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    shell.setText("Neue Node");
    shell.setImage(Images.ADD);
    shell.setLayout(new MigLayout("fill, wrap 2", "[pref!][100!]"));
    shell.setLayoutData("hmin pref, wmin pref");

    Label lXCoordinate = new Label(shell, SWT.NONE);
    lXCoordinate.setText("X Koordinate:");
    lXCoordinate.setLayoutData("hmin pref, wmin pref");

    final AntText tXCoordinate = new AntText(new Text(shell, SWT.BORDER), getProject());
    tXCoordinate.getText().setText(Utility.FORMAT.format(_xCoordinate));
    tXCoordinate.getText().setLayoutData("hmin pref, wmin 50, growx");
    tXCoordinate.setTooltipText("Die X Koordinate f�r den neuen Knoten. (X >= 0)");
    tXCoordinate.setInputMode(AntText.DOUBLE_ONLY);
    tXCoordinate.setNumberRange(0, Double.POSITIVE_INFINITY, true, true);

    Label lYCoordinate = new Label(shell, SWT.NONE);
    lYCoordinate.setText("Y Koordinate:");
    lYCoordinate.setLayoutData("hmin pref, wmin pref");

    final AntText tYCoordinate = new AntText(new Text(shell, SWT.BORDER), getProject());
    tYCoordinate.getText().setText(Utility.FORMAT.format(_yCoordinate));
    tYCoordinate.getText().setLayoutData("hmin pref, wmin 50, growx");
    tYCoordinate.setTooltipText("Die Y Koordinate f�r den neuen Knoten. (Y >= 0)");
    tYCoordinate.setInputMode(AntText.DOUBLE_ONLY);
    tYCoordinate.setNumberRange(0, Double.POSITIVE_INFINITY, true, true);

    Composite buttonComp = new Composite(shell, SWT.NONE);
    buttonComp.setLayout(new MigLayout("wrap 2, ins 0", "[50%][50%]"));
    buttonComp.setLayoutData("hmin 0, wmin 0, growx, spanx");

    AntButton confirm = new AntButton(new Button(buttonComp, SWT.PUSH), getProject());
    confirm.getButton().setText("Erstellen");
    confirm.getButton().setLayoutData("hmin pref, wmin pref, grow");
View Full Code Here


    getController().getProject().addPropertyChangeListener(this);
    getController().addAlgorithmListener(this);

    Composite comp = new Composite(this, SWT.NONE);
    comp.setLayout(new MigLayout("fill, wrap 2, ins 0", "[pref!][]"));
    comp.setLayoutData("hmin pref, wmin pref, growx, pushx");

    Label lAntCount = new Label(comp, SWT.NONE);
    lAntCount.setLayoutData("hmin 0, wmin 0");
    lAntCount.setText("Anzahl der Ameisen:");
View Full Code Here

      }

    });

    Composite statusComp = new Composite(this, SWT.NONE);
    statusComp.setLayout(new MigLayout("fill, ins 0 5 0 0"));
    statusComp.setLayoutData("newline, hmin pref, wmin pref, spanx, growx");

    _statusLabel = new Label(statusComp, SWT.NONE);
    _statusLabel.setLayoutData("hmin pref, wmin pref, grow");
View Full Code Here

  public SwtDemo()
  {
    display = new Display();
    final Shell shell = new Shell();

    shell.setLayout(new MigLayout("wrap", "[]u[grow,fill]", "[grow,fill][pref!]"));
    shell.setText("MigLayout SWT Demo v2.5 - Mig Layout v" + LayoutUtil.getVersion());

    TabFolder layoutPickerTabPane = new TabFolder(shell, DOUBLE_BUFFER);
    layoutPickerTabPane.setLayoutData("spany,grow");
      pickerList = new List(layoutPickerTabPane, SWT.SINGLE | DOUBLE_BUFFER);
      deriveFont(pickerList, SWT.BOLD, -1);
      TabItem tab = new TabItem(layoutPickerTabPane, DOUBLE_BUFFER);
      tab.setControl(pickerList);
      tab.setText("Example Browser");
      for (int i = 0; i < panels.length; i++)
        pickerList.add(panels[i][0]);

    layoutDisplayPanel = new Composite(shell, DOUBLE_BUFFER);
    layoutDisplayPanel.setLayout(new MigLayout("fill, insets 0"));

    TabFolder descriptionTabPane = new TabFolder(shell, DOUBLE_BUFFER);
    descriptionTabPane.setLayoutData("growx,hmin 120,w 500:500");
      descrTextArea = createTextArea(descriptionTabPane, "", "", SWT.MULTI | SWT.WRAP);
      tab = new TabItem(descriptionTabPane, DOUBLE_BUFFER);
View Full Code Here

  {
//    TabFolder tabFolder = new TabFolder(parent2, DOUBLE_BUFFER);

    Composite parent = new Composite(parent2, SWT.NONE);

    MigLayout layout = new MigLayout("wrap 2");
    layout.setColumnConstraints("[grow, shrink][grow, shrink]");
    parent.setLayout(layout);

    Label label = new Label(parent, SWT.WRAP);
    label.setText("This is a long label");
    label.setLayoutData("width 20:pref:pref");
View Full Code Here

  public Control createWelcome(Composite parent)
  {
    TabFolder tabbedPane = new TabFolder(parent, DOUBLE_BUFFER);

    TabItem mainItem = createTabPanel(tabbedPane, "Welcome", new FillLayout());
    MigLayout lm = new MigLayout("ins 30, fill");
    Composite panel = createPanel(tabbedPane, lm);
    mainItem.setControl(panel);

    String s = "MigLayout's main purpose is to make layouts for SWT and Swing, and possibly other frameworks, much more powerful and a lot easier to create, especially for manual coding.\n\n" +
               "The motto is: \"MigLayout makes complex layouts easy and normal layouts one-liners.\"\n\n" +
View Full Code Here

    LC layC = new LC().fill().wrap();
    AC colC = new AC().align("right", 0).fill(1, 3).grow(100, 1, 3).align("right", 2).gap("15", 1);
    AC rowC = new AC().align("top", 7).gap("15!", 6).grow(100, 8);

    TabItem p1 = createTabPanel(tabbedPane, "Layout Showdown (improved)", new MigLayout(layC, colC, rowC));

    // References to text fields not stored to reduce code clutter.

    createList(p1, "Mouse, Mickey", new CC().dockWest().minWidth("150").gapX(null, "10"));
    createLabel(p1, "Last Name",    "");
View Full Code Here

    LC layC = new LC().fill().wrap();
    AC colC = new AC().align("right", 0).fill(1, 3).grow(100, 1, 3).align("right", 2).gap("15", 1);
    AC rowC = new AC().index(6).gap("15!").align("top").grow(100, 8);

    TabItem p1 = createTabPanel(tabbedPane, "Layout Showdown (improved)", new MigLayout(layC, colC, rowC));

    // References to text fields not stored to reduce code clutter.

    createLabel(p1, "Last Name",    "");
    createTextField(p1, "",         "");
View Full Code Here

  public Composite createLayout_Showdown(Composite parent)
  {
    TabFolder tabbedPane = new TabFolder(parent, DOUBLE_BUFFER);

    TabItem p1 = createTabPanel(tabbedPane, "Layout Showdown (pure)", new MigLayout("", "[]15[][grow,fill]15[grow]"));

    // References to text fields not stored to reduce code clutter.

    createList(p1, "Mouse, Mickey",   "spany, growy, wmin 150");
    createLabel(p1, "Last Name",      "");
    createTextField(p1, "",           "");
    createLabel(p1, "First Name",     "split")// split divides the cell
    createTextField(p1, "",           "growx, wrap");
    createLabel(p1, "Phone",          "");
    createTextField(p1, "",           "");
    createLabel(p1, "Email",          "split");
    createTextField(p1, "",           "growx, wrap");
    createLabel(p1, "Address 1",      "");
    createTextField(p1, "",           "span, growx"); // span merges cells
    createLabel(p1, "Address 2",      "");
    createTextField(p1, "",           "span, growx");
    createLabel(p1, "City",           "");
    createTextField(p1, "",           "wrap"); // wrap continues on next line
    createLabel(p1, "State",          "");
    createTextField(p1, "",           "");
    createLabel(p1, "Postal Code",    "split");
    createTextField(p1, "",           "growx, wrap");
    createLabel(p1, "Country",        "");
    createTextField(p1, "",           "wrap 15");

    createButton(p1, "New",           "span, split, align right");
    createButton(p1, "Delete",        "");
    createButton(p1, "Edit",          "");
    createButton(p1, "Save",          "");
    createButton(p1, "Cancel",        "wrap push");


    // Fixed version *******************************************


    TabItem p2 = createTabPanel(tabbedPane, "Layout Showdown (improved)", new MigLayout("", "[]15[][grow,fill]15[][grow,fill]"));

    // References to text fields not stored to reduce code clutter.

    createList(p2, "Mouse, Mickey",   "spany, growy, wmin 150");
    createLabel(p2, "Last Name",      "");
View Full Code Here

  public Composite createDocking(Composite parent)
  {
    TabFolder tabbedPane = new TabFolder(parent, DOUBLE_BUFFER);
    tabbedPane.setLayoutData("grow");

    TabItem p1 = createTabPanel(tabbedPane, "Docking 1", new MigLayout("fill"));

    createPanel(p1, "1. North", "north");
    createPanel(p1, "2. West", "west");
    createPanel(p1, "3. East", "east");
    createPanel(p1, "4. South", "south");

    Table table = new Table(getComposite(p1), DOUBLE_BUFFER);
    for (int i = 0; i < 6; i++) {
      TableColumn tc = new TableColumn(table, SWT.LEFT | SWT.V_SCROLL | SWT.SCROLL_LINE);
      tc.setText("Column " + (i + 1));
      tc.setWidth(100);
    }

    for (int r = 0; r < 20; r++) {
      TableItem item1 = new TableItem(table,0);
      String[] data = new String[6];
      for (int c = 0; c < data.length; c++)
        data[c] = "Cell " + (r + 1) + ", " + (c + 1);
            item1.setText(data);
    }
    table.setHeaderVisible(true);
        table.setLinesVisible(true);
    table.setLayoutData("grow");


    TabItem p2 = createTabPanel(tabbedPane, "Docking 2 (fill)", new MigLayout("fill", "[c]", ""));

    createPanel(p2, "1. North", "north");
    createPanel(p2, "2. North", "north");
    createPanel(p2, "3. West", "west");
    createPanel(p2, "4. West", "west");
    createPanel(p2, "5. South", "south");
    createPanel(p2, "6. East", "east");
    createButton(p2, "7. Normal", "");
    createButton(p2, "8. Normal", "");
    createButton(p2, "9. Normal", "");

    TabItem p3 = createTabPanel(tabbedPane, "Docking 3", new MigLayout());

    createPanel(p3, "1. North", "north");
    createPanel(p3, "2. South", "south");
    createPanel(p3, "3. West", "west");
    createPanel(p3, "4. East", "east");
    createButton(p3, "5. Normal", "");

    TabItem p4 = createTabPanel(tabbedPane, "Docking 4", new MigLayout());

    createPanel(p4, "1. North", "north");
    createPanel(p4, "2. North", "north");
    createPanel(p4, "3. West", "west");
    createPanel(p4, "4. West", "west");
    createPanel(p4, "5. South", "south");
    createPanel(p4, "6. East", "east");
    createButton(p4, "7. Normal", "");
    createButton(p4, "8. Normal", "");
    createButton(p4, "9. Normal", "");

    TabItem p5 = createTabPanel(tabbedPane, "Docking 5 (fillx)", new MigLayout("fillx", "[c]", ""));

    createPanel(p5, "1. North", "north");
    createPanel(p5, "2. North", "north");
    createPanel(p5, "3. West", "west");
    createPanel(p5, "4. West", "west");
    createPanel(p5, "5. South", "south");
    createPanel(p5, "6. East", "east");
    createButton(p5, "7. Normal", "");
    createButton(p5, "8. Normal", "");
    createButton(p5, "9. Normal", "");

    TabItem p6 = createTabPanel(tabbedPane, "Random Docking", new MigLayout("fill"));

    String[] sides = {"north", "east", "south", "west"};
    Random rand = new Random();
    for (int i = 0; i < 20; i++) {
      int side = rand.nextInt(4);
View Full Code Here

TOP

Related Classes of net.miginfocom.swt.MigLayout

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.