コード例 #1
0
ファイル: LoginBox.java プロジェクト: WDCore/awstest
  public void createLayout() {
    GroupLayout layout = new GroupLayout(this.getContentPane());
    this.getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(lbUsername)
            .addComponent(tfUsername)
            .addComponent(lbPassword)
            .addComponent(tfPassword)
            .addComponent(btLogin));

    layout.linkSize(tfUsername, tfPassword);

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(lbUsername)
            .addComponent(tfUsername)
            .addComponent(lbPassword)
            .addComponent(tfPassword)
            .addGap(20)
            .addComponent(btLogin));
  }
コード例 #2
0
  private JPanel getPrefLayoutPnl() {
    if (prefLayoutPnl == null) {
      prefLayoutPnl = new JPanel();
      prefLayoutPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua

      final GroupLayout layout = new GroupLayout(prefLayoutPnl);
      prefLayoutPnl.setLayout(layout);
      layout.setAutoCreateGaps(true);
      layout.setAutoCreateContainerGaps(true);

      final JLabel label = new JLabel("Preferred Layout Algorithm:");

      layout.setHorizontalGroup(
          layout
              .createParallelGroup(Alignment.LEADING, true)
              .addComponent(label)
              .addComponent(getPrefAlgorithmCmb()));
      layout.setVerticalGroup(
          layout
              .createSequentialGroup()
              .addComponent(label, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
              .addComponent(getPrefAlgorithmCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    }

    return prefLayoutPnl;
  }
コード例 #3
0
  public startServer() {
    this.setSize(getPreferredSize());
    portNumber = new JTextField("");
    getContentPane().add(portNumber);
    portNumber.addActionListener(new portListener());

    typePort = new JLabel("-Please Type a Telnet Port Below-");
    getContentPane().add(typePort);

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(typePort, GroupLayout.Alignment.CENTER)
            .addComponent(portNumber, GroupLayout.Alignment.CENTER));

    layout.setVerticalGroup(
        layout.createSequentialGroup().addComponent(typePort).addComponent(portNumber));
    setSize(getPreferredSize());

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  }
コード例 #4
0
  private void initComponents() {
    final JPanel contentPane = new JPanel();
    final GroupLayout layout = new GroupLayout(contentPane);
    contentPane.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(Alignment.CENTER, true)
            .addComponent(getTabbedPane(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(getButtonPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(getTabbedPane(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(getButtonPnl(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));

    setContentPane(contentPane);

    LookAndFeelUtil.setDefaultOkCancelKeyStrokes(
        getRootPane(), getApplyBtn().getAction(), getDoneBtn().getAction());
    getRootPane().setDefaultButton(getApplyBtn());

    pack();
  }
コード例 #5
0
  private JPanel getSettingsPnl() {
    if (settingsPnl == null) {
      settingsPnl = new JPanel();
      settingsPnl.setAutoscrolls(true);
      settingsPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua

      final JLabel algoLbl = new JLabel("Layout Algorithm:");

      final GroupLayout layout = new GroupLayout(settingsPnl);
      settingsPnl.setLayout(layout);
      layout.setAutoCreateGaps(true);
      layout.setAutoCreateContainerGaps(true);

      layout.setHorizontalGroup(
          layout
              .createParallelGroup(Alignment.LEADING, true)
              .addComponent(algoLbl)
              .addComponent(getAlgorithmCmb())
              .addComponent(getAlgorithmPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
              .addComponent(getSettingsButtonPnl()));
      layout.setVerticalGroup(
          layout
              .createSequentialGroup()
              .addComponent(algoLbl)
              .addComponent(getAlgorithmCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
              .addComponent(getAlgorithmPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
              .addComponent(getSettingsButtonPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    }

    return settingsPnl;
  }
コード例 #6
0
ファイル: FrameLog.java プロジェクト: nschlimm/playground
  private JComponent buildPanel() {
    JPanel jpanel = new JPanel();

    JComponent textPart = buildTextPart();
    JComponent statusPart = buildStatusPart();
    JComponent buttonPart = buildButtonPart();

    GroupLayout layout =
        new GroupLayout(
            jpanel); // see http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html
    jpanel.setLayout(layout);

    layout.setAutoCreateGaps(true); // automatically add gaps between components
    layout.setAutoCreateContainerGaps(
        true); // automatically create gaps between components that touch the edge of the container
               // and the container.

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(textPart)
            .addComponent(statusPart)
            .addComponent(buttonPart));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(textPart)
            .addComponent(statusPart)
            .addComponent(buttonPart));

    return jpanel;
  }
コード例 #7
0
ファイル: MIPSGui.java プロジェクト: victal/mips
 private JPanel buttonsLayout() {
   JPanel panel = new JPanel();
   GroupLayout layout = new GroupLayout(panel);
   layout.setAutoCreateContainerGaps(true);
   layout.setAutoCreateGaps(true);
   panel.setLayout(layout);
   layout.setHorizontalGroup(
       layout
           .createParallelGroup(GroupLayout.Alignment.LEADING)
           .addGroup(
               layout
                   .createSequentialGroup()
                   .addComponent(play)
                   .addComponent(nextClock)
                   .addComponent(pause)
                   .addComponent(open))
           .addComponent(bypass));
   layout.setVerticalGroup(
       layout
           .createSequentialGroup()
           .addGroup(
               layout
                   .createParallelGroup(GroupLayout.Alignment.CENTER)
                   .addComponent(play)
                   .addComponent(nextClock)
                   .addComponent(pause)
                   .addComponent(open))
           .addComponent(bypass));
   Dimension d = new Dimension(220, panel.getHeight());
   panel.setSize(d);
   panel.setPreferredSize(d);
   return panel;
 }
コード例 #8
0
  // constructor for form
  private void initComponents() {
    // elements for error message
    errorMessage = new JLabel();
    errorMessage.setForeground(Color.RED);

    // elements for participant
    participantNameTextField = new JTextField();
    participantNameLabel = new JLabel();
    addParticipantButton = new JButton();

    // global settings & listeners
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("Event Registration");

    participantNameLabel.setText("Name: ");
    addParticipantButton.setText("Add Participant");
    addParticipantButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            addParticipantButtonActionPerformed(evt);
          }
        });

    // layout
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(errorMessage)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(participantNameLabel)
                    .addGroup(
                        layout
                            .createParallelGroup()
                            .addComponent(participantNameTextField, 200, 200, 400)
                            .addComponent(addParticipantButton))));

    layout.linkSize(
        SwingConstants.HORIZONTAL,
        new java.awt.Component[] {addParticipantButton, participantNameTextField});

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(errorMessage)
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(participantNameLabel)
                    .addComponent(participantNameTextField))
            .addComponent(addParticipantButton));

    pack();
  }
コード例 #9
0
  private void createLayout(JComponent... comps) {
    Container pane = getContentPane();
    GroupLayout gl = new GroupLayout(pane);
    pane.setLayout(gl);

    gl.setAutoCreateContainerGaps(true);
    gl.setAutoCreateGaps(true);

    gl.setHorizontalGroup(
        gl.createSequentialGroup()
            .addGroup(
                gl.createParallelGroup()
                    .addComponent(comps[0])
                    .addComponent(comps[1])
                    .addComponent(comps[2]))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(comps[3]));

    gl.setVerticalGroup(
        gl.createParallelGroup(GroupLayout.Alignment.CENTER)
            .addGroup(
                gl.createSequentialGroup()
                    .addComponent(comps[0])
                    .addComponent(comps[1])
                    .addComponent(comps[2]))
            .addComponent(comps[3]));

    // Forces the specified components to have the same size regardless of
    // their preferred, minimum or maximum sizes.
    gl.linkSize(redButton, greenButton, blueButton);

    pack();
  }
コード例 #10
0
ファイル: ClientGUI.java プロジェクト: dmendelsohn/6.005
  /** Initializes the GUI display for an instance of ClientGUI */
  private void createGUI() {
    Container panel = new Container();
    panel = this.getContentPane();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(bButton)
                    .addComponent(iButton)
                    .addComponent(uButton)
                    .addComponent(docSelect)
                    .addComponent(newDoc))
            .addComponent(scrollPane));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(bButton)
                    .addComponent(iButton)
                    .addComponent(uButton)
                    .addComponent(docSelect)
                    .addComponent(newDoc))
            .addComponent(scrollPane));
  }
コード例 #11
0
ファイル: Contact.java プロジェクト: brooktran/jeelee
  private void init() {
    btnOpen = new JButton("Open");
    btnOpen.setSize(100, 50);
    textArea = new JTextArea("sd");
    textArea.setSize(200, 100);
    textArea.setDragEnabled(true);

    btnOpen.addActionListener(new OpenAction());

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    } catch (ClassNotFoundException e) {
      // TODO 自动生成 catch 块
      e.printStackTrace();
    } catch (InstantiationException e) {
      // TODO 自动生成 catch 块
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO 自动生成 catch 块
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      // TODO 自动生成 catch 块
      e.printStackTrace();
    }
    Container container = getContentPane();
    GroupLayout groupLayout = new GroupLayout(container);
    container.setLayout(groupLayout);

    groupLayout.setAutoCreateContainerGaps(true);
    groupLayout.setAutoCreateGaps(true);
    // 左对齐
    GroupLayout.ParallelGroup p1 = groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
    p1.addComponent(btnOpen);
    p1.addComponent(textArea);
    // 水平
    groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup().addGroup(p1));

    GroupLayout.ParallelGroup v1 = groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
    v1.addComponent(btnOpen);

    GroupLayout.ParallelGroup v2 = groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
    v2.addComponent(textArea);

    GroupLayout.SequentialGroup vGroup = groupLayout.createSequentialGroup();
    vGroup.addGroup(v1).addGroup(v2);

    // 垂直
    groupLayout.setVerticalGroup(groupLayout.createSequentialGroup().addGroup(vGroup));

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("通讯录");
    setSize(300, 500);
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((dimension.width - getSize().width) / 2, (dimension.height - getSize().height) / 3);

    // pack();
    setVisible(true);
  }
コード例 #12
0
ファイル: FrameLog.java プロジェクト: nschlimm/playground
  private JComponent buildButtonPart() {
    JPanel jpanel = new JPanel();

    appendButton = new JButton("Append newest logs");
    appendButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            appendText(batchSeparator);
            appendText(handlerGui.getLogRecords());
            onLogsNewestDisplayed();
          }
        });
    appendButton.setEnabled(false);
    getRootPane().setDefaultButton(appendButton);

    replaceButton = new JButton("Replace with newest logs");
    replaceButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            jtextArea.setText(handlerGui.getLogRecords());
            onLogsNewestDisplayed();
          }
        });
    replaceButton.setEnabled(false);

    JButton suppressButton = new JButton("Suppress logs");
    suppressButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            new DialogMsgSuppress(FrameLog.this);
          }
        });

    GroupLayout layout =
        new GroupLayout(
            jpanel); // see http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html
    jpanel.setLayout(layout);

    layout.setAutoCreateGaps(true); // automatically add gaps between components
    layout.setAutoCreateContainerGaps(
        true); // automatically create gaps between components that touch the edge of the container
               // and the container.

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addComponent(appendButton)
            .addComponent(replaceButton)
            .addComponent(suppressButton));

    layout.setVerticalGroup(
        layout
            .createParallelGroup()
            .addComponent(appendButton)
            .addComponent(replaceButton)
            .addComponent(suppressButton));

    return jpanel;
  }
コード例 #13
0
 /** Layout the panel */
 private void layoutPanel() {
   GroupLayout gl = new GroupLayout(this);
   gl.setHonorsVisibility(false);
   gl.setAutoCreateGaps(false);
   gl.setAutoCreateContainerGaps(false);
   gl.setHorizontalGroup(createHorizontalGroup(gl));
   gl.setVerticalGroup(createVerticalGroup(gl));
   setLayout(gl);
 }
コード例 #14
0
  private void initUI() {

    JPanel jPanel = new JPanel();
    GroupLayout layout = new GroupLayout(jPanel);
    jPanel.setLayout(layout);

    statusBar = new JLabel("Zetcode");
    statusBar.setBorder(BorderFactory.createEtchedBorder());

    ButtonListener butlist = new ButtonListener();

    JButton closeButton = new JButton("Close");
    closeButton.addActionListener(butlist);
    closeButton.setPreferredSize(new Dimension(100, 50));

    JButton openButton = new JButton("Open");
    openButton.addActionListener(butlist);

    JButton findButton = new JButton("Find");
    findButton.addActionListener(butlist);

    JButton saveButton = new JButton("Save");
    saveButton.addActionListener(butlist);

    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addComponent(closeButton)
            .addComponent(openButton)
            .addComponent(findButton)
            .addComponent(saveButton)
            .addGap(230));

    layout.setVerticalGroup(
        layout
            .createParallelGroup()
            .addComponent(closeButton)
            .addComponent(openButton)
            .addComponent(findButton)
            .addComponent(saveButton)
            .addGap(200));

    layout.linkSize(closeButton, openButton, findButton, saveButton);

    add(jPanel, BorderLayout.CENTER);
    add(statusBar, BorderLayout.SOUTH);
    pack();

    setSize(new Dimension(1000, 1000));
    setTitle("Multiple Sources");
    setLocationRelativeTo(null);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
コード例 #15
0
  public UninstallationProgressDialogue(Window parent, Set<AddOn> addOns) {
    super(parent, true);

    keyBaseStatusMessage = "";
    listeners = Collections.emptyList();

    setTitle(Constant.messages.getString("cfu.uninstallation.progress.dialogue.title"));
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    int max = 0;
    for (AddOn addOn : addOns) {
      max += addOn.getFiles().size();
      max += addOn.getAscanrules().size();
      max += addOn.getPscanrules().size();
      max += addOn.getLoadedExtensions().size() * EXTENSION_UNINSTALL_WEIGHT;
    }

    getProgressBar().setValue(0);
    getProgressBar().setMaximum(max);

    getStatusLabel().setText(" ");
    getCustomLabel().setText(" ");

    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    layout.setHonorsVisibility(false);

    JLabel messageLabel =
        new JLabel(
            Constant.messages.getString("cfu.uninstallation.progress.dialogue.uninstalling"));

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(messageLabel)
            .addComponent(getStatusLabel())
            .addComponent(getProgressBar(), 200, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE)
            .addComponent(getCustomLabel()));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(messageLabel)
            .addComponent(getStatusLabel())
            .addComponent(getProgressBar())
            .addComponent(getCustomLabel()));

    setContentPane(panel);
    pack();
  }
コード例 #16
0
ファイル: ChessBoard.java プロジェクト: rajiv256/CodingIsFun
  /** Initialises the graphical components of the chess board */
  private void initComponents() {
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    GroupLayout layout = new GroupLayout(getContentPane());
    setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    // Initialise components
    Component jPanel0 = getJPanel0();
    Component jComboBoxSize = getJComboBoxSize();
    Component jComboBoxRow = getJComboBoxRow();
    Component jComboBoxColumn = getJComboBoxColumn();
    Component drawButton = getDrawButton();
    Component playButton = getPlayButton();
    Component solutionButton = getSolutionButton();
    Component stopButton = getStopButton();
    Component performanceCounterLabel = getPerformanceCounterLabel();

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addComponent(jPanel0)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(jComboBoxSize, 10, 50, 100)
                    .addComponent(jComboBoxColumn, 10, 50, 100)
                    .addComponent(jComboBoxRow, 10, 50, 100)
                    .addComponent(drawButton, 10, 50, 100)
                    .addComponent(playButton, 10, 50, 100)
                    .addComponent(solutionButton, 10, 50, 100)
                    .addComponent(stopButton, 10, 50, 100)
                    .addComponent(performanceCounterLabel, 30, 50, 100)));

    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(jPanel0)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(jComboBoxSize, 5, 15, 20)
                    .addComponent(jComboBoxColumn, 5, 15, 20)
                    .addComponent(jComboBoxRow, 5, 15, 20)
                    .addComponent(drawButton, 5, 15, 20)
                    .addComponent(playButton, 5, 15, 20)
                    .addComponent(solutionButton, 5, 15, 20)
                    .addComponent(stopButton, 5, 15, 20)
                    .addComponent(performanceCounterLabel, 5, 15, 20)
                    .addContainerGap()));

    setSize(800, 600);
  }
コード例 #17
0
  private void initComponents() {
    filterField = new JComboBox();
    createSortField();
    createFilterText();
    ascending = new JCheckBox("Ascending (uncheck = Descending)");
    JLabel filterLabel = new JLabel("Filter:");
    JLabel sortLabel = new JLabel("Sort:");

    filterField.setModel(new DefaultComboBoxModel(Task.getFields()));
    sortField.setModel(new DefaultComboBoxModel(Task.getFields()));
    ascending.setSelected(true);

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.TRAILING)
                    .addComponent(filterLabel)
                    .addComponent(sortLabel))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(filterField)
                    .addComponent(sortField))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(filterText)
                    .addComponent(ascending)));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(filterLabel)
                    .addComponent(filterField)
                    .addComponent(filterText))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(sortLabel)
                    .addComponent(sortField)
                    .addComponent(ascending)));
  }
コード例 #18
0
 private void setLayout() {
   GroupLayout layout = new GroupLayout(dialog.getContentPane());
   dialog.getContentPane().setLayout(layout);
   dialog.setResizable(true);
   layout.setAutoCreateContainerGaps(true);
   layout.setHorizontalGroup(layout.createParallelGroup().addComponent(tabbedPane));
   layout.setVerticalGroup(layout.createParallelGroup().addComponent(tabbedPane));
   layout.setHonorsVisibility(tabbedPane, true);
   // TODO set color here
   dialog.getContentPane().setBackground(new Color(0x132638));
   dialog.validate();
   dialog.repaint();
 }
コード例 #19
0
ファイル: PlayBarView.java プロジェクト: stephysim/BitMusic
  @Override
  public void initPanel() {
    System.out.println("--- PlayBarView.initPanel()");

    final Dimension d = new Dimension(40, 10);

    this.playButton.setSize(d);
    this.stopButton.setSize(d);
    this.downloadButton.setSize(d);

    /*GridLayout layout = new GridLayout(0,2);
    this.getPanel().setLayout(layout);
    this.getPanel().add(this.stopButton);
    this.getPanel().add(this.playButton);
    this.getPanel().add(this.downloadButton);*/
    GroupLayout layout = new GroupLayout(this.getPanel());
    this.getPanel().setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addComponent(this.stopButton)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(this.playButton))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(this.downloadButton)));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(this.stopButton)
                    .addComponent(this.playButton)
                    .addComponent(this.downloadButton)));

    layout.linkSize(SwingConstants.HORIZONTAL, this.playButton, this.stopButton);
    layout.linkSize(SwingConstants.HORIZONTAL, this.playButton, this.downloadButton);

    // TODO
  }
コード例 #20
0
ファイル: MainFrame.java プロジェクト: tim-vbn/Builder
  public MainFrame() {
    super("P2 Auto Update and Automatic Build Test");

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      System.out.println("Error loading System Look and Feel: " + e.getMessage());
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } catch (Exception ex) {
        System.out.println("Error loading CrossPlatform Look and Feel: " + e.getMessage());
      }
    }

    LabelOne one = new LabelOne();
    LabelTwo two = new LabelTwo();
    LabelThree three = new LabelThree();
    LabelFour four = new LabelFour();

    JPanel mainPanel = new JPanel();
    GroupLayout layout = new GroupLayout(mainPanel);
    mainPanel.setLayout(layout);

    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(one)
            .addComponent(two)
            .addComponent(three)
            .addComponent(four));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(one)
            .addComponent(two)
            .addComponent(three)
            .addComponent(four));

    this.addWindowListener(this);

    this.add(mainPanel);
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    this.pack();
    this.setVisible(true);
  }
コード例 #21
0
ファイル: SliderEx.java プロジェクト: ernesto1989/JavaGui
  private void createLayout(JComponent... arg) {

    Container pane = getContentPane();
    GroupLayout gl = new GroupLayout(pane);
    pane.setLayout(gl);

    gl.setAutoCreateContainerGaps(true);
    gl.setAutoCreateGaps(true);

    gl.setHorizontalGroup(gl.createSequentialGroup().addComponent(arg[0]).addComponent(arg[1]));

    gl.setVerticalGroup(gl.createParallelGroup(CENTER).addComponent(arg[0]).addComponent(arg[1]));

    pack();
  }
コード例 #22
0
ファイル: StatusPanel.java プロジェクト: asmigala/BQT_GUI
  private void init() {
    status = new JTextField();
    status.setEditable(false);
    status.setFont(status.getFont().deriveFont(Font.BOLD, 20));
    status.setBorder(new EtchedBorder(EtchedBorder.RAISED));
    statusLabel = new JLabel(title);

    GroupLayout gl = new GroupLayout(this);
    gl.setAutoCreateContainerGaps(false);
    gl.setAutoCreateGaps(true);
    gl.setVerticalGroup(
        gl.createSequentialGroup().addComponent(statusLabel).addComponent(status, 35, 35, 35));
    gl.setHorizontalGroup(gl.createParallelGroup().addComponent(statusLabel).addComponent(status));
    setLayout(gl);
  }
コード例 #23
0
ファイル: MainWindow.java プロジェクト: kornicameister/Mabis
  @Override
  public void layoutComponents() {
    // adding content jpanel
    this.contentPane = new JPanel(true);
    this.contentPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    this.setContentPane(this.contentPane);

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    this.bottomPanel.setBorder(BorderFactory.createEtchedBorder());

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(Alignment.CENTER)
            .addComponent(
                this.toolBar, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        this.collectionView,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE))
            .addComponent(
                this.bottomPanel,
                GroupLayout.DEFAULT_SIZE,
                GroupLayout.DEFAULT_SIZE,
                Short.MAX_VALUE));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(this.toolBar, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
            .addGroup(
                layout.createParallelGroup(Alignment.BASELINE).addComponent(this.collectionView))
            .addComponent(
                this.bottomPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, 50));

    this.repaint();
    this.pack();
  }
コード例 #24
0
ファイル: NavigationBar.java プロジェクト: hifi-dd/open-ecard
  private void initializeLayout() {
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(false);

    GroupLayout.SequentialGroup hg = layout.createSequentialGroup();
    hg.addComponent(backButton, 60, 60, 150);
    hg.addComponent(nextButton, 60, 60, 150);
    hg.addComponent(cancelButton, 60, 60, 150);
    layout.setHorizontalGroup(hg);

    GroupLayout.ParallelGroup vg = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
    vg.addComponent(backButton);
    vg.addComponent(nextButton);
    vg.addComponent(cancelButton);
    layout.setVerticalGroup(vg);
  }
コード例 #25
0
  private JScrollPane makeTab(String type) {
    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    panel.setLayout(layout);

    JScrollPane scroll =
        new JScrollPane(
            panel,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setLayout(new ScrollPaneLayout());

    SequentialGroup sg = layout.createSequentialGroup();
    ParallelGroup pg = layout.createParallelGroup();

    String editString = "Edit " + type + "s";
    JButton editType = new JButton(editString);

    editType.addActionListener(new EditListener(myWorldManager, type, this));

    sg.addComponent(editType);
    pg.addComponent(editType);

    List<String> tileNames = myWorldManager.getNames(type);
    for (int n = 0; n < tileNames.size(); n++) {
      GameObjectPanel gop =
          new GameObjectPanel(type, myWorldManager.getImage(type, n), tileNames.get(n), this);
      panel.add(gop);
      sg.addComponent(gop, 50, 50, 50);
      pg.addComponent(gop, 170, 170, 170);
    }
    layout.setVerticalGroup(sg);
    layout.setHorizontalGroup(pg);
    panel.revalidate();
    panel.repaint();
    scroll.setMaximumSize(new Dimension(200, 500));
    return scroll;
  }
コード例 #26
0
ファイル: WebcamChooser.java プロジェクト: jsnee/Cataracta
  public WebcamChooser() {
    JPanel selectPanel = new JPanel();

    GroupLayout layout = new GroupLayout(selectPanel);
    selectPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    picker.setSelectedIndex(0);

    camPanel = new WebcamPanel(picker.getSelectedWebcam());
    camPanel.setBorder(BorderFactory.createTitledBorder("Preview"));

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addComponent(camPanel)
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(new JLabel("Webcam:"))
                            .addComponent(picker)))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)));

    //		selectPanel.add(new JLabel("Select A Webcam: "));
    //		this.setIconImage(new ImageIcon(homeDir + "/res/big-droplet.gif").getImage());
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setLayout(new BorderLayout());
    this.add(selectPanel, BorderLayout.CENTER);
    this.pack();

    this.setResizable(true);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
  }
コード例 #27
0
ファイル: OAClient.java プロジェクト: sangyuruo/myopenjava
  @Deprecated
  public void layoutButtons() {
    createLoginButton();
    createHomeButton();
    Container pane = getContentPane();
    GroupLayout gl = new GroupLayout(pane);
    pane.setLayout(gl);

    SequentialGroup horizontalGroup = gl.createSequentialGroup();
    SequentialGroup verticalGroup = gl.createSequentialGroup();
    horizontalGroup.addComponent(loginButton);
    horizontalGroup.addComponent(homeButton);
    verticalGroup.addComponent(loginButton);
    verticalGroup.addComponent(homeButton);

    gl.setAutoCreateContainerGaps(true);
    gl.setHorizontalGroup(horizontalGroup);
    gl.setVerticalGroup(verticalGroup);
    // gl.setHorizontalGroup(gl.createSequentialGroup().addComponent(
    // homeButton));
    // gl.setVerticalGroup(gl.createSequentialGroup().addComponent(homeButton));
  }
コード例 #28
0
  /**
   * Universally creates layout for dialog.
   *
   * @param jcs
   */
  protected final void createLayout(JComponent... jcs) {
    Container pane = getContentPane();
    GroupLayout gl = new GroupLayout(pane);
    pane.setLayout(gl);

    gl.setAutoCreateContainerGaps(true);
    gl.setAutoCreateGaps(true);

    GroupLayout.ParallelGroup pg = gl.createParallelGroup(CENTER);

    for (JComponent jc : jcs) {
      pg.addComponent(jc).addGap(200);
    }
    gl.setHorizontalGroup(pg);

    GroupLayout.SequentialGroup sg = gl.createSequentialGroup();

    for (JComponent jc : jcs) {
      sg.addGap(30).addComponent(jc).addGap(20);
    }
    gl.setVerticalGroup(sg);

    pack();
  }
コード例 #29
0
  /**
   * Adds elements to a JPanel
   *
   * @param panel
   */
  public void layout() {
    // Add elements to a JPanel
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(instruction)
            .addComponent(error)
            .addComponent(styles)
            .addComponent(next));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(instruction)
            .addComponent(error)
            .addComponent(styles)
            .addComponent(next));
    panel.repaint();
  }
コード例 #30
0
ファイル: InputFileCard.java プロジェクト: koyousun/iMRMC
  /**
   * Sole constructor. Creates and initializes GUI elements <br>
   * <br>
   * CALLED BY: {@link mrmc.gui.GUInterface#GUInterface GUInterface constructor}
   *
   * @param CardInputModeImrmc Panel containing elements for raw study input card
   * @param GUInterface_temp Application's instance of the GUI
   */
  public InputFileCard(JPanel CardInputModeImrmc, GUInterface GUInterface_temp) {
    GUI = GUInterface_temp;
    InputFile1 = GUI.InputFile1;
    DBRecordStat = GUI.DBRecordStat;
    DBRecordSize = GUI.DBRecordSize;

    /*
     * Elements of RawStudyCardRow1
     */
    // Browse for input file
    JLabel studyLabel = new JLabel(".imrmc or .csv file  ");
    JTextFilename = new JTextField(20);
    JButton browseButton = new JButton("Browse...");
    browseButton.addActionListener(new brwsButtonListener());
    // Show plots of Cases Per Reader and Readers Per Case
    JButton readerCasesButton = new JButton("Input Statistics Charts");
    readerCasesButton.addActionListener(new ReadersCasesButtonListener());
    // Show reader x case image of design matrix for selected modality
    JButton designButton = new JButton("Show Study Design");
    designButton.addActionListener(new designButtonListener());
    // Show ROC curves for selected modality
    JButton ROCcurveButton = new JButton("Show ROC Curve");
    ROCcurveButton.addActionListener(new ROCButtonListener());
    /*
     * Create RawStudyCardRow2
     */
    JPanel RawStudyCardRow1 = new JPanel();
    RawStudyCardRow1.add(studyLabel);
    RawStudyCardRow1.add(JTextFilename);
    RawStudyCardRow1.add(browseButton);
    RawStudyCardRow1.add(readerCasesButton);
    RawStudyCardRow1.add(designButton);
    RawStudyCardRow1.add(ROCcurveButton);

    /*
     * Elements of RawStudyCardRow2
     */
    // MLE Checkbox
    mleCheckBox = new JCheckBox("MLE (avoid negatives)");
    mleCheckBox.setSelected(false);
    mleCheckBox.addItemListener(new UseMLEListener());
    // Drop down menus to select modality
    chooseA = new JComboBox<String>();
    chooseB = new JComboBox<String>();
    chooseA.addItemListener(new ModalitySelectListener());
    chooseB.addItemListener(new ModalitySelectListener());
    // execute variance analysis button
    varAnalysisButton = new JButton("MRMC Variance Analysis");
    varAnalysisButton.addActionListener(new varAnalysisListener());
    // show the reader AUCs
    showAUCsButton = new JButton("Show Reader AUCs");
    showAUCsButton.addActionListener(new showAUCsButtonListener());
    /*
     * Create RawStudyCardRow2
     */
    JPanel RawStudyCardRow2 = new JPanel();
    RawStudyCardRow2.add(mleCheckBox);
    RawStudyCardRow2.add(chooseA);
    RawStudyCardRow2.add(chooseB);
    RawStudyCardRow2.add(varAnalysisButton);
    RawStudyCardRow2.add(showAUCsButton);

    /*
     * Initialize InputFileCard
     */
    resetInputFileCard();

    /*
     * Create the layout of the card
     */
    GroupLayout layout = new GroupLayout(CardInputModeImrmc);
    CardInputModeImrmc.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING) // Parallel=Vertical?
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(RawStudyCardRow1)) // Sequential=Horizontal
                    .addGroup(
                        layout
                            .createSequentialGroup()
                            .addComponent(RawStudyCardRow2)))); // Sequential=Horizontal

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE) // Parallel=Horizontal?
                    .addComponent(RawStudyCardRow1))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING) // Parallel=Horizontal?
                    .addComponent(RawStudyCardRow2)));
  }