예제 #1
0
  /**
   * Sets the combo-boxes to a fixed size so they don't take up too much room that would be better
   * devoted to the test output box
   */
  protected void setComboSizes() {

    m_DatasetKeyBut.setPreferredSize(COMBO_SIZE);
    m_RunCombo.setPreferredSize(COMBO_SIZE);
    m_ResultKeyBut.setPreferredSize(COMBO_SIZE);
    m_CompareCombo.setPreferredSize(COMBO_SIZE);
    m_SigTex.setPreferredSize(COMBO_SIZE);

    m_DatasetKeyBut.setMaximumSize(COMBO_SIZE);
    m_RunCombo.setMaximumSize(COMBO_SIZE);
    m_ResultKeyBut.setMaximumSize(COMBO_SIZE);
    m_CompareCombo.setMaximumSize(COMBO_SIZE);
    m_SigTex.setMaximumSize(COMBO_SIZE);

    m_DatasetKeyBut.setMinimumSize(COMBO_SIZE);
    m_RunCombo.setMinimumSize(COMBO_SIZE);
    m_ResultKeyBut.setMinimumSize(COMBO_SIZE);
    m_CompareCombo.setMinimumSize(COMBO_SIZE);
    m_SigTex.setMinimumSize(COMBO_SIZE);

    // =============== BEGIN EDIT melville ===============
    m_PrecTex.setPreferredSize(COMBO_SIZE);
    m_PrecTex.setMaximumSize(COMBO_SIZE);
    m_PrecTex.setMinimumSize(COMBO_SIZE);
    // =============== END EDIT melville ===============
  }
예제 #2
0
  private void initComponents() {
    productNameLabel = new JLabel("Name: ");
    productNameTextField = new JTextField(25);
    saveToFileCheckBox = new JCheckBox("Save as:");
    productDirLabel = new JLabel("Directory:");
    productDirTextField = new JTextField(25);
    productDirChooserButton = new JButton(new ProductDirChooserAction());
    formatNameComboBox = new JComboBox(model.getFormatNames());
    openInAppCheckBox = new JCheckBox("Open in application");

    final Dimension size = new Dimension(26, 16);
    productDirChooserButton.setPreferredSize(size);
    productDirChooserButton.setMinimumSize(size);
    saveToFileCheckBox.addActionListener(new UIStateUpdater());
    formatNameComboBox.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            final String formatName = (String) formatNameComboBox.getSelectedItem();
            if (!canReadOutputFormat(formatName)) {
              model.setOpenInAppSelected(false);
            }
          }
        });
  }
예제 #3
0
  private JButton createButton(String text, String eventid, String shortcut, boolean def) {
    final JButton b = new JButton(text);
    b.setMaximumSize(new Dimension(80, b.getPreferredSize().height));
    b.setPreferredSize(new Dimension(80, b.getPreferredSize().height));
    b.setMinimumSize(new Dimension(80, b.getPreferredSize().height));
    b.setActionCommand(eventid);
    b.addActionListener(this);
    b.setMnemonic(shortcut.charAt(0));
    if ((shortcut != null) && (shortcut.length() > 0)) {
      this.eventKeyMap.put(Character.valueOf(shortcut.charAt(0)), eventid);
    }
    if (def) {
      getRootPane().setDefaultButton(b);
      b.requestFocus();
      addWindowListener(
          new WindowAdapter() {

            @Override
            public void windowActivated(WindowEvent e) {
              b.requestFocusInWindow();
            }
          });
    }
    b.addKeyListener(this.keyListener);
    SubstanceThemeHelper.setComponentToGeneralArea(b);
    return b;
  }
  public static JPanel createSelected(final JTextField textField, final JButton... btns) {
    final Dimension btnDim = new Dimension(18, 18);
    initComponentHeight(textField);
    final JPanel jp = new JPanel(new GridBagLayout());
    jp.setBorder(textField.getBorder());
    textField.setBorder(BorderFactory.createEmptyBorder());
    jp.setPreferredSize(textField.getPreferredSize());
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    jp.add(textField, gbc);

    gbc.weightx = 0.0;
    if (btns != null) {
      for (final JButton btn : btns) {
        gbc.gridx++;
        btn.setMaximumSize(btnDim);
        btn.setMinimumSize(btnDim);
        btn.setPreferredSize(btnDim);
        btn.setText("..");
        jp.add(btn, gbc);
      }
    }
    return jp;
  }
예제 #5
0
  /**
   * Create a new tab to the FlexiBar, with the specified title and the specified component inside
   * the tab.
   *
   * @param title the title of the tab to be added
   * @param comp the component inserted in the tab
   */
  public void add(String title, JComponent comp) {
    JButton button = new JButton(title);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            System.out.println("click");
            setSelected((JButton) arg0.getSource());
          }
        });
    button.setMinimumSize(new Dimension(this.B_WIDTH, this.B_HEIGHT));
    button.setMaximumSize(new Dimension(this.B_WIDTH, this.B_HEIGHT));
    button.setPreferredSize(new Dimension(this.B_WIDTH, this.B_HEIGHT));
    button.setAlignmentX(LEFT_ALIGNMENT);
    comp.setMinimumSize(new Dimension(this.P_WIDTH, this.P_HEIGHT));
    comp.setMaximumSize(new Dimension(this.P_WIDTH, this.P_HEIGHT));
    // comp.setPreferredSize(new Dimension(this.P_WIDTH,this.P_HEIGHT));
    comp.setAlignmentX(LEFT_ALIGNMENT);
    if (currentSelected == -1) {
      comp.setVisible(true);
      currentSelected = 0;
    } else comp.setVisible(false);

    listComponent.add(button);
    listComponent.add(comp);

    panel.add(button);
    panel.add(comp);
  }
예제 #6
0
  private void listPeople() {

    try {

      jScrollPane1.getViewport().setView(null);

      JFlowPanel jPeople = new JFlowPanel();
      jPeople.applyComponentOrientation(getComponentOrientation());

      java.util.List people = m_dlSystem.listPeopleVisible();

      for (int i = 0; i < people.size(); i++) {

        AppUser user = (AppUser) people.get(i);

        JButton btn = new JButton(new AppUserAction(user));
        btn.applyComponentOrientation(getComponentOrientation());
        btn.setFocusPainted(false);
        btn.setFocusable(false);
        btn.setRequestFocusEnabled(false);
        btn.setHorizontalAlignment(SwingConstants.LEADING);
        btn.setMaximumSize(new Dimension(150, 50));
        btn.setPreferredSize(new Dimension(150, 50));
        btn.setMinimumSize(new Dimension(150, 50));

        jPeople.add(btn);
      }
      jScrollPane1.getViewport().setView(jPeople);

    } catch (BasicException ee) {
      ee.printStackTrace();
    }
  }
  private LabeledComponent getGroupLabeledComponent() {
    if (groupLabeledComponent == null) {
      ListPanel pnl = getGroupListPanel();
      groupLabeledComponent = new LabeledComponent("Queries", new JScrollPane(pnl));
      groupLabeledComponent.setBorder(
          BorderFactory.createCompoundBorder(
              BorderFactory.createEmptyBorder(0, 2, 0, 2),
              BorderFactory.createLoweredBevelBorder()));

      JButton btn2 =
          groupLabeledComponent.addHeaderButton(
              new AbstractAction("Add Negated Query", Icons.getAddQueryLibraryIcon()) {
                public void actionPerformed(ActionEvent e) {
                  addNegatedQueryComponent();
                }
              });
      btn2.setText("Add Negated Query");
      // have to change the sizes to show the text
      final Dimension dim2 = new Dimension(100, btn2.getPreferredSize().height);
      btn2.setMinimumSize(dim2);
      btn2.setPreferredSize(dim2);
      btn2.setMaximumSize(dim2);

      JButton btn =
          groupLabeledComponent.addHeaderButton(
              new AbstractAction("Add another query", Icons.getAddQueryLibraryIcon()) {
                public void actionPerformed(ActionEvent e) {
                  addQueryComponent();
                }
              });
      btn.setText("Add Query");
      // have to change the sizes to show the text
      final Dimension dim = new Dimension(100, btn.getPreferredSize().height);
      btn.setMinimumSize(dim);
      btn.setPreferredSize(dim);
      btn.setMaximumSize(dim);

      btnAndQuery = new JRadioButton("Match All ", false);
      btnOrQuery = new JRadioButton("Match Any ", true);
      btn.getParent().add(btnAndQuery);
      btn.getParent().add(btnOrQuery);
      ButtonGroup group = new ButtonGroup();
      group.add(btnAndQuery);
      group.add(btnOrQuery);
    }
    return groupLabeledComponent;
  }
예제 #8
0
 /** force the search button to be large enough for the longer of the two texts */
 private void setSearchButtonSizes() {
   search.setText(Globals.lang("Search specified field(s)"));
   Dimension size1 = search.getPreferredSize();
   search.setText(Globals.lang("Search all fields"));
   Dimension size2 = search.getPreferredSize();
   size2.width = Math.max(size1.width, size2.width);
   search.setMinimumSize(size2);
   search.setPreferredSize(size2);
 }
예제 #9
0
  private void createGui() {
    final JPanel topPanel = new JPanel(new BorderLayout());

    final JPanel messagePanel = new JPanel(new BorderLayout());

    final JTextField messageField = new JTextField();
    messageField.setEditable(false);
    messageField.setText(message);
    messageField.setBackground(Color.WHITE);

    messagePanel.add(messageField);

    messagePanel.setBorder(new TitledBorder("Error Message"));

    topPanel.add(messagePanel, BorderLayout.NORTH);

    final JTabbedPane tabbedPane = new JTabbedPane();

    final JTextArea descriptionArea = new JTextArea();

    descriptionArea.setEditable(false);
    descriptionArea.setText(description);
    descriptionArea.setLineWrap(true);
    descriptionArea.setWrapStyleWord(true);

    tabbedPane.addTab("Description", descriptionArea);

    if (exception != null) {
      final JTextArea traceArea = new JTextArea();

      traceArea.setEditable(false);
      traceArea.setText(StackTrace.toString(exception.getStackTrace()));

      tabbedPane.addTab("Stack Trace", new JScrollPane(traceArea));
    }

    add(topPanel, BorderLayout.NORTH);
    add(tabbedPane);

    final JPanel bottomButtonPanel = new JPanel(new BorderLayout());
    final JPanel leftButtonPanelBottom = new JPanel();

    final JButton reportButton = new JButton(new ReportAction());
    reportButton.setMinimumSize(new Dimension(180, reportButton.getHeight()));

    leftButtonPanelBottom.add(reportButton);

    bottomButtonPanel.add(leftButtonPanelBottom, BorderLayout.WEST);

    final JPanel rightButtonPanelBottom = new JPanel();
    final JButton okButton = new JButton(new CloseButtonListener());
    getRootPane().setDefaultButton(okButton);
    rightButtonPanelBottom.add(okButton);
    bottomButtonPanel.add(rightButtonPanelBottom, BorderLayout.EAST);
    add(bottomButtonPanel, BorderLayout.SOUTH);
  }
예제 #10
0
  public JButton buildButton(String text) {
    JButton button = new JButton(text);
    button.addActionListener(this);

    button.setActionCommand(text);
    button.setMinimumSize(MipavUtil.defaultButtonSize);
    button.setPreferredSize(MipavUtil.defaultButtonSize);
    button.setFont(MipavUtil.font12B);

    return button;
  }
예제 #11
0
  @Override
  public List<AbstractButton> getButtons() {
    List<AbstractButton> buttons = new ArrayList<AbstractButton>();
    // JToggleButton and JButton are both javax.swing.AbstractButton

    // Toggle button
    JToggleButton buttonPoint = new JToggleButton();
    buttonPoint.setMargin(new Insets(0, 0, 0, 0));
    buttonPoint.setMinimumSize(new Dimension(16, 16));
    buttonPoint.setToolTipText("Mark reference point");
    try {
      buttonPoint.setIcon(new ImageIcon(StamperPS.class.getResource("icons/markPoint.png")));
    } catch (Exception e) {
      e.printStackTrace();
    }
    buttonPoint.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent itemEvent) {
            int state = itemEvent.getStateChange();
            if (state == ItemEvent.SELECTED) {
              toggleMarkReferencePoint(true);
            } else {
              toggleMarkReferencePoint(false);
            }
          }
        });
    buttonPoint.setToolTipText("Mark reference point");
    buttonPoint.setMargin(new Insets(0, 0, 0, 0));
    buttonPoint.setMinimumSize(new Dimension(16, 16));
    buttons.add(buttonPoint);
    // Clear Points button
    JButton buttonClearPoints = new JButton();
    buttonClearPoints.setMargin(new Insets(0, 0, 0, 0));
    buttonClearPoints.setMinimumSize(new Dimension(16, 16));
    buttonClearPoints.setToolTipText("Clear marked points");
    try {
      buttonClearPoints.setIcon(
          new ImageIcon(StamperPS.class.getResource("icons/markPointClear.png")));
    } catch (Exception e) {
      e.printStackTrace();
    }
    buttonClearPoints.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            clearMarkedPoints();
          }
        });
    buttons.add(buttonClearPoints);
    return buttons;
  }
예제 #12
0
파일: GUI.java 프로젝트: dylandb/QwirkleSS
  private void constructGamePanel() {
    JPanel gamePanel = new JPanel(new GridLayout(12, 16));
    gamePanel.setPreferredSize(new Dimension(480, 360));
    gamePanel.setMaximumSize(new Dimension(480, 360));
    leftPanel.add(gamePanel, BorderLayout.PAGE_START);

    for (int y = 0; y < 12; ++y) {
      for (int x = 0; x < 16; ++x) {
        JButton button = new JButton("*");
        button.setMinimumSize(new Dimension(30, 30));
        gamePanel.add(button);
      }
    }
  }
  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();
  }
예제 #14
0
 /**
  * This method initializes jButton3
  *
  * @return javax.swing.JButton
  */
 private JButton getSeButton() {
   if (seButton == null) {
     seButton = new JButton();
     seButton.setMaximumSize(new Dimension(64, 64));
     seButton.setPreferredSize(new Dimension(64, 64));
     seButton.setMinimumSize(new Dimension(64, 64));
     seButton.addMouseListener(
         new java.awt.event.MouseAdapter() {
           public void mouseEntered(java.awt.event.MouseEvent e) {
             rotateImages((JButton) e.getSource());
           }
         });
   }
   return seButton;
 }
예제 #15
0
  /**
   * This method initializes jButton
   *
   * @return javax.swing.JButton
   */
  private JButton getJButton() {
    if (jButton == null) {
      jButton = new JButton();
      jButton.setText("OK");
      jButton.setMinimumSize(jButton.getPreferredSize());
      jButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {

              ChoosProdsInDialogv2.this.setVisible((false));
            }
          });
    }
    return jButton;
  }
예제 #16
0
 /**
  * This method initializes jButton1
  *
  * @return javax.swing.JButton
  */
 private JButton getNeButton() {
   if (neButton == null) {
     neButton = new JButton();
     neButton.setMaximumSize(new Dimension(64, 64));
     neButton.setPreferredSize(new Dimension(64, 64));
     neButton.setIcon(Configuration.getSkin().icons()[1]);
     neButton.setMinimumSize(new Dimension(64, 64));
     neButton.addMouseListener(
         new java.awt.event.MouseAdapter() {
           public void mouseEntered(java.awt.event.MouseEvent e) {
             rotateImages((JButton) e.getSource());
           }
         });
   }
   return neButton;
 }
  private JComponent createSchemaBox() {
    schemaBox = new SchemaBox(this);

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
    panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, ThemeMediator.LIGHT_BORDER_COLOR));

    final String strShowOpts = I18n.tr("Show Options");
    final String strHideOpts = I18n.tr("Hide Options");

    // reusing schema box panel for more options button
    // minor optimization to keep the layout as flat as possible
    final JButton buttonOptions = new JButton(strShowOpts);
    buttonOptions.setContentAreaFilled(false);
    // buttonOptions.setBorderPainted(false);
    buttonOptions.setOpaque(false);

    Dimension dim = new Dimension(120, 30);
    buttonOptions.setMinimumSize(dim);
    buttonOptions.setMaximumSize(dim);
    buttonOptions.setPreferredSize(dim);
    buttonOptions.setSize(dim);
    // buttonOptions.setMargin(new Insets(0, 0, 0, 0));
    // buttonOptions.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0,
    // ThemeMediator.LIGHT_BORDER_COLOR));

    buttonOptions.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            scrollPaneSearchOptions.setVisible(!scrollPaneSearchOptions.isVisible());

            buttonOptions.setText(scrollPaneSearchOptions.isVisible() ? strHideOpts : strShowOpts);
          }
        });

    JSeparator sep = new JSeparator(SwingConstants.VERTICAL);
    sep.setMaximumSize(new Dimension(2, 100));

    panel.add(schemaBox);
    panel.add(Box.createHorizontalGlue());
    panel.add(sep);
    panel.add(buttonOptions);

    return panel;
  }
예제 #18
0
  private void initComponents() {
    productNameLabel = new JLabel("Name: ");
    productNameTextField = new JTextField(25);
    productDirLabel = new JLabel("Directory:");
    productDirTextField = new JTextField(25);
    productDirChooserButton = new JButton(new ProductDirChooserAction());

    final Dimension size = new Dimension(26, 16);
    productDirChooserButton.setPreferredSize(size);
    productDirChooserButton.setMinimumSize(size);

    if (!alwaysWriteOutput) {
      saveToFileCheckBox = new JCheckBox("Save as:");
      formatNameComboBox = new JComboBox<>(model.getFormatNames());
      openInAppCheckBox = new JCheckBox("Open in application");
    }
  }
예제 #19
0
  /**
   * This method initializes btnStop
   *
   * @return javax.swing.JButton
   */
  private JButton getBtnCancel() {
    if (btnCancel == null) {
      btnCancel = new JButton();
      btnCancel.setText(Constant.messages.getString("brk.add.button.cancel"));
      btnCancel.setMaximumSize(new java.awt.Dimension(100, 40));
      btnCancel.setMinimumSize(new java.awt.Dimension(70, 30));
      btnCancel.setPreferredSize(new java.awt.Dimension(70, 30));
      btnCancel.setEnabled(true);
      btnCancel.addActionListener(
          new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
              extension.hideBreakAddDialog();
            }
          });
    }
    return btnCancel;
  }
예제 #20
0
  /**
   * This method initializes btnStart
   *
   * @return javax.swing.JButton
   */
  private JButton getBtnAdd() {
    if (btnAdd == null) {
      btnAdd = new JButton();
      btnAdd.setText(Constant.messages.getString("brk.add.button.add"));
      btnAdd.setMinimumSize(new java.awt.Dimension(75, 30));
      btnAdd.setPreferredSize(new java.awt.Dimension(75, 30));
      btnAdd.setMaximumSize(new java.awt.Dimension(100, 40));
      btnAdd.addActionListener(
          new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent e) {
              extension.addBreakPoint(getTxtDisplay().getText());
              extension.hideBreakAddDialog();
            }
          });
    }
    return btnAdd;
  }
예제 #21
0
  protected void initUI() {

    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();

    setLayout(layout);

    statusField.setFont(textFont);
    statusField.setRequestFocusEnabled(false);
    statusField.setEditable(false);

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    // constraints.weightx = 0.1;
    add(statusField, constraints);

    hostField.setFont(textFont);
    hostField.setRequestFocusEnabled(false);
    hostField.setEditable(false);
    hostField.setText("");

    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 0.5;
    add(hostField, constraints);

    cancelButton.setMaximumSize(new Dimension(20, 20));
    cancelButton.setMinimumSize(new Dimension(20, 20));
    cancelButton.setPreferredSize(new Dimension(20, 20));
    cancelButton.setEnabled(false);
    cancelButton.addActionListener(this);

    constraints.gridx = 2;
    constraints.gridy = 0;
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.PAGE_END;
    add(cancelButton, constraints);

    // setBorder(BorderFactory.createEtchedBorder());

  }
예제 #22
0
 /* WARNING: THIS METHOD WILL BE REGENERATED. */
 private javax.swing.JButton getOKButton() {
   if (ivjOKButton == null) {
     try {
       ivjOKButton = new javax.swing.JButton();
       ivjOKButton.setName("OKButton");
       ivjOKButton.setPreferredSize(new java.awt.Dimension(80, 25));
       ivjOKButton.setText("OK");
       ivjOKButton.setMaximumSize(new java.awt.Dimension(80, 25));
       ivjOKButton.setMinimumSize(new java.awt.Dimension(80, 25));
       // user code begin {1}
       // user code end
     } catch (java.lang.Throwable ivjExc) {
       // user code begin {2}
       // user code end
       handleException(ivjExc);
     }
   }
   return ivjOKButton;
 }
예제 #23
0
  /**
   * This method initializes btnStart
   *
   * @return javax.swing.JButton
   */
  private JButton getBtnAdd() {
    if (btnAdd == null) {
      btnAdd = new JButton();
      btnAdd.setText(Constant.messages.getString("history.managetags.button.add"));
      btnAdd.setMinimumSize(new java.awt.Dimension(75, 30));
      btnAdd.setPreferredSize(new java.awt.Dimension(75, 30));
      btnAdd.setMaximumSize(new java.awt.Dimension(100, 40));
      btnAdd.addActionListener(
          new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
              addTag(getTxtTagAdd().getSelectedItem().toString());
              getTxtTagAdd().setSelectedIndex(0);
            }
          });
    }
    return btnAdd;
  }
예제 #24
0
  /**
   * This method initializes btnDelete
   *
   * @return javax.swing.JButton
   */
  private JButton getBtnDelete() {
    if (btnDelete == null) {
      btnDelete = new JButton();
      btnDelete.setText(Constant.messages.getString("history.managetags.button.delete"));
      btnDelete.setMinimumSize(new java.awt.Dimension(75, 30));
      btnDelete.setPreferredSize(new java.awt.Dimension(75, 30));
      btnDelete.setMaximumSize(new java.awt.Dimension(100, 40));
      btnDelete.setEnabled(true);
      btnDelete.addActionListener(
          new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
              deleteTags(tagList.getSelectedValuesList());
            }
          });
    }
    return btnDelete;
  }
예제 #25
0
  private JButton getBtnSave() {
    if (btnSave == null) {
      btnSave = new JButton();
      btnSave.setText(Constant.messages.getString("history.managetags.button.save"));
      btnSave.setMinimumSize(new java.awt.Dimension(75, 30));
      btnSave.setPreferredSize(new java.awt.Dimension(75, 30));
      btnSave.setMaximumSize(new java.awt.Dimension(100, 40));
      btnSave.setEnabled(true);
      btnSave.addActionListener(
          new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
              save();
              extension.hideManageTagsDialog();
            }
          });
    }
    return btnSave;
  }
  // Button UI
  void drawButtonsPanel() {

    // ***** OK BUTTON *****
    okButton = new JButton();
    okButton.setMaximumSize(new Dimension(100, 26));
    okButton.setMinimumSize(new Dimension(100, 26));
    okButton.setPreferredSize(new Dimension(100, 26));
    okButton.setText(Local.getString("Ok"));
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            okButton_actionPerformed(e);
          }
        });

    // ***** PANEL *****
    buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.setBorder(defaultBorder);
    buttonPanel.add(okButton);
    this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
  }
  /**
   * If the add button is pressed, this function creates a spot for it in the scroll pane, and tells
   * the restaurant panel to add a new person.
   *
   * @param name name of new person
   */
  public void addPerson(String name, boolean isHungry) {
    if (name != null) {
      JButton button = new JButton(name);
      button.setBackground(Color.white);

      Dimension paneSize = scrollPane.getSize();
      Dimension buttonSize =
          new Dimension(
              (paneSize.width / NUM_BUTTONS_COLS) - BUTTON_WIDTH_ADJUST,
              paneSize.height / NUM_BUTTONS_ROWS);
      button.setPreferredSize(buttonSize);
      button.setMinimumSize(buttonSize);
      button.setMaximumSize(buttonSize);
      button.addActionListener(this);
      list.add(button);
      view.add(button);
      if (isHungry)
        restPanel.addPerson(null, "Hungry" + type, name, 50); // puts hungry customer on list
      else restPanel.addPerson(null, type, name, 50); // puts customer on list
      //        restPanel.showInfo(type, name);//puts hungry button on panel
      validate();
    }
  }
예제 #28
0
  /**
   * Create control panel on top of window
   *
   * @return
   */
  JPanel createControlPane() {
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));

    // Create button to open options menu
    JButton optionsButton = new JButton();
    optionsButton.setMinimumSize(new Dimension(30, 30));
    optionsButton.setPreferredSize(new Dimension(30, 30));
    optionsButton.setMaximumSize(new Dimension(30, 30));
    optionsButton.setIcon(new Util().createImageIcon("/images/gear.png", "Options"));
    optionsButton.addActionListener(
        gui.collapsiblePane.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION));

    // Create Search bar
    final JTextField filterField = new JTextField(24);
    filterField.setMaximumSize(filterField.getPreferredSize());
    filterField.setFont(new Font(Font.SERIF, Font.ITALIC, 12));
    filterField.setText(" Search");
    // Whenever filterText changes, invoke newFilter.
    filterField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                if (!filterField.getText().equals(" Search")) {
                  gui.newFilter(filterField.getText());
                }
              }

              public void insertUpdate(DocumentEvent e) {
                if (!filterField.getText().equals(" Search")) {
                  gui.newFilter(filterField.getText());
                }
              }

              public void removeUpdate(DocumentEvent e) {
                if (!filterField.getText().equals(" Search")) {
                  gui.newFilter(filterField.getText());
                }
              }
            });

    filterField.addFocusListener(
        new FocusListener() {

          @Override
          public void focusGained(FocusEvent arg0) {
            if (filterField.getText().equals(" Search")) {
              filterField.setFont(new Font(Font.SERIF, Font.PLAIN, 12));
              filterField.setText("");
            }
          }

          @Override
          public void focusLost(FocusEvent arg0) {
            if (filterField.getText().equals("")) {
              filterField.setFont(new Font(Font.SERIF, Font.ITALIC, 12));
              filterField.setText(" Search");
            }
          }
        });

    // Add components to top pane
    topPanel.add(Box.createRigidArea(new Dimension(5, 40)));
    topPanel.add(optionsButton);
    topPanel.add(Box.createRigidArea(new Dimension(100, 40)));
    topPanel.add(Box.createHorizontalGlue());
    topPanel.add(infoLabel);
    topPanel.add(Box.createHorizontalGlue());
    topPanel.add(filterField);
    topPanel.add(Box.createRigidArea(new Dimension(5, 40)));

    return topPanel;
  }
예제 #29
0
  /**
   * Draws the GUI that allows a user to select assets to be updated.
   *
   * @return true if the user made a valid choice of assets to replace.
   * @throws PipelineException
   */
  private boolean buildUpdateGUI() throws PipelineException {
    Box finalBox = new Box(BoxLayout.Y_AXIS);
    top = new Box(BoxLayout.Y_AXIS);

    JScrollPane scroll;

    {
      scroll = new JScrollPane(finalBox);

      scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
      scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

      Dimension size = new Dimension(sVSize + sVSize + sTSize + 52, 500);
      scroll.setMinimumSize(size);
      scroll.setPreferredSize(size);
      scroll.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
    }

    /* query the user */
    diag = new JToolDialog("Propagate Asset", scroll, "Continue");

    areas = mclient.getWorkingAreas();
    {
      Box hbox = new Box(BoxLayout.X_AXIS);
      Component comps[] = UIFactory.createTitledPanels();
      JPanel tpanel = (JPanel) comps[0];
      JPanel vpanel = (JPanel) comps[1];
      {
        userField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "User:"******"The user whose area the node is being created in.");
        userField.setActionCommand("user");
        userField.setSelected(PackageInfo.sUser);
        userField.addActionListener(this);
      }
      UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
      {
        viewField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "View:",
                sTSize,
                vpanel,
                areas.get(PackageInfo.sUser),
                diag,
                sVSize,
                "The working area to create the nodes in.");
        viewField.setActionCommand("wrap");
        viewField.addActionListener(this);
      }
      UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
      {
        toolsetField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "Toolset:",
                sTSize,
                vpanel,
                mclient.getActiveToolsetNames(),
                diag,
                sVSize,
                "The toolset to set on all the nodes.");
        toolsetField.setSelected(mclient.getDefaultToolsetName());
        toolsetField.setActionCommand("wrap");
        toolsetField.addActionListener(this);
      }
      UIFactory.addVerticalSpacer(tpanel, vpanel, 3);

      w =
          new Wrapper(
              userField.getSelected(),
              viewField.getSelected(),
              toolsetField.getSelected(),
              mclient);

      charList = SonyConstants.getAssetList(w, project, AssetType.CHARACTER);
      setsList = SonyConstants.getAssetList(w, project, AssetType.SET);
      propsList = SonyConstants.getAssetList(w, project, AssetType.PROP);

      {
        projectField =
            UIFactory.createTitledCollectionField(
                tpanel,
                "Project:",
                sTSize,
                vpanel,
                Globals.getChildrenDirs(w, "/projects"),
                diag,
                sVSize,
                "All the projects in pipeline.");
        projectField.setActionCommand("proj");
        projectField.addActionListener(this);
      }
      hbox.add(comps[2]);
      top.add(hbox);
    }

    {
      Box vbox = new Box(BoxLayout.Y_AXIS);
      Box hbox = new Box(BoxLayout.X_AXIS);
      JButton button = new JButton("Propagate Additional Asset");
      button.setName("ValuePanelButton");
      button.setRolloverEnabled(false);
      button.setFocusable(false);
      Dimension d = new Dimension(sVSize, 25);
      button.setPreferredSize(d);
      button.setMinimumSize(d);
      button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 25));

      vbox.add(Box.createRigidArea(new Dimension(0, 5)));
      hbox.add(button);
      hbox.add(Box.createRigidArea(new Dimension(4, 0)));
      vbox.add(hbox);
      vbox.add(Box.createRigidArea(new Dimension(0, 5)));

      button.setActionCommand("add");
      button.addActionListener(this);

      top.add(vbox);
    }

    list = new Box(BoxLayout.Y_AXIS);
    test = new JDrawer("Propagate Additional Asset", list, false);

    top.add(test);
    list.add(assetChoiceBox());

    finalBox.add(top);

    {
      JPanel spanel = new JPanel();
      spanel.setName("Spacer");
      spanel.setMinimumSize(new Dimension(sTSize + sVSize, 7));
      spanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
      spanel.setPreferredSize(new Dimension(sTSize + sVSize, 7));
      finalBox.add(spanel);
    }

    diag.setVisible(true);
    if (diag.wasConfirmed()) {
      // get list of things to change.
      for (Component comp : list.getComponents()) {
        if (comp instanceof Box) {
          Box can = (Box) comp;
          JCollectionField oldOne = (JCollectionField) can.getComponent(2);
          JCollectionField newOne = (JCollectionField) can.getComponent(4);

          TreeMap<String, String> assetList = new TreeMap<String, String>();
          assetList.putAll(charList);
          assetList.putAll(propsList);
          assetList.putAll(setsList);

          String key = assetList.get(oldOne.getSelected()) + lr;
          String value = assetList.get(newOne.getSelected()) + lr;
          if (!key.equals(value)) {
            potentialUpdates.add(key);
            pAssetManager.put(key, new AssetInfo(key, value));
          }
          // System.err.println("bUG: "+pAssetManager.get(key).getHiLoResShots());
        }
      }

      if (!pAssetManager.isEmpty()) return true;
    }
    return false;
  } // end buildReplacementGUI
예제 #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();
          }
        });
  }