Esempio n. 1
0
  @Override
  protected void layoutComponents() {
    batchPanel = new JPanel();
    batchPanel.setLayout(new GridBagLayout());

    GridBagConstraintsExt c = new GridBagConstraintsExt();
    c.ipadx = 2;
    c.ipady = 2;
    c.insets = new Insets(5, 5, 5, 5);

    c.place(0, 1, 1, 1);
    batchPanel.add(entryDateLabel, c);

    c.place(1, 1, 2, 1);
    batchPanel.add(entryDateSpinner, c);

    c.place(3, 1, 1, 1);
    batchPanel.add(countLabel, c);

    c.place(4, 1, 1, 1);
    batchPanel.add(countField, c);

    c.place(0, 0, 1, 1);
    batchPanel.add(barcodeLabel, c);

    c.place(1, 0, 2, 1);
    batchPanel.add(barcodeField, c);

    c.place(3, 0, 2, 1);
    batchPanel.add(scannerBox, c);

    c.place(1, 2, 1, 1);
    batchPanel.add(itemActionButton, c);

    c.place(2, 2, 1, 1);
    batchPanel.add(undoButton, c);

    c.place(3, 2, 1, 1);
    batchPanel.add(redoButton, c);

    c.place(4, 2, 1, 1);
    batchPanel.add(doneButton, c);

    setMaximumSize(batchPanel);

    productPanel = new JPanel();
    productPanel.setLayout(new BoxLayout(productPanel, BoxLayout.Y_AXIS));

    productPanel.add(Box.createRigidArea(new Dimension(10, 10)));
    productPanel.add(batchPanel);
    productPanel.add(Box.createRigidArea(new Dimension(10, 10)));
    productPanel.add(productTableScrollPane);

    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, productPanel, itemTableScrollPane);

    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.add(splitPane);
  }
Esempio n. 2
0
  public void buildPopulationBox() {
    rebuilding = true;
    populationBox.removeAll();
    peopleList = new ArrayList<Object>();
    famList = new ArrayList<Family>();
    peopleList.addAll(ctxt.individualCensus);
    String plur = (peopleList.size() == 1 ? "" : "s");
    populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS));
    populationBox.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Current Population"));
    populationBox.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(8, 0)));
    indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur);
    indivLabel.setAlignmentX(0.5f);
    populationBox.add(indivLabel);
    if (peopleList.size() > 0) {
      JPanel indivBtnBox = new JPanel();
      indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] indMenu = genIndMenu(peopleList);
      indPick = new JComboBox(indMenu);
      indPick.addActionListener(listener);
      indPick.setActionCommand("view/edit person");
      indPick.setMinimumSize(sizer2);
      indPick.setMaximumSize(sizer2);
      indPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Person"));
      indivBtnBox.add(indPick);
      populationBox.add(indivBtnBox);
    } //  end of if-any-people-exist

    famList.addAll(ctxt.familyCensus); //  end of filtering deleted records
    plur = (famList.size() == 1 ? "y" : "ies");
    famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur);
    famLabel.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(0, 4)));
    populationBox.add(famLabel);
    if (famList.size() > 0) {
      JPanel famBtnBox = new JPanel();
      famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] famMenu = genFamMenu(famList);
      famPick = new JComboBox(famMenu);
      famPick.addActionListener(listener);
      famPick.setActionCommand("view/edit family");
      famPick.setMinimumSize(sizer2);
      famPick.setMaximumSize(sizer2);
      famPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Family"));
      famBtnBox.add(famPick);
      populationBox.add(famBtnBox);
    } //  end of if-any-families-exist
    rebuilding = false;
  } //  end of method buildPopulationBox
Esempio n. 3
0
  /** Constructor. */
  public TilePatternsView() {
    super();

    tilePatternIcons = new ArrayList<TilePatternIcon>();

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // tileset properties
    // the tile pattern list
    // view of the current tile pattern

    // tileset properties
    tilesetPropertiesView = new TilesetPropertiesView();
    tilesetPropertiesView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120));
    tilesetPropertiesView.setAlignmentX(Component.LEFT_ALIGNMENT);

    // list
    tilePatternsListModel = new TilePatternsListModel();
    tilePatternsList = new JList(tilePatternsListModel);
    tilePatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tilePatternsList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    tilePatternsList.setVisibleRowCount(-1); // make the rows as wide as possible
    tilePatternsList
        .getSelectionModel()
        .addListSelectionListener(new TilePatternListSelectionListener());
    tilePatternsList.setCellRenderer(new TilePatternListRenderer());

    tilePatternsList.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_DELETE) {
              if (tileset != null && tileset.getSelectedTilePattern() != null) {
                tileset.removeTilePattern();
              }
            }
          }
        });

    JScrollPane listScroller = new JScrollPane(tilePatternsList);
    listScroller.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    listScroller.setAlignmentX(Component.LEFT_ALIGNMENT);

    // tile view
    tilePatternView = new TilePatternView();
    tilePatternView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 300));
    tilePatternView.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(tilesetPropertiesView);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(listScroller);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(tilePatternView);
  }
Esempio n. 4
0
  public RollResultView() {

    this.setOpaque(true);
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createLineBorder(Color.black, BORDER_WIDTH));

    // add the title label to the panel
    titleLabel = new JLabel("Roll Results");
    Font titleLabelFont = titleLabel.getFont();
    titleLabelFont = titleLabelFont.deriveFont(titleLabelFont.getStyle(), TITLE_TEXT_SIZE);
    titleLabel.setFont(titleLabelFont);
    this.add(titleLabel, BorderLayout.NORTH);

    // add the button to the panel
    okayButton = new JButton("Okay");
    okayButton.addActionListener(actionListener);
    Font okayButtonFont = okayButton.getFont();
    okayButtonFont = okayButtonFont.deriveFont(okayButtonFont.getStyle(), BUTTON_TEXT_SIZE);
    okayButton.setFont(okayButtonFont);
    this.add(okayButton, BorderLayout.SOUTH);

    // create the rollLabel
    rollLabel =
        new JLabel(
            "ERROR: YOU FORGOT TO SET THE ROLL VALUE BEFORE DISPLAYING THIS WINDOW... NAUGHTY, NAUGHTY");
    Font rollLabelFont = rollLabel.getFont();
    rollLabelFont = rollLabelFont.deriveFont(rollLabelFont.getStyle(), LABEL_TEXT_SIZE);
    rollLabel.setFont(rollLabelFont);
    rollLabel.setHorizontalAlignment(SwingConstants.CENTER);
    rollLabel.setBorder(BorderFactory.createEmptyBorder(25, 0, 25, 0));

    // create the picture
    picture =
        new ImageIcon(
            ImageUtils.loadImage("images/resources/resources.png")
                .getScaledInstance(250, 250, Image.SCALE_SMOOTH));
    pictureLabel = new JLabel();
    pictureLabel.setIcon(picture);

    // create the center label
    centerPanel = new JPanel();
    centerPanel.setLayout(new BorderLayout());
    centerPanel.add(pictureLabel, BorderLayout.NORTH);
    centerPanel.add(Box.createRigidArea(new Dimension(25, 25)));
    centerPanel.add(rollLabel, BorderLayout.SOUTH);
    this.add(centerPanel, BorderLayout.CENTER);

    // add some spacing
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.EAST);
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.WEST);
  }
Esempio n. 5
0
  // Create the primary panel with sub panels.
  private void createMainPanel() {

    // Create the panels in each tab.
    JPanel capturePanel = createCapturePanel();
    JPanel replayPanel = createReplayPanel();

    // Create the tabs and add the new panels to them.
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Capture", capturePanel);
    tabbedPane.addTab("Replay", replayPanel);

    // Create the buttons that always show to select app.
    JPanel topButtons = new JPanel();
    topButtons.setLayout(new BoxLayout(topButtons, BoxLayout.X_AXIS));
    JButton selectApp = new JButton("Select Application");
    JLabel selectedApp = new JLabel("Selected App: ");
    appName = new JLabel();
    topButtons.add(selectApp);
    topButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    topButtons.add(selectedApp);
    topButtons.add(appName);

    selectApp.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            displayAppFrame();
          }
        });

    // Add the buttons and tab structure.
    add(topButtons, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
  }
Esempio n. 6
0
  /**
   * Creates the button panel with the query and reset buttons in a box layout.
   *
   * @return The constructed button panel.
   */
  public JPanel createButtonPane() {
    // Set up the panel.
    buttonPane = new JPanel();
    queryBtn = new JButton("Query");

    // Create and add action listener to query and reset buttons.
    queryBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            parentCS.requestQuery(2, catCb1.getSelectedIndex(), catCb2.getSelectedIndex());
          }
        });
    resetBtn = new JButton("Reset");
    resetBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            parentCS.switchContext(-1);
          }
        });

    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));

    // Add buttons to panel.
    buttonPane.add(queryBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(resetBtn);

    return buttonPane;
  }
 public ModeConfigurationPanel(String mode) {
   this.mode = mode;
   notes = new NotePlayerConfigurationPanel();
   parameters = new CombinedParameterConfigurationPanel();
   setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   add(notes);
   add(Box.createRigidArea(new Dimension(10, 0)));
   add(parameters);
 }
Esempio n. 8
0
  /** Constructor */
  public WPart11Dialog() {
    super(null);
    setVisible(false);

    m_pnlDisplay = new JPanel();
    m_pcsTypesMgr = new PropertyChangeSupport(this);
    JScrollPane spDisplay = new JScrollPane(m_pnlDisplay);
    m_pnlDisplay.setLayout(new WGridLayout(0, 2));
    addComp(spDisplay);
    initBlink();

    buttonPane.removeAll();
    // Add the buttons to the panel with space between buttons.
    m_btnChecksum = new JButton("Make new checksum");
    buttonPane.add(m_btnChecksum);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(validateButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(closeButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(abandonButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(helpButton);
    setHelpEnabled(false);

    closeButton.setActionCommand("close");
    closeButton.addActionListener(this);
    validateButton.setActionCommand("validate");
    validateButton.addActionListener(this);
    abandonButton.setActionCommand("cancel");
    abandonButton.addActionListener(this);
    helpButton.setActionCommand("help");
    helpButton.addActionListener(this);
    m_btnChecksum.setActionCommand("checksum");
    m_btnChecksum.addActionListener(this);

    setCloseEnabled(true);
    setAbandonEnabled(true);

    setTitle("Configuration");
    setLocation(300, 500);
    setResizable(true);
    setSize(450, 300);
  }
Esempio n. 9
0
  // constructor of TextFrame
  public TextFrame() {
    // this.message = message;
    message = "Click to Edit Text";
    messageFont = new Font("Arial", Font.PLAIN, 30);
    foreground = Color.black;
    background = Color.white;

    // custom dialog (it's a private class inside TextFrame)
    cd = new CustomDialog(this);

    messageField = new JTextField();
    messageField.setPreferredSize(new Dimension(300, 200));
    messageField.setEditable(false);
    messageField.setHorizontalAlignment(SwingConstants.CENTER);
    messageField.setAlignmentX(Component.CENTER_ALIGNMENT);
    updateMessage();

    customize = new JButton("Customize");
    customize.setMaximumSize(customize.getPreferredSize());
    customize.setAlignmentX(Component.CENTER_ALIGNMENT);

    apply = new JButton("Apply");
    apply.setMaximumSize(customize.getPreferredSize());
    apply.setAlignmentX(Component.CENTER_ALIGNMENT);

    /*add the listeners*/
    customize.addActionListener(this);
    apply.addActionListener(this);
    messageField.addMouseListener(new PopUpClass());

    // customize
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(customize);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(messageField);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(apply);
    p.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));

    // make panel this JFrame's content pane

    this.setContentPane(p);
  }
Esempio n. 10
0
  public ComboBoxDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    String[] patternExamples = {
      "dd MMMMM yyyy",
      "dd.MM.yy",
      "MM/dd/yy",
      "yyyy.MM.dd G 'at' hh:mm:ss z",
      "EEE, MMM d, ''yy",
      "h:mm a",
      "H:mm:ss:SSS",
      "K:mm a,z",
      "yyyy.MMMMM.dd GGG hh:mm aaa"
    };

    currentPattern = patternExamples[0];

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setEditable(true);
    patternList.addActionListener(this);

    // Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    reformat();
  } // constructor
Esempio n. 11
0
 public ButtonPanel(String scanButtonLabel, String resetButtonLabel) {
   super();
   scanButton = new JButton(scanButtonLabel);
   scanButton.setPreferredSize(SIZE);
   add(scanButton);
   add(Box.createRigidArea(MARGIN));
   resetButton = new JButton(resetButtonLabel);
   resetButton.setPreferredSize(SIZE);
   add(resetButton);
 }
  public static void graphicSetup(DecisionPromptEditor toBuild) {

    toBuild.setLayout(new BoxLayout(toBuild, BoxLayout.PAGE_AXIS));

    JPanel row = new JPanel();
    row.setLayout(new BoxLayout(row, BoxLayout.LINE_AXIS));

    toBuild.add(row);
    toBuild.add(Box.createRigidArea(new Dimension(0, 10)));
  }
Esempio n. 13
0
  /**
   * Update the dialog contents.
   *
   * @param jheader The job portion of the dialog header.
   * @param job The queue job.
   * @param info The current job status information.
   */
  public void updateContents(
      String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) {
    ActionAgenda agenda = job.getActionAgenda();
    QueueJobResults results = info.getResults();

    String dir = "-";
    if ((agenda != null) && (info.getOsType() != null))
      dir = agenda.getTargetPath(info.getOsType()).toString();

    String hostname = "";
    if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]");

    String command = "-";
    if (details != null) command = details.getCommand();

    TreeMap<String, String> env = new TreeMap<String, String>();
    if (details != null) env = details.getEnvironment();

    setHeader("Execution Details -" + jheader + hostname);

    pWorkingDirField.setText(dir);

    BaseAction action = job.getAction();
    pCommandLineLabel.setText(
        "Action Command:  " + action.getName() + " (v" + action.getVersionID() + ")");
    pCommandLineArea.setText(command);

    {
      Component comps[] = UIFactory.createTitledPanels();
      {
        JPanel tpanel = (JPanel) comps[0];
        JPanel vpanel = (JPanel) comps[1];

        if (!env.isEmpty()) {
          String last = env.lastKey();
          for (String key : env.keySet()) {
            String value = env.get(key);

            JTextField field =
                UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize);
            field.setHorizontalAlignment(JLabel.LEFT);

            if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
          }
        } else {
          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }
      }

      pEnvLabel.setText("Toolset Environment:  " + agenda.getToolset());
      pEnvScroll.setViewportView(comps[2]);
    }
  }
  public JPanel createContentPane() {

    // We create a bottom JPanel to place everything on.
    JPanel totalGUI = new JPanel();

    // We set the layout of the main JPanel to be BoxLayout.
    // LINE_AXIS sets them left to right, PAGE_AXIS sets them
    // from top to bottom.
    totalGUI.setLayout(new BoxLayout(totalGUI, BoxLayout.LINE_AXIS));

    JPanel redPanel = new JPanel();
    redPanel.setBackground(Color.red);
    redPanel.setMinimumSize(new Dimension(50, 50));
    redPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(redPanel);

    // This is the first spacer. This creates a spacer 10px wide that
    // will never get bigger or smaller.
    totalGUI.add(Box.createRigidArea(new Dimension(10, 0)));

    JPanel yellowPanel = new JPanel();
    yellowPanel.setBackground(Color.yellow);
    yellowPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(yellowPanel);

    // This spacer takes any spare space and places it as part of the spacer
    // If you drag the window wider, the space will get wider.
    totalGUI.add(Box.createHorizontalGlue());

    JPanel greenPanel = new JPanel();
    greenPanel.setBackground(Color.green);
    greenPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(greenPanel);

    // This spacer is a custom spacer.
    // The minimum size acts like a rigid area that
    // will not get any smaller than 10 pixels on the x-axis (horizontal)
    // and not get any smaller than 50 pixels on the y axis (vertical).
    // The way the maximum size is set up means the spacer acts like glue
    // and will expand to fit the available space.

    Dimension minSize = new Dimension(10, 50);
    Dimension prefSize = new Dimension(10, 50);
    Dimension maxSize = new Dimension(Short.MAX_VALUE, 50);
    totalGUI.add(new Box.Filler(minSize, prefSize, maxSize));

    JPanel bluePanel = new JPanel();
    bluePanel.setBackground(Color.blue);
    bluePanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(bluePanel);

    totalGUI.setOpaque(true);
    return totalGUI;
  }
Esempio n. 15
0
  /** OptionPaneDemo Constructor */
  public OptionPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "OptionPaneDemo", "toolbar/JOptionPane.gif");

    JPanel demo = getDemoPanel();

    demo.setLayout(new BoxLayout(demo, BoxLayout.X_AXIS));

    JPanel bp =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));

    bp.add(Box.createRigidArea(VGAP30));
    bp.add(Box.createRigidArea(VGAP30));

    bp.add(createInputDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createWarningDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createMessageDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createComponentDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createConfirmDialogButton());
    bp.add(Box.createVerticalGlue());

    demo.add(Box.createHorizontalGlue());
    demo.add(bp);
    demo.add(Box.createHorizontalGlue());
  }
Esempio n. 16
0
  /**
   * Creates the query panel and returns it to the content pane to be added.
   *
   * @return The constructed query panel.
   */
  public JPanel createQueryPane() {
    // Set up the panel.
    queryPane = new JPanel();

    // Create the comboboxes
    catCb1 = new JComboBox<String>(categories);
    catCb2 = new JComboBox<String>(categories);

    queryPane.setLayout(new BoxLayout(queryPane, BoxLayout.X_AXIS));

    // Add components to the panel.
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(new JLabel("Are there more users who looked at "));
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(catCb1);
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(new JLabel(" than "));
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(catCb2);
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(new JLabel("?"));
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));

    return queryPane;
  }
  public void createFileChooserDemo() {
    theImage = new JLabel("");
    jpgIcon = createImageIcon("filechooser/jpgIcon.jpg", "jpg image");
    gifIcon = createImageIcon("filechooser/gifIcon.gif", "gif image");

    JPanel demoPanel = getDemoPanel();
    demoPanel.setLayout(new BoxLayout(demoPanel, BoxLayout.Y_AXIS));

    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));

    demoPanel.add(Box.createRigidArea(VGAP20));
    demoPanel.add(innerPanel);
    demoPanel.add(Box.createRigidArea(VGAP20));

    innerPanel.add(Box.createRigidArea(HGAP20));

    // Create a panel to hold buttons
    JPanel buttonPanel =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));

    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPlainFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPreviewFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createCustomFileChooserButton());
    buttonPanel.add(Box.createVerticalGlue());

    // Create a panel to hold the image
    JPanel imagePanel = new JPanel();
    imagePanel.setLayout(new BorderLayout());
    imagePanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
    JScrollPane scroller = new JScrollPane(theImage);
    scroller.getVerticalScrollBar().setUnitIncrement(10);
    scroller.getHorizontalScrollBar().setUnitIncrement(10);
    imagePanel.add(scroller, BorderLayout.CENTER);

    // add buttons and image panels to inner panel
    innerPanel.add(buttonPanel);
    innerPanel.add(Box.createRigidArea(HGAP30));
    innerPanel.add(imagePanel);
    innerPanel.add(Box.createRigidArea(HGAP20));
  }
      public CombinedParameterConfigurationPanel() {
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        ParameterConfigurationPanel panel =
            new ParameterConfigurationPanel("X parameter", SensorType.X_SENSOR);
        panels.put(SensorType.X_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));

        panel = new ParameterConfigurationPanel("Y parameter", SensorType.Y_SENSOR);
        panels.put(SensorType.Y_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));

        panel = new ParameterConfigurationPanel("Knob", SensorType.POT_SENSOR);
        panels.put(SensorType.POT_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));

        panel = new ParameterConfigurationPanel("Button", SensorType.BUTTON1_SENSOR);
        panels.put(SensorType.BUTTON1_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));
      }
Esempio n. 19
0
  public ImageScrolledPane(String pozaScanata) {
    super();

    JPanel panel = new JPanel();
    this.image = new ImageIcon(pozaScanata);
    label1 = new JLabel(image);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(label1);
    panel.add(Box.createRigidArea(new Dimension(0, 20)));
    JLabel jlc = new JLabel();
    jlc.setPreferredSize(new Dimension(255, 100));

    this.getViewport().add(panel);
  }
Esempio n. 20
0
  @Override
  protected JPanel createButtonPanel() {
    JButton cancel = new JButton("Storno");
    cancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            actionCancel();
          }
        });

    JButton save = new JButton("Uložit změny");
    save.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              saveSettings();
              close();
            } catch (InvalidAttributeValueException ex) {
              MessageDialog.error("Nesprávně vyplněný formulář", ex.getMessage(), instance);
            }
          }
        });

    Box buttons = Box.createHorizontalBox();
    buttons.add(Box.createRigidArea(new Dimension(WINDOW_WIDTH - 190, 0)));
    buttons.add(cancel);
    buttons.add(Box.createRigidArea(new Dimension(10, 0)));
    buttons.add(save);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(buttons);

    return buttonPanel;
  }
Esempio n. 21
0
  /**
   * Initialize the common user interface components.
   *
   * <p>
   */
  protected JButton[] initUI(
      String title, JComponent extraComps, String confirm, String[][] extra, String cancel) {
    JButton[] extraBtns = null;

    /* create dialog body components */
    {
      JPanel body = new JPanel();
      body.setName("MainDialogPanel");

      body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));

      body.add(UIFactory.createPanelLabel("Existing Layouts:"));

      body.add(Box.createRigidArea(new Dimension(0, 4)));

      {
        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeData(), true);
        DefaultTreeModel model = new DefaultTreeModel(root, true);

        JTree tree = new JFancyTree(model);
        pTree = tree;
        tree.setName("DarkTree");

        tree.setCellRenderer(new JLayoutTreeCellRenderer());
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

        {
          JScrollPane scroll =
              UIFactory.createScrollPane(
                  pTree,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(230, 120),
                  new Dimension(230, 150),
                  null);

          body.add(scroll);
        }
      }

      if (extraComps != null) body.add(extraComps);

      extraBtns = super.initUI(title, body, confirm, null, extra, cancel);
    }

    return extraBtns;
  }
Esempio n. 22
0
 public Instruction(int x, int y) {
   this.setSize(x, y);
   try {
     intro = new ImageIcon("introScreen.jpg");
   } catch (Exception e) {
   }
   this.add(Box.createRigidArea(new Dimension(10, 15)));
   this.setLayout(new FlowLayout(FlowLayout.CENTER, this.getWidth(), 25));
   for (int i = 0; i < allIns.length; i++) {
     allIns[i].setFont(new Font("Serif", Font.BOLD, 18));
     allIns[i].setForeground(Color.yellow);
     this.add(allIns[i]);
   }
   back.setPreferredSize(new Dimension(80, 40));
   back.addActionListener(this);
   this.add(back);
 }
Esempio n. 23
0
  /** Constructor. */
  public TilePatternAnimationView() {
    super();

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    // list for the animation sequence
    sequenceField = new EnumerationChooser<Animation>(Animation.class);
    sequenceField.addActionListener(this);

    // list for the separation
    separationField = new EnumerationIconChooser<AnimationSeparation>(AnimationSeparation.class);
    separationField.addActionListener(this);

    // add the two lists
    add(sequenceField);
    add(Box.createRigidArea(new Dimension(5, 0)));
    add(separationField);
  }
Esempio n. 24
0
  public FindProf() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Search your campus!");
    JLabel patternLabel2 = new JLabel("");

    patternList = new JComboBox<Object>(searchNames);
    patternList.setEditable(true);
    patternList.setMaximumRowCount(5);
    patternList.addActionListener(this);

    // Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Building Initials & Room Number:", JLabel.LEADING); // == LEFT
    result = new JLabel(" ");
    result.setHorizontalAlignment(SwingConstants.CENTER);
    result.setForeground(Color.black);
    result.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  } // constructor
  private void initPanel() {
    final JLabel qualityLabel = new JLabel("Preferred video quality:");
    final JComboBox<VideoQuality> qualityList =
        new JComboBox<VideoQuality>(VideoQuality.getItems());
    qualityLabel.setLabelFor(qualityList);
    qualityLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    qualityList.setAlignmentX(Component.LEFT_ALIGNMENT);
    qualityList.setSelectedItem(config.getVideoQuality());

    qualityList.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            config.setVideoQuality((VideoQuality) qualityList.getSelectedItem());
          }
        });

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(qualityLabel);
    add(qualityList);
    add(Box.createRigidArea(new Dimension(0, 15)));
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }
Esempio n. 26
0
  /*
   * Create and set up a new CoreqPanel that is the correct size. Do not allow the user to modify any
   * of the characteristics of the panel; the panel will be the same for any course.
   */
  public CoreqPanel() {
    this.setMinimumSize(new Dimension(800, 25));
    this.setMaximumSize(new Dimension(2600, 26));
    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    coreqField = new JTextField();
    coreqField.setMinimumSize(new Dimension(300, 20));
    coreqField.setMaximumSize(new Dimension(2000, 21));

    coreqType = new JComboBox();
    coreqType.addItem("Credits");
    coreqType.addItem("Course");
    coreqType.addItem("Requirement");

    coreqType.setMinimumSize(new Dimension(100, 20));
    coreqType.setMaximumSize(new Dimension(100, 21));
    JLabel coreqName = new JLabel("Name of Corequisite: ");

    this.add(coreqName);
    this.add(coreqField);
    this.add(Box.createRigidArea(new Dimension(10, 0)));
    this.add(coreqType);
    this.add(Box.createGlue());
  }
Esempio n. 27
0
 public TitleScreen(int x, int y) {
   this.setSize(x, y);
   try {
     intro = new ImageIcon("introScreen.jpg");
     tetris = new ImageIcon("tetrisWord.png");
   } catch (Exception e) {
   }
   ;
   start.setPreferredSize(new Dimension(80, 40));
   highScore.setPreferredSize(new Dimension(150, 40));
   instructions.setPreferredSize(new Dimension(150, 40));
   exit.setPreferredSize(new Dimension(80, 40));
   start.addActionListener(this);
   highScore.addActionListener(this);
   instructions.addActionListener(this);
   exit.addActionListener(this);
   this.add(Box.createRigidArea(new Dimension(10, this.getHeight() / 2 - 50)));
   this.setLayout(new FlowLayout(FlowLayout.CENTER, this.getWidth(), 25));
   this.add(start);
   this.add(instructions);
   this.add(highScore);
   this.add(exit);
 }
Esempio n. 28
0
  /** Construct a new dialog. */
  public JArchiveDialog() {
    super("Archive Tool");

    pPrivilegeDetails = new PrivilegeDetails();

    /* create dialog body components */
    {
      JPanel cpanel = new JPanel();
      {
        cpanel.setName("ButtonDialogPanel");
        cpanel.setLayout(new BoxLayout(cpanel, BoxLayout.Y_AXIS));

        cpanel.add(UIFactory.createPanelLabel("Candidate Versions:"));

        cpanel.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          ArchiveCandidateTableModel model = new ArchiveCandidateTableModel();
          pCandidateTableModel = model;

          JTablePanel tpanel = new JTablePanel(model);
          pCandidateTablePanel = tpanel;

          cpanel.add(tpanel);
        }

        cpanel.add(Box.createRigidArea(new Dimension(0, 5)));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createHorizontalGlue());
          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Search...",
                    "candidate-search",
                    this,
                    "Search for new candidate checked-in versions to archive.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(20, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Clear",
                    "clear-candidate",
                    this,
                    "Clear the displayed candidate checked-in versions.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));
          hbox.add(Box.createHorizontalGlue());

          cpanel.add(hbox);
        }
      }

      JPanel apanel = new JPanel();
      {
        apanel.setName("ButtonDialogPanel");
        apanel.setLayout(new BoxLayout(apanel, BoxLayout.Y_AXIS));

        {
          Box box = new Box(BoxLayout.X_AXIS);

          box.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("Versions to Archive:");
            label.setName("PanelLabel");
            box.add(label);
          }

          box.add(Box.createHorizontalGlue());

          {
            JLabel label = new JLabel("Total Size: ???");
            pArchiveSizeLabel = label;
            label.setName("PanelLabel");
            box.add(label);
          }

          box.add(Box.createRigidArea(new Dimension(23, 0)));

          apanel.add(box);
        }

        apanel.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          NodeVersionSizeTableModel model = new NodeVersionSizeTableModel(880);
          pArchiveTableModel = model;

          JTablePanel tpanel = new JTablePanel(model);
          pArchiveTablePanel = tpanel;

          apanel.add(tpanel);
        }

        apanel.add(Box.createRigidArea(new Dimension(0, 5)));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createHorizontalGlue());
          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Add",
                    "add-archive",
                    this,
                    "Add the selected candidate versions to the list of versions to be "
                        + "archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Add All",
                    "add-all-archive",
                    this,
                    "Add all candidate versions to the list of versions to be archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(20, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Remove",
                    "remove-archive",
                    this,
                    "Remove the selected versions from the list of versions to be archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Clear",
                    "remove-all-archive",
                    this,
                    "Clear the list of versions to be archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(20, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Calc Sizes",
                    "calc-archive",
                    this,
                    "Calculate the amount of disk space needed to archive the files "
                        + "associated with the checked-in versions.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));
          hbox.add(Box.createHorizontalGlue());

          apanel.add(hbox);
        }
      }

      JSplitPane body = new JVertSplitPanel(cpanel, apanel);
      body.setAlignmentX(0.5f);

      String extra[][] = {{"Archive...", "archive"}};

      JButton btns[] = super.initUI("Archive Tool:", body, null, null, extra, "Close", null);

      pArchiveButton = btns[0];
      pArchiveButton.setEnabled(false);

      updatePanel();
      pack();
    }

    pQueryDialog = new JArchiveQueryDialog(this);
    pArchiveParamsDialog = new JArchiveParamsDialog(this);
  }
  /**
   * Make a GUI for the battleship game.
   *
   * @param game Game object that keeps up with the current state of the game.
   */
  public BattleshipGUI(Battleship game) {
    this.game = game;

    this.game = game;
    // Ships are visible on the human grid but not on the computer grid
    // (last argument)
    humanGrid = new Grid(game.getHumanBoard(), this, true);
    computerGrid = new Grid(game.getComputerBoard(), this, false);
    setTitle("Battleship Game");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new BorderLayout());

    // Add a message field centered below the game
    Box gamePanel = new Box(BoxLayout.X_AXIS);
    add(gamePanel, BorderLayout.CENTER);
    message = new JLabel("Game begins", JLabel.CENTER);
    message.setFont(DEFAULT_FONT);
    add(message, BorderLayout.SOUTH);

    // Add human and computer panels to the game; the human panel has a
    // title, grid, and buttons; the computer panel has only a title and a
    // grid
    JPanel human = new JPanel();
    human.setLayout(new BoxLayout(human, BoxLayout.Y_AXIS));
    JPanel computer = new JPanel();
    computer.setLayout(new BoxLayout(computer, BoxLayout.Y_AXIS));
    human.setAlignmentY(Component.TOP_ALIGNMENT);
    gamePanel.add(human);
    gamePanel.add(Box.createRigidArea(new Dimension(5, 0)));
    computer.setAlignmentY(Component.TOP_ALIGNMENT);
    gamePanel.add(computer);

    // Add three parts to the human panel
    JLabel humanLabel = new JLabel("Human", JLabel.CENTER);
    humanLabel.setFont(DEFAULT_FONT);
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    human.add(humanLabel);
    human.add(humanGrid);
    human.add(buttonPanel);

    // Set up the buttons
    hButton = new JButton("Horizontal");
    hButton.setFont(DEFAULT_FONT);
    hButton.addActionListener(this);
    vButton = new JButton("Vertical");
    vButton.setFont(DEFAULT_FONT);
    vButton.addActionListener(this);
    buttonPanel.add(hButton);
    buttonPanel.add(vButton);

    // Add two parts to the computer panel
    JLabel computerLabel = new JLabel("Computer", JLabel.CENTER);
    computerLabel.setFont(DEFAULT_FONT);
    computer.add(computerLabel);
    computer.add(computerGrid);

    updateStatus();

    pack();
    setVisible(true);
  }
Esempio n. 30
0
  /** Create GUI elements */
  private void loadGUI() {
    setTitle("Wifi QRCode Generator");

    mainPanel = new JPanel();
    BoxLayout vBoxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
    mainPanel.setLayout(vBoxLayout);

    int LABEL_WIDTH = 100;
    int LABEL_HEIGHT = 30;

    int EDIT_WIDTH = 200;
    int EDIT_HEIGHT = 30;

    // guide label
    {
      // This layout simply makes label looks left-alignmented
      JPanel barPanel = new JPanel();
      BoxLayout barHLayout = new BoxLayout(barPanel, BoxLayout.X_AXIS);
      barPanel.setLayout(barHLayout);

      JLabel ssoGuideLabel = new JLabel("Enter your SSO and click button below to login");
      ssoGuideLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
      barPanel.add(ssoGuideLabel);
      mainPanel.add(barPanel);
    }

    Font gFont = new Font(Font.SANS_SERIF, Font.PLAIN, 13);

    Config config = Config.instance();

    // email password remember password
    {
      JPanel userPanel = new JPanel();
      BoxLayout hBoxLayout = new BoxLayout(userPanel, BoxLayout.X_AXIS);
      userPanel.setLayout(hBoxLayout);
      JLabel emailLabel = new JLabel("Email:");
      Dimension labelDimension = new Dimension(LABEL_WIDTH, LABEL_HEIGHT);
      emailLabel.setMinimumSize(labelDimension);
      emailLabel.setPreferredSize(labelDimension);
      emailLabel.setMaximumSize(labelDimension);
      userPanel.add(emailLabel);
      userPanel.add(Box.createRigidArea(new Dimension(5, 0)));
      emailField = new TextField();
      emailField.setMinimumSize(new Dimension(EDIT_WIDTH, EDIT_HEIGHT));
      emailField.setMaximumSize(new Dimension(EDIT_WIDTH + 300, EDIT_HEIGHT));
      emailField.setFont(gFont);
      emailField.setText(config.getEmail());

      userPanel.add(emailField);

      mainPanel.add(userPanel);

      JPanel passwordPanel = new JPanel();
      BoxLayout hBoxLayout2 = new BoxLayout(passwordPanel, BoxLayout.X_AXIS);
      passwordPanel.setLayout(hBoxLayout2);
      JLabel passwordLabel = new JLabel("SSO Password:"******"Remember password", false);
      rememberPasswordCheckbox.setState(config.getRememberPassword());

      mainPanel.add(rememberPasswordCheckbox);
      mainPanel.add(Box.createHorizontalGlue());
    }

    JPanel centerPanel = new JPanel();
    BorderLayout bLayout = new BorderLayout();
    centerPanel.setLayout(bLayout);

    buttonGetPassword = new JButton(idleButtonText);
    Font font = new Font(Font.SERIF, Font.BOLD, 18);
    buttonGetPassword.setFont(font);
    buttonGetPassword.setMinimumSize(new Dimension(300, 50));
    buttonGetPassword.setPreferredSize(new Dimension(300, 50));
    buttonGetPassword.setMaximumSize(new Dimension(300, 50));

    centerPanel.add(buttonGetPassword, BorderLayout.CENTER);

    hintLabel = new JLabel("Enter your SSO and click button to start");
    hintLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));

    centerPanel.add(hintLabel, BorderLayout.SOUTH);
    mainPanel.add(centerPanel);

    wifiPasswordField = new TextField("Wifi password has not been generated");
    mainPanel.add(wifiPasswordField);

    JPanel qrCenterPanel = new JPanel();
    BorderLayout bLayout2 = new BorderLayout();
    qrCenterPanel.setLayout(bLayout2);
    qrCodeLabel = new JLabel("");
    qrCodeLabel.setMinimumSize(new Dimension(400, 400));
    qrCodeLabel.setPreferredSize(new Dimension(400, 400));
    qrCodeLabel.setMaximumSize(new Dimension(400, 400));
    qrCodeLabel.setHorizontalAlignment(JLabel.CENTER);
    qrCodeLabel.setVerticalAlignment(JLabel.CENTER);
    qrCodeLabel.setIcon(idleIcon);

    qrCenterPanel.add(qrCodeLabel, BorderLayout.CENTER);
    mainPanel.add(qrCenterPanel);

    // client download section
    {
      Font clientFont = new Font(Font.SANS_SERIF, Font.BOLD, 15);
      Dimension clientDimension = new Dimension(200, 30);
      JPanel clientPanel = new JPanel();
      BorderLayout cp_bLayout = new BorderLayout();
      clientPanel.setLayout(cp_bLayout);
      HyberLinkLabel androidLabel =
          new HyberLinkLabel(
              " [ Android Client ] ",
              "https://github.com/tangyanhan/ClrGstAutoLogin-/blob/master/ClrGstAutoConnect/bin/ClrGstAutoConnect.apk");
      androidLabel.setMinimumSize(clientDimension);
      androidLabel.setFont(clientFont);
      clientPanel.add(androidLabel, BorderLayout.WEST);

      HyberLinkLabel iosLabel = new HyberLinkLabel(" [ iOS Client ] ", "");
      iosLabel.setMinimumSize(clientDimension);
      iosLabel.setFont(clientFont);
      clientPanel.add(iosLabel, BorderLayout.EAST);

      mainPanel.add(clientPanel);
    }

    add(mainPanel);

    this.pack();
    this.setVisible(true);
    this.setLocation(300, 100);
    this.setSize(500, 730);

    buttonGetPassword.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            long elapsed = Calendar.getInstance().getTimeInMillis() - lastClickTime;

            // If we got the successfull password 5 minutes ago
            if (((elapsed / 1000) / 60) < 5) {
              hintLabel.setText("Take a rest! You have got the QR code already!");
              return;
            }

            fetchPassword();

            if (!Config.instance().getWifiPassword().isEmpty())
              lastClickTime = Calendar.getInstance().getTimeInMillis();
          }
        });
  }