Package net.miginfocom.swing

Examples of net.miginfocom.swing.MigLayout


    return mainPanel;
  }

  private JComponent createButtonBarsPanel(String helpTag, boolean sizeLocked)
  {
    MigLayout lm = new MigLayout("nogrid, fillx, aligny 100%, gapy unrel");
    JPanel panel = createTabPanel(lm);

    // Notice that the order in the rows below does not matter...
    String[][] buttons = new String[][] {
        {"OK"},
View Full Code Here


  public JComponent createOrientation()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    MigLayout lm = new MigLayout("flowy", "[grow,fill]", "[]20[]20[]20[]");
    JPanel mainPanel = createTabPanel(lm);

    // Default orientation
    MigLayout defLM = new MigLayout("", "[trailing][grow,fill]", "");

    JPanel defPanel = createTabPanel(defLM);
    addSeparator(defPanel, "Default Orientation");
    defPanel.add(createLabel("Level of Trust"));
    defPanel.add(createTextField(""), "span,growx");
    defPanel.add(createLabel("Radar Presentation"));
    defPanel.add(createTextField(""));
    defPanel.add(createTextField(""));

    // Right-to-left, Top-to-bottom
    MigLayout rtlLM = new MigLayout("rtl,ttb",
                                    "[trailing][grow,fill]",
                                    "");
    JPanel rtlPanel = createTabPanel(rtlLM);
    addSeparator(rtlPanel, "Right to Left");
    rtlPanel.add(createLabel("Level of Trust"));
    rtlPanel.add(createTextField(""), "span,growx");
    rtlPanel.add(createLabel("Radar Presentation"));
    rtlPanel.add(createTextField(""));
    rtlPanel.add(createTextField(""));

    // Right-to-left, Bottom-to-top
    MigLayout rtlbLM = new MigLayout("rtl,btt",
                                          "[trailing][grow,fill]",
                                          "");
    JPanel rtlbPanel = createTabPanel(rtlbLM);
    addSeparator(rtlbPanel, "Right to Left, Bottom to Top");
    rtlbPanel.add(createLabel("Level of Trust"));
    rtlbPanel.add(createTextField(""), "span,growx");
    rtlbPanel.add(createLabel("Radar Presentation"));
    rtlbPanel.add(createTextField(""));
    rtlbPanel.add(createTextField(""));

    // Left-to-right, Bottom-to-top
    MigLayout ltrbLM = new MigLayout("ltr,btt",
                                          "[trailing][grow,fill]",
                                          "");
    JPanel ltrbPanel = createTabPanel(ltrbLM);
    addSeparator(ltrbPanel, "Left to Right, Bottom to Top");
    ltrbPanel.add(createLabel("Level of Trust"));
View Full Code Here

  public JComponent createCell_Position()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    // Absolute grid position
    MigLayout absLM = new MigLayout("",
                                    "[100:pref,fill]",
                                    "[100:pref,fill]");
    JPanel absPanel = createTabPanel(absLM);
    absPanel.add(createButton(), "cell 0 0");
    absPanel.add(createButton(), "cell 2 0");
    absPanel.add(createButton(), "cell 3 0");
    absPanel.add(createButton(), "cell 1 1");
    absPanel.add(createButton(), "cell 0 2");
    absPanel.add(createButton(), "cell 2 2");
    absPanel.add(createButton(), "cell 2 2");


    // Relative grid position with wrap
    MigLayout relAwLM = new MigLayout("wrap",
                                           "[100:pref,fill][100:pref,fill][100:pref,fill][100:pref,fill]",
                                           "[100:pref,fill]");
    JPanel relAwPanel = createTabPanel(relAwLM);
    relAwPanel.add(createButton());
    relAwPanel.add(createButton(), "skip");
    relAwPanel.add(createButton());
    relAwPanel.add(createButton(), "skip,wrap");
    relAwPanel.add(createButton());
    relAwPanel.add(createButton(), "skip,split");
    relAwPanel.add(createButton());


    // Relative grid position with manual wrap
    MigLayout relWLM = new MigLayout("",
                                          "[100:pref,fill]",
                                          "[100:pref,fill]");
    JPanel relWPanel = createTabPanel(relWLM);
    relWPanel.add(createButton());
    relWPanel.add(createButton(), "skip");
    relWPanel.add(createButton(), "wrap");
    relWPanel.add(createButton(), "skip,wrap");
    relWPanel.add(createButton());
    relWPanel.add(createButton(), "skip,split");

    relWPanel.add(createButton());


    // Mixed relative and absolute grid position
    MigLayout mixLM = new MigLayout("",
                                    "[100:pref,fill]",
                                    "[100:pref,fill]");
    JPanel mixPanel = createTabPanel(mixLM);
    mixPanel.add(createButton());
    mixPanel.add(createButton(), "cell 2 0");
View Full Code Here

  private JComponent createPlainImpl(boolean debug)
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    MigLayout lm = new MigLayout((debug && benchRuns == 0 ? "debug, inset 20" : "ins 20"), "[para]0[][100lp, fill][60lp][95lp, fill]", "");
    JPanel panel = createTabPanel(lm);

    addSeparator(panel, "Manufacturer");

    panel.add(createLabel("Company"),      "skip");
View Full Code Here

    JTabbedPane tabbedPane = new JTabbedPane();

    for (int i = 0; i < 2; i++) {   // Jumping for 0 and Stable for 1
      String colConstr = i == 0 ? "[right][300]" : "[right, 100lp:pref][300]";

      MigLayout LM1 = new MigLayout("wrap", colConstr, "");
      JPanel panel1 = createTabPanel(LM1);
      panel1.add(createLabel("File Number:"));
      panel1.add(createTextField(""), "growx");
      panel1.add(createLabel("RFQ Number:"));
      panel1.add(createTextField(""), "growx");
      panel1.add(createLabel("Entry Date:"));
      panel1.add(createTextField(6));
      panel1.add(createLabel("Sales Person:"));
      panel1.add(createTextField(""), "growx");

      MigLayout LM2 = new MigLayout("wrap", colConstr, "");
      JPanel panel2 = createTabPanel(LM2);
      panel2.add(createLabel("Shipper:"));
      panel2.add(createTextField(6), "split 2");
      panel2.add(createTextField(""), "growx");
      panel2.add(createLabel("Consignee:"));
View Full Code Here

  public JComponent createComponent_Sizes()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    MigLayout LM = new MigLayout("wrap", "[right][0:pref,grow]", "");

    JPanel panel = createTabPanel(LM);
    JScrollPane descrText = createTextAreaScroll("Use slider to see how the components grow and shrink depending on the constraints set on them.", 0, 0, false);

    descrText.setOpaque(OPAQUE);
View Full Code Here

  public JComponent createCell_Alignments()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    // Horizontal
    MigLayout hLM = new MigLayout("wrap",
                                  "[grow,left][grow,center][grow,right][grow,fill,center]",
                                  "[]unrel[][]");
    JPanel hPanel = createTabPanel(hLM);
    String[] sizes = new String[] {"", "growx", "growx 0", "left", "center", "right", "leading", "trailing"};
    hPanel.add(createLabel("[left]"), "c");
    hPanel.add(createLabel("[center]"), "c");
    hPanel.add(createLabel("[right]"), "c");
    hPanel.add(createLabel("[fill,center]"), "c, growx 0");

    for (int r = 0; r < sizes.length; r++) {
      for (int c = 0; c < 4; c++) {
        String text = sizes[r].length() > 0 ? sizes[r] : "default";
        hPanel.add(createButton(text), sizes[r]);
      }
    }

    // Vertical
    MigLayout vLM = new MigLayout("wrap,flowy",
                                       "[right][]",
                                       "[grow,top][grow,center][grow,bottom][grow,fill,bottom][grow,fill,baseline]");
    JPanel vPanel = createTabPanel(vLM);
    String[] vSizes = new String[] {"", "growy", "growy 0", "top", "aligny center", "bottom"};
    vPanel.add(createLabel("[top]"), "aligny center");
View Full Code Here

  public JComponent createUnits()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    // Horizontal
    MigLayout hLM = new MigLayout("wrap,nocache",
                    "[right][]",
                    "");
    JPanel hPanel = createTabPanel(hLM);
    String[] sizes = new String[] {"72pt", "25.4mm", "2.54cm", "1in", "72px", "96px", "120px", "25%", "20sp"};
    for (int i = 0; i < sizes.length; i++) {
      hPanel.add(createLabel(sizes[i]));
      hPanel.add(createTextField(""), "width " + sizes[i] + "!");
    }

    // Horizontal lp
    MigLayout hlpLM = new MigLayout("nocache", "[right][][]", "");
    JPanel hlpPanel = createTabPanel(hlpLM);
    hlpPanel.add(createLabel("9 cols"));
    hlpPanel.add(createTextField(9));
    String[] lpSizes = new String[] {"75lp", "75px", "88px", "100px"};
    hlpPanel.add(createLabel("Width of createTextField(9)"), "wrap");
    for (int i = 0; i < lpSizes.length; i++) {
      hlpPanel.add(createLabel(lpSizes[i]));
      hlpPanel.add(createTextField(""), "width " + lpSizes[i] + "!, wrap");
    }

    // Vertical
    MigLayout vLM = new MigLayout("wrap,flowy,nocache",
                    "[c]",
                    "[top][top]");
    JPanel vPanel = createTabPanel(vLM);
    String[] vSizes = new String[] {"72pt", "25.4mm", "2.54cm", "1in", "72px", "96px", "120px", "25%", "20sp"};
    for (int i = 0; i < sizes.length; i++) {
      vPanel.add(createLabel(vSizes[i]));
      vPanel.add(createTextArea("", 0, 5), "width 50!, height " + vSizes[i] + "!");
    }

    // Vertical lp
    MigLayout vlpLM = new MigLayout("wrap,flowy,nocache",
                    "[c]",
                    "[top][top]40px[top][top]");
    JPanel vlpPanel = createTabPanel(vlpLM);
    vlpPanel.add(createLabel("4 rows"));
    vlpPanel.add(createTextArea("", 4, 5), "width 50!");
View Full Code Here

  public JComponent createGrouping()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    // Ungrouped
    MigLayout ugM = new MigLayout("", "[]push[][][]", "");
    JPanel ugPanel = createTabPanel(ugM);
    ugPanel.add(createButton("Help"));
    ugPanel.add(createButton("< Back"), "");
    ugPanel.add(createButton("Forward >"), "gap push");
    ugPanel.add(createButton("Apply"), "gap unrel");
    ugPanel.add(createButton("Cancel"), "gap unrel");

    // Grouped Components
    MigLayout gM = new MigLayout("nogrid, fillx");
    JPanel gPanel = createTabPanel(gM);
    gPanel.add(createButton("Help"), "sg");
    gPanel.add(createButton("< Back"), "sg,gap push");
    gPanel.add(createButton("Forward >"), "sg");
    gPanel.add(createButton("Apply"), "sg,gap unrel");
    gPanel.add(createButton("Cancel"), "sg,gap unrel");

    // Grouped Columns
    MigLayout gcM = new MigLayout("", "[sg,fill]push[sg,fill][sg,fill]unrel[sg,fill]unrel[sg,fill]", "");
    JPanel gcPanel = createTabPanel(gcM);
    gcPanel.add(createButton("Help"));
    gcPanel.add(createButton("< Back"));
    gcPanel.add(createButton("Forward >"));
    gcPanel.add(createButton("Apply"));
    gcPanel.add(createButton("Cancel"));

    // Ungrouped Rows
    MigLayout ugrM = new MigLayout();     // no "sg" is the only difference to next panel
    JPanel ugrPanel = createTabPanel(ugrM);
    ugrPanel.add(createLabel("File Number:"));
    ugrPanel.add(createTextField(30), "wrap");
    ugrPanel.add(createLabel("BL/MBL number:"));
    ugrPanel.add(createTextField(7), "split 2");
    ugrPanel.add(createTextField(7), "wrap");
    ugrPanel.add(createLabel("Entry Date:"));
    ugrPanel.add(createTextField(7), "wrap");
    ugrPanel.add(createLabel("RFQ Number:"));
    ugrPanel.add(createTextField(30), "wrap");
    ugrPanel.add(createLabel("Goods:"));
    ugrPanel.add(createCheck("Dangerous"), "wrap");
    ugrPanel.add(createLabel("Shipper:"));
    ugrPanel.add(createTextField(30), "wrap");
    ugrPanel.add(createLabel("Customer:"));
    ugrPanel.add(createTextField(""), "split 2,growx");
    ugrPanel.add(createButton("..."), "width 60px:pref,wrap");
    ugrPanel.add(createLabel("Port of Loading:"));
    ugrPanel.add(createTextField(30), "wrap");
    ugrPanel.add(createLabel("Destination:"));
    ugrPanel.add(createTextField(30), "wrap");

    // Grouped Rows
    MigLayout grM = new MigLayout("", "[]", "[sg]");    // "sg" is the only difference to previous panel
    JPanel grPanel = createTabPanel(grM);
    grPanel.add(createLabel("File Number:"));
    grPanel.add(createTextField(30),"wrap");
    grPanel.add(createLabel("BL/MBL number:"));
    grPanel.add(createTextField(7),"split 2");
View Full Code Here

  public JComponent createSpan()
  {
    JTabbedPane tabbedPane = new JTabbedPane();

    // Horizontal span
    MigLayout colLM = new MigLayout("nocache",
                                         "[fill][25%!,fill][105lp!,fill][100px!,fill]",
                                         "[]15[][]");
    JPanel colPanel = createTabPanel(colLM);
    colPanel.add(createTextField("Col1 [ ]"));
    colPanel.add(createTextField("Col2 [25%!]"));
    colPanel.add(createTextField("Col3 [105lp!]"));
    colPanel.add(createTextField("Col4 [100px!]"), "wrap");

    colPanel.add(createLabel("Full Name:"));
    colPanel.add(createTextField("span, growx", 40), "span,growx");

    colPanel.add(createLabel("Phone:"));
    colPanel.add(createTextField(5), "span 3, split 5");
    colPanel.add(createTextField(7));
    colPanel.add(createTextField(7));
    colPanel.add(createTextField(9));
    colPanel.add(createLabel("(span 3, split 4)"), "wrap");

    colPanel.add(createLabel("Zip/City:"));
    colPanel.add(createTextField(5));
    colPanel.add(createTextField("span 2, growx", 5), "span 2,growx");

    // Vertical span
    MigLayout rowLM = new MigLayout("wrap",
                                         "[225lp]para[225lp]",
                                         "[]3[]unrel[]3[]unrel[]3[]");
    JPanel rowPanel = createTabPanel(rowLM);
    rowPanel.add(createLabel("Name"));
    rowPanel.add(createLabel("Notes"));
View Full Code Here

TOP

Related Classes of net.miginfocom.swing.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.