private void init() {
    setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createRaisedBevelBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    titleLabel = new JLabel();
    titleLabel.setMinimumSize(new Dimension(10, 60));
    titleLabel.setPreferredSize(new Dimension(10, 60));
    descriptionLabel = new JLabel();
    descriptionLabel.setBorder(BorderFactory.createTitledBorder("description:"));
    descriptionLabel.setMinimumSize(new Dimension(10, 100));
    descriptionLabel.setPreferredSize(new Dimension(10, 100));

    JPanel topWrapper = new JPanel(new BorderLayout());
    topWrapper.add(titleLabel, BorderLayout.NORTH);
    topWrapper.add(descriptionLabel, BorderLayout.CENTER);

    requiredSkillsPanel = new JPanel();
    requiredSkillsPanel.setLayout(new BoxLayout(requiredSkillsPanel, BoxLayout.Y_AXIS));
    requiredSkillsPanel.setBorder(BorderFactory.createTitledBorder("requirements:"));
    JPanel requiredSkillsPanelWrapper = new JPanel(new BorderLayout());
    requiredSkillsPanelWrapper.add(requiredSkillsPanel, BorderLayout.CENTER);

    attributesPanel = new JPanel();
    attributesPanel.setLayout(new BoxLayout(attributesPanel, BoxLayout.Y_AXIS));
    attributesPanel.setBorder(BorderFactory.createTitledBorder("attributes:"));
    JPanel attributesPanelWrapper = new JPanel(new BorderLayout());
    attributesPanelWrapper.add(attributesPanel, BorderLayout.CENTER);

    JPanel centerpanel = new JPanel(new GridLayout(0, 2));
    centerpanel.add(requiredSkillsPanelWrapper);
    centerpanel.add(attributesPanelWrapper);

    add(topWrapper, BorderLayout.NORTH);
    add(centerpanel, BorderLayout.CENTER);
  }
  public FeaturePaletteScrollPane() {
    this.setBorder(BorderFactory.createTitledBorder("Feature Palette"));
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    setViewportView(panel);
    componentName = new JLabel("Component: ");
    componentName.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    componentName.setMinimumSize(new Dimension(200, 20));
    componentName.setMaximumSize(new Dimension(200, 20));
    cmbFeatures = new JComboBox();
    cmbFeatures.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    cmbFeatures.setMinimumSize(new Dimension(200, 20));
    cmbFeatures.setMaximumSize(new Dimension(200, 20));
    cmbValues = new JComboBox();
    cmbValues.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    cmbValues.setMinimumSize(new Dimension(200, 20));
    cmbValues.setMaximumSize(new Dimension(200, 20));
    resetButton = new JButton("Set ALL Features to Default");
    resetButton.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    resetButton.setMinimumSize(new Dimension(200, 20));
    resetButton.setMaximumSize(new Dimension(200, 20));
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double width = screenSize.getWidth();
    double height = screenSize.getHeight();
    int palettewidth = (int) (width * 0.4);
    int paletteheight = (int) (height * 0.25);
    this.setPreferredSize(new Dimension(palettewidth, paletteheight));
    JLabel blankLabel = new JLabel("");
    blankLabel.setMinimumSize(new Dimension(200, 20));
    blankLabel.setMaximumSize(new Dimension(200, 20));
    blankLabel.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    JLabel blankLabel2 = new JLabel("");
    blankLabel2.setMinimumSize(new Dimension(200, 20));
    blankLabel2.setMaximumSize(new Dimension(200, 20));
    blankLabel2.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    JLabel blankLabel3 = new JLabel("");
    blankLabel3.setMinimumSize(new Dimension(200, 10));
    blankLabel3.setMaximumSize(new Dimension(200, 10));
    blankLabel3.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    panel.add(componentName);
    panel.add(blankLabel);
    panel.add(cmbFeatures);
    panel.add(blankLabel3);
    panel.add(cmbValues);
    panel.add(blankLabel2);
    panel.add(resetButton);

    initComponents();
  }
  // Initializes this component.
  private void jbInit() {
    segmentTable.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            segmentTable_focusGained(e);
          }

          public void focusLost(FocusEvent e) {
            segmentTable_focusLost(e);
          }
        });
    segmentTable.setTableHeader(null);
    scrollPane = new JScrollPane(segmentTable);
    scrollPane.setMinimumSize(new Dimension(getTableWidth(), 0));

    setLayout(new BorderLayout(0, 0));

    determineColumnWidth();
    nameLbl.setPreferredSize(new Dimension(getTableWidth(), 25));
    nameLbl.setMinimumSize(new Dimension(getTableWidth(), 0));
    nameLbl.setFont(Utilities.labelsFont);

    segmentTable.setFont(Utilities.valueFont);
    setBorder(BorderFactory.createEtchedBorder());

    setMinimumSize(new Dimension(getTableWidth(), 0));

    this.add(nameLbl, BorderLayout.NORTH);
    this.add(scrollPane, BorderLayout.CENTER);
  }
Example #4
0
 public StatusBar(Paint paint) {
   lineTypePanel = new LineTypePanel(paint);
   setLayout(new MigLayout("insets 5 5 5 5", "[][grow, fill][grow, fill]", "[grow, fill]"));
   setPreferredSize(new Dimension(10, 23));
   textPoint.setText("Coord: [x=0, y=0]");
   colorLabel.setMinimumSize(new Dimension(50, 15));
   lineTypePanel.setMinimumSize(new Dimension(50, 15));
   lineTypePanel.setOpaque(true);
   colorLabel.setBackground(Color.black);
   colorLabel.setOpaque(true);
   textPoint.setMinimumSize(new Dimension(200, 15));
   add(textPoint, "dock west, grow");
   add(colorLabel, "align center");
   add(lineTypePanel, "align right");
   setBackground(SystemColor.control);
 }
  public void setup(ISettingsManager settingsManager, BattleProperties battleProperties) {
    this.settingsManager = settingsManager;
    this.battleProperties = battleProperties;

    EventHandler eventHandler = new EventHandler();

    battlefieldWidthSlider = createBattlefieldSizeSlider();
    battlefieldWidthSlider.setOrientation(SwingConstants.HORIZONTAL);

    battlefieldHeightSlider = createBattlefieldSizeSlider();
    battlefieldHeightSlider.setOrientation(SwingConstants.VERTICAL);
    battlefieldHeightSlider.setInverted(true);

    battlefieldSizeLabel = new BattlefieldSizeLabel();
    battlefieldSizeLabel.setHorizontalAlignment(SwingConstants.CENTER);
    battlefieldSizeLabel.setMinimumSize(new Dimension(50, 50));
    battlefieldSizeLabel.setMaximumSize(new Dimension(500, 500));

    battlefieldWidthSlider.addChangeListener(eventHandler);
    battlefieldHeightSlider.addChangeListener(eventHandler);

    JPanel rulesPanel = createRulesPanel();
    rulesPanel.addAncestorListener(eventHandler);

    restoreDefaultsButton.addActionListener(eventHandler);

    setLayout(new BorderLayout());

    add(rulesPanel, BorderLayout.WEST);
    add(restoreDefaultsButton, BorderLayout.SOUTH);
    add(createBattlefieldSizePanel(), BorderLayout.CENTER);
  }
  public LabelField(String name, int max, ChangeListener changeListener) {
    this.changeListener = changeListener;
    oldText = "";

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

    label = new JLabel(name);
    label.setMinimumSize(new Dimension(90, 21));
    label.setMaximumSize(new Dimension(90, 21));
    label.setPreferredSize(new Dimension(90, 21));
    this.add(label);

    textField = new JTextField();
    textField.setMaximumSize(new Dimension(max, 21));
    textField.addFocusListener(
        new FocusListener() {
          @Override
          public void focusGained(FocusEvent e) {}

          @Override
          public void focusLost(FocusEvent e) {
            if (oldText.equals(getText())) return;
            oldText = getText();
            notifyChanged();
          }
        });
    this.add(textField);
  }
Example #7
0
  public SplitPaneDemo2() {
    super("SplitPaneDemo2");

    // Create an instance of SplitPaneDemo
    SplitPaneDemo splitPaneDemo = new SplitPaneDemo();
    JSplitPane top = splitPaneDemo.getSplitPane();
    splitPaneDemo.getImageList().addListSelectionListener(this);

    // XXXX: Bug #4131528, borders on nested split panes accumulate.
    // Workaround: Set the border on any split pane within
    // another split pane to null. Components within nested split
    // panes need to have their own border for this to work well.
    top.setBorder(null);

    // Create a regular old label
    label = new JLabel("Click on an image name in the list.", JLabel.CENTER);

    // Create a split pane and put "top" (a split pane)
    // and JLabel instance in it.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, label);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(180);

    // Provide minimum sizes for the two components in the split pane
    top.setMinimumSize(new Dimension(100, 50));
    label.setMinimumSize(new Dimension(100, 30));

    // Add the split pane to this frame
    getContentPane().add(splitPane);
  }
Example #8
0
  private void resizeLabels() {
    // adjust size of labels so they right-align
    int w = 0;
    Font font = nameLabel.getFont();
    FontRenderContext frc = new FontRenderContext(null, false, false);
    Rectangle2D rect = font.getStringBounds(nameLabel.getText() + " ", frc); // $NON-NLS-1$
    w = Math.max(w, (int) rect.getWidth() + 4);
    rect = font.getStringBounds(pathLabel.getText() + " ", frc); // $NON-NLS-1$
    w = Math.max(w, (int) rect.getWidth() + 4);

    Dimension labelSize = new Dimension(w, 20);
    nameLabel.setPreferredSize(labelSize);
    nameLabel.setMinimumSize(labelSize);
    pathLabel.setPreferredSize(labelSize);
    pathLabel.setMinimumSize(labelSize);
  }
  protected JComponent getNewComponentInstance() {
    JLabel newLabel =
        new JLabel() {

          /** */
          private static final long serialVersionUID = 1L;

          /* (non-Javadoc)
           * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
           */
          @Override
          protected void paintComponent(Graphics g) {
            Insets i = getInsets();

            Rectangle rect =
                new Rectangle(
                    i.left, i.top, getWidth() - i.left - i.right, getHeight() - i.top - i.bottom);
            Area clip = new Area(g.getClip());
            clip.intersect(new Area(rect));
            Graphics2D g2 = (Graphics2D) g;
            g2.setClip(clip);
            super.paintComponent(g);
          }
        };
    newLabel.setPreferredSize(itemSize);
    newLabel.setMinimumSize(scaleItem ? small : itemSize);
    newLabel.setMaximumSize(scaleItem ? large : itemSize);
    newLabel.setBorder(componentBorder);
    newLabel.setText("");
    newLabel.setHorizontalAlignment(JLabel.CENTER);
    newLabel.setVerticalAlignment(JLabel.CENTER);
    return newLabel;
  }
Example #10
0
 /**
  * Updates the number of active voices.
  *
  * @param count The new number of active voices.
  */
 private void updateVoiceCount(int count) {
   Dimension d = lVoices.getPreferredSize();
   lVoices.setText(count == 0 ? "--" : String.valueOf(count));
   d = JuifeUtils.getUnionSize(d, lVoices.getPreferredSize());
   lVoices.setMinimumSize(d);
   lVoices.setPreferredSize(d);
   lVoices.setMaximumSize(d);
 }
  public BadKitPanel(KitAssemblyApp _app) {
    app = _app;
    setLayout(new GridBagLayout());
    c = new GridBagConstraints();

    label = new JLabel();
    sendButton = new JButton("Send Kit Non-Norm");
    sendButton.addActionListener(this);
    toggleDropParts = new JButton("Enable Parts Robot Drop Parts");
    toggleDropParts.addActionListener(this);

    titleLabel = new JLabel("Kit Assembly Non-Normatives");
    titleLabel.setFont(new Font("Verdana", Font.BOLD, 16));
    titleLabel.setPreferredSize(new Dimension(300, 25));
    titleLabel.setMaximumSize(new Dimension(300, 25));
    titleLabel.setMinimumSize(new Dimension(300, 25));
    titleLabel.setAlignmentX(CENTER_ALIGNMENT);

    Kit temp = new Kit();
    temp.setID("Bad Kit to Make");
    for (int j = 0; j < 8; j++) {
      temp.addPart(new Part(new PartInfo(null, "images/good.png")));
    }
    badKit = new BadKit(temp);
    label = new JLabel(temp.getID());

    sent = new JLabel("");
    sent.setPreferredSize(new Dimension(230, 25));
    sent.setMaximumSize(new Dimension(230, 25));
    sent.setMinimumSize(new Dimension(230, 25));
    sent.setAlignmentX(CENTER_ALIGNMENT);

    c.gridx = 0;
    c.gridy = 0;
    add(titleLabel, c);
    c.gridy = 1;

    add(badKit, c);
    c.gridy = 2;
    c.insets = new Insets(10, 0, 0, 0);
    add(sendButton, c);
    c.gridy = 3;
    add(toggleDropParts, c);
    c.gridy = 4;
    add(sent, c);
  }
Example #12
0
 private void setVolumeLabel(int volume) {
   Dimension d = lVolume.getPreferredSize();
   lVolume.setText(String.valueOf(volume) + '%');
   d = JuifeUtils.getUnionSize(d, lVolume.getPreferredSize());
   lVolume.setMinimumSize(d);
   lVolume.setPreferredSize(d);
   lVolume.setMaximumSize(d);
 }
Example #13
0
 public static JLabel createLabel(String text) {
   JLabel label = new JLabel(text);
   Dimension size = label.getMinimumSize();
   label.setPreferredSize(size);
   label.setSize(size);
   label.setMinimumSize(size);
   label.setMaximumSize(size);
   return label;
 }
 /** Creates a label to display selected file count, initialized to invisible */
 private void buildSelectedFileCountLabel() {
   selectedFileCountLabel = new JLabel("", JLabel.CENTER);
   selectedFileCountLabel.setBackground(alertColor);
   selectedFileCountLabel.setOpaque(true);
   selectedFileCountLabel.setVisible(false);
   selectedFileCountLabel.setPreferredSize(new Dimension(80, 25));
   selectedFileCountLabel.setMinimumSize(new Dimension(80, 25));
   selectedFileCountLabel.setForeground(Color.black);
 }
  @Override
  public JComponent getBlankComponent() {
    JLabel myLab = new JLabel();
    myLab.setMinimumSize(itemSize);
    myLab.setMaximumSize(itemSize);
    myLab.setPreferredSize(itemSize);
    myLab.setOpaque(false);

    return myLab; // Box.createRigidArea( itemSize );
  }
Example #16
0
  private void setupLabels() {
    mainLabel.setText(
        "Guess a number between 1 and " + Integer.toString(this.config.getMaxNumber()));

    mainLabel.setFont(new Font("Arial", Font.BOLD, 18));
    mainLabel.setOpaque(true);
    mainLabel.setMinimumSize(new Dimension(30, 400));
    // mainLabel.paint(Color.red)

    guessLabel.setFont(new Font("Arial", Font.BOLD, 18));
    guessLabel.setOpaque(true);
  }
Example #17
0
 /**
  * Towrzy domyślny panel z tytułem jako displayName kontaktu.
  *
  * @param contact
  */
 public ContactPanel(final ViewContact contact) {
   super();
   this.contact = contact;
   label = new JLabel(contact.getDisplayName());
   this.setOpaque(false);
   this.setMinimumSize(new Dimension(MainWindow.this.window.getMinimumSize().width, height));
   this.setMaximumSize(new Dimension(Integer.MAX_VALUE, height));
   this.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
   state.setMinimumSize(new Dimension(30, 30));
   this.add(state, BorderLayout.WEST);
   this.add(label, BorderLayout.CENTER);
   this.setAlignmentX(LEFT_ALIGNMENT);
 }
 private void adjustTextLabelSize(JLabel label) {
     // Try to calculate a reasonable height
     Dimension oldPreferred = label.getPreferredSize();
     if (oldPreferred.width > maxTextWidth) {
         int numLines = oldPreferred.width / maxTextWidth + 1;
         if (numLines > maxTextLines) {
             numLines = maxTextLines;
         }
         oldPreferred.height *= numLines;
     }
     oldPreferred.width = maxTextWidth;
     label.setPreferredSize(oldPreferred);
     label.setMinimumSize(oldPreferred);
 }
 public static JComponent createPromptComponent(
     Integer promptNumber, @NotNull final PromptType type) {
   final String promptText = prompt(promptNumber, type);
   JLabel promptLabel = new JLabel(promptText);
   promptLabel.setHorizontalAlignment(SwingConstants.RIGHT);
   promptLabel.setMinimumSize(PROMPT_SIZE);
   promptLabel.setPreferredSize(PROMPT_SIZE);
   final Font font = promptLabel.getFont();
   assert font != null;
   promptLabel.setFont(font.deriveFont(Font.BOLD));
   final JBColor darkRed = new JBColor(new Color(210, 30, 50), new Color(210, 30, 50));
   promptLabel.setForeground(type == PromptType.In ? JBColor.BLUE : darkRed);
   promptLabel.setBackground(getBackground());
   return promptLabel;
 }
  public URLField() {

    config = new Config();
    icon = new SignIcon(config);
    label = new JLabel(icon);
    /* show at least a 16x16 icon */
    label.setMinimumSize(new Dimension(18, 18));
    field = new JTextField(30);

    buildUI();

    field.addActionListener(this);
    field.getDocument().addDocumentListener(this);

    setText(null);
  }
Example #21
0
  /** init subscribe to System/Error Message Events */
  private void init() {
    setLayout(new BorderLayout());

    status = new JLabel("Not Connected");
    status.setMinimumSize(new Dimension(100, 400));
    status.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    add(status, BorderLayout.WEST);

    JPanel heartBeatHolder = new JPanel(new BorderLayout());
    heartBeatHolder.add(heartbeat, BorderLayout.EAST);
    heartBeatHolder.setBorder(BorderFactory.createLineBorder(Color.gray));
    add(heartBeatHolder, BorderLayout.EAST);

    SystemTextHandler.getInstance().addSubscriber(this);
    ErrorResponseHandler.getInstance().addSubscriber(this);
  }
Example #22
0
 protected JLabel createTitleLabel(int preferredWidth) {
   JLabel result = new JLabel(getTitle());
   result.setHorizontalAlignment(SwingConstants.CENTER);
   if (getIcon() != null) {
     result.setIcon(getIcon());
     result.setIconTextGap(10);
   }
   result.setBackground(titleBgColor);
   result.setForeground(titleForeColor);
   result.setOpaque(true);
   result.setBorder(titleBorder);
   result.validate();
   Dimension d = result.getPreferredSize();
   result.setPreferredSize(new Dimension(Math.max(d.width, preferredWidth), d.height));
   result.setMinimumSize(result.getPreferredSize());
   return result;
 }
  /**
   * Erstellt die grafische Oberfläche.
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    contentPane = (JPanel) this.getContentPane();
    m_agentLabel.setBorder(BorderFactory.createEtchedBorder());
    m_agentLabel.setMaximumSize(new Dimension(150, 20));
    m_agentLabel.setMinimumSize(new Dimension(150, 20));
    m_agentLabel.setPreferredSize(new Dimension(150, 20));
    m_agentLabel.setToolTipText("Name des Agenten");
    m_agentLabel.setText("Agenten Name:");
    m_gridLayout.setColumns(3);
    m_gridLayout.setHgap(10);
    m_gridLayout.setRows(4);
    m_gridLayout.setVgap(10);
    contentPane.setLayout(m_gridLayout);
    this.setSize(new Dimension(581, 212));
    this.setTitle("Agentenanmeldung");
    contentPane.setMaximumSize(new Dimension(300, 32767));
    contentPane.setMinimumSize(new Dimension(300, 80));
    contentPane.setPreferredSize(new Dimension(300, 80));
    m_agentClass.setBorder(BorderFactory.createEtchedBorder());
    m_agentClass.setText("Klasse des Agenten:");
    m_serverLabel.setBorder(BorderFactory.createEtchedBorder());
    m_serverLabel.setText("Source-Server:");
    m_agentTF.setText("");
    m_roVButton.setBorder(BorderFactory.createRaisedBevelBorder());
    m_roVButton.setActionCommand("Registriere Agent ohne Visualisierung");
    m_roVButton.setText("Registriere Agent ohne Visualisierung");
    m_roVButton.addActionListener(new AgentRegistrationFrame_m_roVButton_actionAdapter(this));
    m_rwVAgentButton.setBorder(BorderFactory.createRaisedBevelBorder());
    m_rwVAgentButton.setText("Registriere Agent mit Visualisierung");
    m_rwVAgentButton.addActionListener(
        new AgentRegistrationFrame_m_rwVAgentButton_actionAdapter(this));

    m_rwVAgentButton.setVisible(false); // später auf true setzten

    m_agentClassCombo = new JComboBox(this.getAgentClasses());
    m_serverTF.setText("http://localhost:2003/");
    contentPane.add(m_agentLabel, null);
    contentPane.add(m_agentTF, null);
    contentPane.add(m_agentClass, null);
    contentPane.add(m_agentClassCombo, null);
    contentPane.add(m_serverLabel, null);
    contentPane.add(m_serverTF, null);
    contentPane.add(m_roVButton, null);
    contentPane.add(m_rwVAgentButton, null);
  }
Example #24
0
  public TaskControl(String taskDescription) {
    double[][] size = {
      {TableLayout.FILL, 80, 100},
      {20, 20, 20},
    };

    Border outsideBorder = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
    Border insideBorder = BorderFactory.createEmptyBorder(3, 3, 3, 3);
    Border lineBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);

    setBorder(lineBorder);

    TableLayout layout = new TableLayout(size);
    layout.setHGap(3);
    layout.setVGap(3);
    setLayout(layout);

    label = new JLabel(taskDescription);
    label.setMinimumSize(new Dimension(100, 20));
    label.setPreferredSize(new Dimension(300, 20));

    progressBar = new JProgressBar();
    progressBar.setIndeterminate(true);
    progressBar.setMinimum(0);
    progressBar.setMaximum(1000);

    progressBar.setMinimumSize(new Dimension(100, 20));
    progressBar.setPreferredSize(new Dimension(300, 20));

    btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            cancel();
          }
        });

    add(label, "0,0,2,0");
    add(progressBar, "0,1,2,1");
    add(btnCancel, "2,2");
  }
  public EducAssignmentPanel() {
    super("‘ормирование учебных поручений");
    List<Image> icons = new Vector<Image>();
    icons.add(new ImageIcon("images/уп.png").getImage());
    setIconImages(icons);
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    this.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
    this.setResizable(false);
    Dimension dim_screen = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(
        (int) dim_screen.getWidth() / 2 - DEFAULT_WIDTH / 2,
        (int) dim_screen.getHeight() / 2 - DEFAULT_HEIGHT / 2);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JPanel content_top = BoxLayoutUtils.createHorizontalPanel();

    // ----------------------------------------------------------
    JPanel semester = BoxLayoutUtils.createHorizontalPanel();
    semester.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JLabel lab_semester = new JLabel("¬ид семестра:");
    semester_combo = new JComboBox<String>();
    semester_combo.setBackground(Color.white);
    semester_combo.addItem("летний");
    semester_combo.addItem("зимний");
    lab_semester.setPreferredSize(new Dimension(100, 27));
    lab_semester.setMaximumSize(lab_semester.getPreferredSize());
    lab_semester.setMinimumSize(lab_semester.getPreferredSize());
    semester_combo.setPreferredSize(new Dimension(100, 27));
    semester_combo.setMaximumSize(semester_combo.getPreferredSize());
    semester_combo.setMinimumSize(semester_combo.getPreferredSize());
    semester.add(lab_semester);
    semester.add(semester_combo);

    JPanel bevel_semester = BoxLayoutUtils.createHorizontalPanel();
    bevel_semester.setBorder(BorderFactory.createLoweredBevelBorder());

    JPanel out_semester = BoxLayoutUtils.createHorizontalPanel();
    out_semester.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    bevel_semester.add(semester);
    out_semester.add(bevel_semester);
    // ----------------------------------------------------------

    JPanel cath = BoxLayoutUtils.createVerticalPanel();
    cath.setBackground(Color.white);
    semester.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    CurriculumTransaction tr = new CurriculumTransaction();
    ArrayList<String> cath_names = tr.getCathedras();
    checks = new ArrayList<JCheckBox>();
    this.checks.add(new JCheckBox("выбрать все..."));
    for (String name : cath_names) checks.add(new JCheckBox(name));
    for (JCheckBox cur_check : checks) {
      cath.add(Box.createHorizontalStrut(5));
      cath.add(cur_check);
      cur_check.setBackground(Color.white);
    }
    checks
        .get(0)
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                JCheckBox check = (JCheckBox) e.getSource();
                if (check.isSelected()) {
                  for (JCheckBox cur : checks) cur.setSelected(true);
                } else for (JCheckBox cur : checks) cur.setSelected(false);
              }
            });
    cath.add(Box.createGlue());

    JPanel bevel_cath = BoxLayoutUtils.createHorizontalPanel();
    bevel_cath.setBorder(BorderFactory.createLoweredBevelBorder());

    JPanel out_cath = BoxLayoutUtils.createHorizontalPanel();
    out_cath.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));

    bevel_cath.add(new JScrollPane(cath));
    out_cath.add(bevel_cath);
    // ----------------------------------------------------------
    JPanel right = BoxLayoutUtils.createVerticalPanel();
    right.add(out_semester);
    right.add(out_cath);

    content_top.add(right);
    chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    content_top.add(chooser);
    // ----------------------------------------------------------
    JPanel content_create = BoxLayoutUtils.createHorizontalPanel();
    content_create.add(Box.createHorizontalGlue());
    create = new JButton("—формировать поручени¤");
    create.setPreferredSize(new Dimension(200, 27));
    create.setMinimumSize(create.getPreferredSize());
    create.setMaximumSize(create.getPreferredSize());
    cancel = new JButton("ќтмена");
    cancel.setPreferredSize(new Dimension(100, 27));
    cancel.setMinimumSize(cancel.getPreferredSize());
    cancel.setMaximumSize(cancel.getPreferredSize());
    content_create.add(create);
    content_create.add(Box.createHorizontalStrut(5));
    content_create.add(cancel);
    content_create.add(Box.createHorizontalStrut(4));

    JPanel create_empty = BoxLayoutUtils.createHorizontalPanel();
    create_empty.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JPanel content_bottom = BoxLayoutUtils.createHorizontalPanel();
    content_bottom.setBorder(BorderFactory.createEtchedBorder());
    create_empty.add(content_create);
    content_bottom.add(create_empty);

    JPanel content = BoxLayoutUtils.createVerticalPanel();
    content.add(content_top);
    content.add(content_bottom);

    create.addActionListener(this);
    cancel.addActionListener(this);
    setContentPane(content);
    setVisible(true);
  }
  private void addInformationPanel() {
    // Create UI elements for connection information.
    JPanel informationPanel = new JPanel();
    informationPanel.setLayout(new BorderLayout());

    // Add the Host information
    JPanel connPanel = new JPanel();
    connPanel.setLayout(new GridBagLayout());
    connPanel.setBorder(BorderFactory.createTitledBorder("Connection information"));

    JLabel label = new JLabel("Host: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    JFormattedTextField field = new JFormattedTextField(connection.getServiceName());
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(
        field, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the Port information
    label = new JLabel("Port: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    field = new JFormattedTextField(connection.getPort());
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(
        field, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the connection's User information
    label = new JLabel("User: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    userField = new JFormattedTextField();
    userField.setMinimumSize(new java.awt.Dimension(150, 20));
    userField.setMaximumSize(new java.awt.Dimension(150, 20));
    userField.setEditable(false);
    userField.setBorder(null);
    connPanel.add(
        userField,
        new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the connection's creationTime information
    label = new JLabel("Creation time: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    field = new JFormattedTextField(new SimpleDateFormat("yyyy.MM.dd hh:mm:ss:SS aaa"));
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setValue(creationTime);
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(
        field, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the connection's creationTime information
    label = new JLabel("Status: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    statusField = new JFormattedTextField();
    statusField.setMinimumSize(new java.awt.Dimension(150, 20));
    statusField.setMaximumSize(new java.awt.Dimension(150, 20));
    statusField.setValue("Active");
    statusField.setEditable(false);
    statusField.setBorder(null);
    connPanel.add(
        statusField,
        new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the connection panel to the information panel
    informationPanel.add(connPanel, BorderLayout.NORTH);

    // Add the Number of sent packets information
    JPanel packetsPanel = new JPanel();
    packetsPanel.setLayout(new GridLayout(1, 1));
    packetsPanel.setBorder(BorderFactory.createTitledBorder("Transmitted Packets"));

    statisticsTable =
        new DefaultTableModel(
            new Object[][] {
              {"IQ", 0, 0}, {"Message", 0, 0}, {"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}
            },
            new Object[] {"Type", "Received", "Sent"}) {
          private static final long serialVersionUID = -6793886085109589269L;

          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };
    JTable table = new JTable(statisticsTable);
    // Allow only single a selection
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    packetsPanel.add(new JScrollPane(table));

    // Add the packets panel to the information panel
    informationPanel.add(packetsPanel, BorderLayout.CENTER);

    tabbedPane.add("Information", new JScrollPane(informationPanel));
    tabbedPane.setToolTipTextAt(4, "Information and statistics about the debugged connection");
  }
Example #27
0
  /** Initializes the GUI. Auto-generated code - any changes you make will disappear. */
  public void initGUI() {
    try {
      preInitGUI();

      containerTabbedPane = new JTabbedPane();
      tbDirectedGraph = new JPanel();
      btnFilterDirectedGraph = new JButton();
      dirVertexDegreePanel = new JPanel();
      lblMinInDegree = new JLabel();
      lblMaxInDegree = new JLabel();
      lblMinOutDegree = new JLabel();
      lblMaxOutDegree = new JLabel();
      tfInDegreeMin = new JTextField();
      tfInDegreeMax = new JTextField();
      tfOutDegreeMin = new JTextField();
      tfOutDegreeMax = new JTextField();
      lblIinstructions = new JLabel();
      tbUndirectedGraph = new JPanel();
      unDirVertexDegreePanel = new JPanel();
      lblMinDegree = new JLabel();
      lblMaxDegree = new JLabel();
      tfMinDegree = new JTextField();
      tfMaxDegree = new JTextField();
      lblInstructionsDir = new JLabel();
      btnFilterUndirectedGraph = new JButton();

      BorderLayout thisLayout = new BorderLayout();
      this.getContentPane().setLayout(thisLayout);
      thisLayout.setHgap(0);
      thisLayout.setVgap(0);
      this.setTitle("Pruning");
      this.setSize(new java.awt.Dimension(316, 267));

      containerTabbedPane.setPreferredSize(new java.awt.Dimension(309, 265));
      this.getContentPane().add(containerTabbedPane, BorderLayout.CENTER);

      GridBagLayout tbDirectedGraphLayout = new GridBagLayout();
      tbDirectedGraph.setLayout(tbDirectedGraphLayout);
      tbDirectedGraphLayout.columnWidths = new int[] {1};
      tbDirectedGraphLayout.rowHeights = new int[] {1, 1, 1};
      tbDirectedGraphLayout.columnWeights = new double[] {0.1};
      tbDirectedGraphLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
      tbDirectedGraph.setPreferredSize(new java.awt.Dimension(304, 242));
      containerTabbedPane.add(tbDirectedGraph);
      containerTabbedPane.setTitleAt(0, "Directed Graph");

      btnFilterDirectedGraph.setText("Filter Graph");
      tbDirectedGraph.add(
          btnFilterDirectedGraph,
          new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));
      btnFilterDirectedGraph.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              btnFilterDirectedGraphActionPerformed(evt);
            }
          });

      GridBagLayout dirVertexDegreePanelLayout = new GridBagLayout();
      dirVertexDegreePanel.setLayout(dirVertexDegreePanelLayout);
      dirVertexDegreePanelLayout.columnWidths = new int[] {1, 1};
      dirVertexDegreePanelLayout.rowHeights = new int[] {1, 1, 1, 1, 1};
      dirVertexDegreePanelLayout.columnWeights = new double[] {0.1, 0.1};
      dirVertexDegreePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1};
      dirVertexDegreePanel.setBorder(
          new TitledBorder(
              new LineBorder(new java.awt.Color(0, 0, 0), 1, false),
              "Vertex Degree",
              TitledBorder.LEADING,
              TitledBorder.TOP,
              new java.awt.Font("Dialog", 1, 12),
              new java.awt.Color(0, 0, 0)));
      tbDirectedGraph.add(
          dirVertexDegreePanel,
          new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      lblMinInDegree.setText("In-Degree Minimum");
      dirVertexDegreePanel.add(
          lblMinInDegree,
          new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMaxInDegree.setText("In-Degree Maximum");
      dirVertexDegreePanel.add(
          lblMaxInDegree,
          new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMinOutDegree.setText("Out-Degree Minimum");
      dirVertexDegreePanel.add(
          lblMinOutDegree,
          new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMaxOutDegree.setText("Out-Degree Maximum");
      dirVertexDegreePanel.add(
          lblMaxOutDegree,
          new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      tfInDegreeMin.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfInDegreeMin,
          new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      tfInDegreeMax.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfInDegreeMax,
          new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      tfOutDegreeMin.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfOutDegreeMin,
          new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      tfOutDegreeMax.setMinimumSize(new java.awt.Dimension(40, 20));
      dirVertexDegreePanel.add(
          tfOutDegreeMax,
          new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

      lblIinstructions.setText(
          "<html>Enter degree values by which to filter graph. Leave blank to use minimum or maximum value.</html>");
      lblIinstructions.setHorizontalAlignment(SwingConstants.LEADING);
      lblIinstructions.setHorizontalTextPosition(SwingConstants.TRAILING);
      lblIinstructions.setVerticalAlignment(SwingConstants.TOP);
      lblIinstructions.setVerticalTextPosition(SwingConstants.CENTER);
      lblIinstructions.setPreferredSize(new java.awt.Dimension(60, 40));
      lblIinstructions.setMinimumSize(new java.awt.Dimension(60, 40));
      dirVertexDegreePanel.add(
          lblIinstructions,
          new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      GridBagLayout tbUndirectedGraphLayout = new GridBagLayout();
      tbUndirectedGraph.setLayout(tbUndirectedGraphLayout);
      tbUndirectedGraphLayout.columnWidths = new int[] {1};
      tbUndirectedGraphLayout.rowHeights = new int[] {1, 1, 1};
      tbUndirectedGraphLayout.columnWeights = new double[] {0.1};
      tbUndirectedGraphLayout.rowWeights = new double[] {0.1, 0.1, 0.1};
      tbUndirectedGraph.setPreferredSize(new java.awt.Dimension(304, 212));
      containerTabbedPane.add(tbUndirectedGraph);
      containerTabbedPane.setTitleAt(1, "Undirected Graph");

      GridBagLayout unDirVertexDegreePanelLayout = new GridBagLayout();
      unDirVertexDegreePanel.setLayout(unDirVertexDegreePanelLayout);
      unDirVertexDegreePanelLayout.columnWidths = new int[] {1, 1};
      unDirVertexDegreePanelLayout.rowHeights = new int[] {1, 1, 1, 1};
      unDirVertexDegreePanelLayout.columnWeights = new double[] {0.1, 0.1};
      unDirVertexDegreePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1};
      unDirVertexDegreePanel.setBorder(
          new TitledBorder(
              new LineBorder(new java.awt.Color(0, 0, 0), 1, false),
              "Vertex Degree",
              TitledBorder.LEADING,
              TitledBorder.TOP,
              new java.awt.Font("Dialog", 1, 12),
              new java.awt.Color(0, 0, 0)));
      tbUndirectedGraph.add(
          unDirVertexDegreePanel,
          new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      lblMinDegree.setText("Minimum Degree");
      unDirVertexDegreePanel.add(
          lblMinDegree,
          new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      lblMaxDegree.setText("Maximum Degree");
      unDirVertexDegreePanel.add(
          lblMaxDegree,
          new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 0, new Insets(0, 5, 0, 5), 0, 0));

      tfMinDegree.setMinimumSize(new java.awt.Dimension(40, 20));
      unDirVertexDegreePanel.add(
          tfMinDegree,
          new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 0, new Insets(0, 0, 0, 0), 0, 0));

      tfMaxDegree.setMinimumSize(new java.awt.Dimension(40, 20));
      unDirVertexDegreePanel.add(
          tfMaxDegree,
          new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 0, new Insets(0, 0, 0, 0), 0, 0));

      lblInstructionsDir.setText(
          "<html>Enter degree values by which to filter graph. Leave blank to use minimum or maximum value.</html>");
      unDirVertexDegreePanel.add(
          lblInstructionsDir,
          new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(0, 0, 0, 0), 0, 0));

      btnFilterUndirectedGraph.setText("Filter Graph");
      tbUndirectedGraph.add(
          btnFilterUndirectedGraph,
          new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 0, new Insets(5, 5, 5, 5), 0, 0));
      btnFilterUndirectedGraph.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              btnFilterUndirectedGraphActionPerformed(evt);
            }
          });

      postInitGUI();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /** 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:");
      passwordLabel.setMinimumSize(labelDimension);
      passwordLabel.setPreferredSize(labelDimension);
      passwordLabel.setMaximumSize(labelDimension);
      passwordPanel.add(passwordLabel);
      passwordPanel.add(Box.createRigidArea(new Dimension(5, 0)));
      passField = new TextField();
      passField.setEchoChar('*');
      passField.setMinimumSize(new Dimension(EDIT_WIDTH, EDIT_HEIGHT));
      passField.setMaximumSize(new Dimension(EDIT_WIDTH + 300, EDIT_HEIGHT));
      passField.setFont(gFont);
      passField.setText(config.getPassword());
      passwordPanel.add(passField);

      mainPanel.add(passwordPanel);

      rememberPasswordCheckbox = new Checkbox("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();
          }
        });
  }
 private void configureStatusLabel(JLabel label, int width) {
   label.setMinimumSize(new Dimension(width, (int) label.getMinimumSize().getHeight()));
   label.setMaximumSize(new Dimension(width, (int) label.getMaximumSize().getHeight()));
   label.setPreferredSize(new Dimension(width, (int) label.getPreferredSize().getHeight()));
 }
  public MetaDataDeclarationWizardStep(WizardState state) {
    super("importwizard.metadata");
    limitedPreviewBox.setSelected(true);

    this.state = state;
    this.headerValidator = new MetaDataValidator(this, state.getTranslationConfiguration());
    dateFormatField.setEditable(true);
    dateFormatField.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            MetaDataDeclarationWizardStep.this
                .state
                .getTranslationConfiguration()
                .setDatePattern((String) dateFormatField.getSelectedItem());
          }
        });

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    buttonPanel.add(reloadButton);
    buttonPanel.add(guessButton);
    buttonPanel.add(limitedPreviewBox);

    JLabel label = new ResourceLabel("date_format");
    label.setLabelFor(dateFormatField);
    buttonPanel.add(label);
    buttonPanel.add(dateFormatField);
    panel.add(buttonPanel, BorderLayout.NORTH);

    JPanel errorPanel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.ipadx = c.ipady = 4;
    c.weighty = 0;
    c.weightx = 1;

    c.gridwidth = 1;
    c.weightx = 1;
    errorPanel.add(errorLabel, c);

    c.weightx = 0;
    c.gridwidth = GridBagConstraints.RELATIVE;
    errorPanel.add(errorsAsMissingBox, c);
    c.weightx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    errorPanel.add(filterErrorsBox, c);

    final JTable errorTable = new JTable(errorTableModel);
    errorTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                  final int selected = errorTable.getSelectedRow();
                  if (selected >= 0) {
                    ParsingError error = errorTableModel.getErrorInRow(selected);
                    int row = error.getExampleIndex();
                    row = filteredModel.inverseTranslateRow(row);
                    if (row == -1) {
                      return;
                    }
                    int col = error.getColumn();
                    previewTable.setRowSelectionInterval(row, row);
                    previewTable.setColumnSelectionInterval(col, col);
                  }
                }
              }
            });
    final JScrollPane errorScrollPane = new JScrollPane(errorTable);
    errorScrollPane.setPreferredSize(new Dimension(500, 80));
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    errorPanel.add(errorScrollPane, c);

    panel.add(errorPanel, BorderLayout.SOUTH);

    final JLabel dummy = new JLabel("-");
    dummy.setPreferredSize(new Dimension(500, 500));
    dummy.setMinimumSize(new Dimension(500, 500));
    tableScrollPane =
        new JScrollPane(
            dummy, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    panel.add(tableScrollPane, BorderLayout.CENTER);
  }