/** Initializes contained components. */
  private void initComponents() {
    final SimpleDateFormat format = new SimpleDateFormat("mm:ss");
    final Calendar c = Calendar.getInstance();
    final JLabel counter = new JLabel();

    counter.setForeground(Color.red);
    counter.setFont(counter.getFont().deriveFont((float) (counter.getFont().getSize() + 5)));

    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    GridBagConstraints constraints = new GridBagConstraints();

    JLabel messageLabel =
        new JLabel(
            GuiActivator.getResources().getI18NString("service.gui.security.SECURITY_ALERT"));

    messageLabel.setForeground(Color.WHITE);

    constraints.anchor = GridBagConstraints.CENTER;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 0;
    add(messageLabel, constraints);

    constraints.anchor = GridBagConstraints.CENTER;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 0;
    constraints.gridy = 1;
    add(counter, constraints);

    ZrtpControl zrtpControl = null;
    if (securityControl instanceof ZrtpControl) zrtpControl = (ZrtpControl) securityControl;

    long initialSeconds = 0;

    if (zrtpControl != null) initialSeconds = zrtpControl.getTimeoutValue();

    c.setTimeInMillis(initialSeconds);

    counter.setText(format.format(c.getTime()));

    if (initialSeconds > 0)
      timer.schedule(
          new TimerTask() {
            @Override
            public void run() {
              if (c.getTimeInMillis() - 1000 > 0) {
                c.add(Calendar.SECOND, -1);
                counter.setText(format.format(c.getTime()));
              }
            }
          },
          1000,
          1000);
  }
Example #2
0
  public ManageBankView() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 0, 0, 0, 0};
    gridBagLayout.rowHeights = new int[] {0, 0, 0, 0, 0};
    gridBagLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    getContentPane().setLayout(gridBagLayout);

    JLabel lblEnterBank = new JLabel("Enter Bank");
    GridBagConstraints gbc_lblEnterBank = new GridBagConstraints();
    gbc_lblEnterBank.insets = new Insets(0, 0, 5, 5);
    gbc_lblEnterBank.gridx = 1;
    gbc_lblEnterBank.gridy = 1;
    getContentPane().add(lblEnterBank, gbc_lblEnterBank);

    txtBankName = new JTextField();
    GridBagConstraints gbc_txtBankName = new GridBagConstraints();
    gbc_txtBankName.insets = new Insets(0, 0, 5, 0);
    gbc_txtBankName.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtBankName.gridx = 3;
    gbc_txtBankName.gridy = 1;
    getContentPane().add(txtBankName, gbc_txtBankName);
    txtBankName.setColumns(10);

    JButton btnAdd = new JButton("Add");
    GridBagConstraints gbc_btnAdd = new GridBagConstraints();
    gbc_btnAdd.insets = new Insets(0, 0, 0, 5);
    gbc_btnAdd.gridx = 1;
    gbc_btnAdd.gridy = 3;
    getContentPane().add(btnAdd, gbc_btnAdd);
  }
Example #3
0
        {
          setLayout(new GridBagLayout()); // Elrendezés beállítása
          GridBagConstraints c = new GridBagConstraints(); // Szükséges konstans

          JLabel lbUsername = new JLabel("Felhasználónév"); // A felhasználónév címkéje
          JLabel lbPassword = new JLabel("Jelszó"); // A jelszó címkéje

          lbUsername.setIcon(RM.getUsernameIcon()); // "felhasználónév" címke Ikonjának beállítása
          lbPassword.setIcon(RM.getPasswordIcon()); // "Jelszó" címke Ikonjának beállítása

          lbUsername.setPreferredSize(new Dimension(120, 25)); // Címke átméretezése
          lbPassword.setPreferredSize(new Dimension(120, 25)); // Címke átméretezése

          // [0,0]
          c.gridx = 0; // oszlop
          c.gridy = 0; // sor
          add(lbUsername, c); // a "Felhasználónév" címke hozzáadása

          // [1,0]
          c.gridx = 1;
          add(tfUsername, c); // A "felhasználónév" szövegmező hozzáadása

          // [0,1]
          c.gridx = 0;
          c.gridy = 1;
          add(lbPassword, c); // A "Jelszó" címke hozzáadása

          // [1,1]
          c.gridx = 1;
          c.gridy = 1;
          add(pfPassword, c); // A "jelszó" jelszómező hozzáadása
        }
  private void initLayout() {
    this.setLayout(new GridBagLayout());
    GridBagConstraints c = null;

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(10, 0, 10, 0);
    this.add(this.initControllPanel(), c);

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(10, 0, 10, 0);
    this.add(this.initClassPanel(), c);

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 0.5;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(this.initRelationPanel(), c);

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 3;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.BOTH;
    this.add(new JPanel(), c);
  }
Example #5
0
  public SettingsFrame() {
    thisFrame = this;
    setTitle(StringConstants.FRAME_SETTINGS);
    setSize(UiConstants.WIN_34_DIM);
    setLocationByPlatform(true);
    setResizable(false);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    // add the content panel
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.setBackground(Color.WHITE);

    tabbedPane.addTab(StringConstants.TAB_GENERAL, new TabGeneral());

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 100;
    c.weighty = 98;
    add(tabbedPane, c);

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 2;
    c.weightx = 100;
    c.weighty = 0;

    // button panel
    add(new OKPanel(), c);
  }
Example #6
0
  private void createLayout() {
    mViewDocButton.setHorizontalAlignment(SwingConstants.LEFT);
    mViewDocButton.setEnabled(false);
    mLinksScrollPane.getViewport().add(mLinksList);
    setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = GUIConstants.INSETS;
    constraints.gridwidth = 1;

    constraints.gridheight = 2;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.BOTH;
    add(mLinksScrollPane, constraints);

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridheight = 1;
    constraints.gridx = 1;
    add(mViewDocButton, constraints);
  }
  /**
   * Creates a new NewStringPopupDialog object.
   *
   * @param parent DOCUMENT ME!
   * @param title DOCUMENT ME!
   */
  public NewStringPopupDialog(Frame parent, String title) {
    super(parent, true);
    setTitle(title);
    textField = new JTextField();
    textField.setPreferredSize(new Dimension(200, 25));
    theString = null;

    JButton okButton = new JButton("OK");
    JButton cancelButton = new JButton("Cancel");
    okButton.addActionListener(new OkAction());
    cancelButton.addActionListener(new CancelAction());

    JPanel panel = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    panel.setLayout(gridbag);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    gridbag.setConstraints(textField, c);
    panel.add(textField);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    gridbag.setConstraints(okButton, c);
    panel.add(okButton);
    c.gridx = 1;
    c.gridy = 1;
    gridbag.setConstraints(cancelButton, c);
    panel.add(cancelButton);
    setContentPane(panel);
    pack();
    setLocationRelativeTo(parent);
    setVisible(true);
  }
Example #8
0
  private void initUI() {
    names.add("帐号");
    names.add("金额");
    defaultTableModel = new MyDefaultTableModel(names, 0);
    table = new MyTable(defaultTableModel);

    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;

    gbc.gridx = gbc.gridy = 0;
    gbc.gridwidth = 4;
    this.add(new JScrollPane(table), gbc);

    // gbc.weightx=gbc.weighty=0.0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridwidth = 1;
    gbc.gridy++;
    gbc.gridx = 1;
    this.add(addbt, gbc);
    gbc.gridx++;
    this.add(deletebt, gbc);
    gbc.gridx++;
    this.add(refreshbt, gbc);

    gbc.gridy++;
    gbc.gridx = 1;
    this.add(new BlankBlock(), gbc);
  }
    public void addRow(String label, JComponent component) {
      GridBagConstraints labelConstraints = new GridBagConstraints();
      labelConstraints.gridx = 0;
      labelConstraints.gridy = rowCount;
      labelConstraints.insets = new Insets(0, 0, 5, 5);
      labelConstraints.anchor = GridBagConstraints.LINE_END;

      GridBagConstraints componentConstraints = new GridBagConstraints();
      componentConstraints.gridx = 1;
      componentConstraints.gridy = rowCount;
      componentConstraints.gridwidth = GridBagConstraints.REMAINDER;
      componentConstraints.fill = GridBagConstraints.HORIZONTAL;
      componentConstraints.insets = new Insets(0, 0, 5, 0);
      componentConstraints.anchor = GridBagConstraints.LINE_START;

      JLabel l = new JLabel(label + ":");
      add(l, labelConstraints);
      add(component, componentConstraints);
      rowCount++;

      // Add another column/row that takes up all available space.
      // This moves the layout to the top-left corner.
      layout.columnWidths = new int[] {0, 0, 0};
      layout.columnWeights = new double[] {0.0, 0.0, 1.0E-4};
      layout.rowHeights = new int[rowCount + 1];
      layout.rowWeights = new double[rowCount + 1];
      layout.rowWeights[rowCount] = 1.0E-4;
    }
Example #10
0
  private static JPanel makePanel(String title, String href) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createTitledBorder(title));

    JLabel label = new JLabel(href);

    JEditorPane editor = new JEditorPane("text/html", href);
    editor.setOpaque(false);
    editor.setEditable(false);
    editor.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    GridBagConstraints c = new GridBagConstraints();
    c.gridheight = 1;

    c.gridx = 0;
    c.insets = new Insets(5, 5, 5, 0);
    c.anchor = GridBagConstraints.EAST;
    c.gridy = 0;
    p.add(new JLabel("JLabel: "), c);
    c.gridy = 2;
    p.add(new JLabel("JEditorPane: "), c);

    c.gridx = 1;
    c.weightx = 1d;
    c.anchor = GridBagConstraints.WEST;
    c.gridy = 0;
    p.add(label, c);
    c.gridy = 2;
    p.add(editor, c);

    return p;
  }
Example #11
0
  private void initialize() {
    setName("JunkPanel");
    setLayout(new GridBagLayout());
    refreshLanguage();

    // Adds all of the components
    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.WEST;
    final Insets insets5555 = new Insets(5, 5, 5, 5);
    constraints.insets = insets5555;
    constraints.weightx = 1.0;
    constraints.gridwidth = 1;
    constraints.gridy = 0;

    constraints.insets = insets5555;
    constraints.gridx = 0;

    add(hideJunkMessagesCheckBox, constraints);

    constraints.gridy++;

    add(markJunkIdentityBadCheckBox, constraints);

    constraints.gridy++;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    {
      final JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
      add(separator, constraints);
    }
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridy++;

    add(stopBoardUpdatesWhenDosedCheckBox, constraints);

    constraints.gridy++;

    {
      final JPanel subPanel = new JPanel(new GridBagLayout());
      final GridBagConstraints subConstraints = new GridBagConstraints();
      subConstraints.insets = new Insets(0, 10, 0, 10);
      subConstraints.anchor = GridBagConstraints.WEST;
      subConstraints.gridx = 0;
      subPanel.add(LinvalidSubsequentMessagesThreshold, subConstraints);
      subConstraints.gridx = 1;
      subPanel.add(TfInvalidSubsequentMessagesThreshold, subConstraints);

      add(subPanel, constraints);
    }

    // glue
    constraints.gridy++;
    constraints.gridx = 0;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 1;
    add(new JLabel(""), constraints);

    // Add listeners
    stopBoardUpdatesWhenDosedCheckBox.addActionListener(listener);
  }
Example #12
0
 /**
  * This method initializes AggButtonPanel
  *
  * @return javax.swing.JPanel
  */
 private JPanel getAggButtonPanel() {
   if (AggButtonPanel == null) {
     GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
     gridBagConstraints21.gridx = 0;
     gridBagConstraints21.gridy = 4;
     GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
     gridBagConstraints11.gridx = 0;
     gridBagConstraints11.gridy = 3;
     GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
     gridBagConstraints2.gridx = 0;
     gridBagConstraints2.gridy = 2;
     GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
     gridBagConstraints1.gridx = 0;
     gridBagConstraints1.gridy = 1;
     GridBagConstraints gridBagConstraints = new GridBagConstraints();
     gridBagConstraints.gridx = 0;
     gridBagConstraints.gridy = 0;
     AggButtonPanel = new JPanel();
     AggButtonPanel.setLayout(new GridBagLayout());
     AggButtonPanel.add(getAggAdd(), gridBagConstraints);
     AggButtonPanel.add(getAggRemove(), gridBagConstraints1);
     AggButtonPanel.add(getAggEdit(), gridBagConstraints2);
     AggButtonPanel.add(getDoneButton(), gridBagConstraints11);
     AggButtonPanel.add(getAbort(), gridBagConstraints21);
   }
   return AggButtonPanel;
 }
Example #13
0
  private JPanel getUpdatePanel() {
    if (updatePanel == null) {
      updatePanel = new JPanel(new GridBagLayout());
      updatePanel.setBorder(new EmptyBorder(0, 30, 0, 5));
      final GridBagConstraints constraints = new GridBagConstraints();
      constraints.insets = new Insets(0, 5, 5, 5);
      constraints.weighty = 0;
      constraints.weightx = 0;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.gridy = 0;

      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.gridx = 0;
      constraints.weightx = 0.5;
      updatePanel.add(minimumIntervalLabel, constraints);
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.weightx = 1;
      updatePanel.add(minimumIntervalTextField, constraints);

      constraints.insets =
          new Insets(0, 5, 0, 5); // we have a bottom inset in the containing layout!
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.gridx = 0;
      constraints.gridy++;
      constraints.weightx = 0.5;
      updatePanel.add(concurrentUpdatesLabel, constraints);
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.weightx = 1;
      updatePanel.add(concurrentUpdatesTextField, constraints);
    }
    return updatePanel;
  }
  private JPanel getPredefinedSettingsPanel() {
    if (predefinedSettingsPanel == null) {
      predefinedSettingsPanel = new JPanel();
      predefinedSettingsPanel.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createEtchedBorder(), "Predefined settings"));
      predefinedSettingsPanel.setLayout(new GridBagLayout());

      GridBagConstraints c = new GridBagConstraints();

      c.fill = GridBagConstraints.HORIZONTAL;
      c.insets = new Insets(5, 5, 5, 5);
      c.anchor = GridBagConstraints.PAGE_START;

      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 3;
      predefinedSettingsPanel.add(new JLabel("Set all rendering settings towards:"), c);

      c.weightx = 1f / 3;
      c.gridwidth = 1;
      c.gridy = 2;
      predefinedSettingsPanel.add(getPredefinedPlatformDefaultButton(), c);
      c.gridx = 1;
      predefinedSettingsPanel.add(getPredefinedSpeedButton(), c);
      c.gridx = 2;
      predefinedSettingsPanel.add(getPredefinedQualityButton(), c);
    }
    return predefinedSettingsPanel;
  }
  public void redrawCommande() {
    itemPanel.removeAll();
    OrderedItem orders[] = commande.getOrders();
    GridBagConstraints c = new GridBagConstraints();
    c.gridy = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.BOTH;
    for (int i = 0; i < orders.length; i++) {
      c.gridx = 0;

      JPanel itemLabelHolder = new JPanel();
      itemLabelHolder.add(new JLabel(orders[i].getItem().getNom()));
      itemLabelHolder.setBackground(Color.WHITE);
      itemLabelHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE));

      itemPanel.add(itemLabelHolder, c);
      c.gridx = 1;
      itemPanel.add(new OrderedItemPanel(orders[i]), c);
      c.gridx = 2;
      JButton killButton = new JButton("\u2716");
      killButton.setBackground(Color.RED);
      killButton.setForeground(Color.WHITE);
      killButton.addActionListener(getHandler());
      killButton.setActionCommand("CDelete" + i);
      JPanel buttonHolder = new JPanel();
      buttonHolder.add(killButton);

      itemPanel.add(buttonHolder, c);
    }
    validate();
    repaint();
  }
  /**
   * public MutableStatusBar(String s1, String s2, String s3) { super(); status_1 = new JLabel(s1);
   * status_2 = new JLabel(s2); status_3 = new JLabel(s3); this.init(); }.
   */
  protected void init() {
    this.setLayout(new GridBagLayout());
    this.setBorder(BorderFactory.createEmptyBorder(3, 2, 1, 1));
    final GridBagConstraints constraints = new GridBagConstraints();

    // status_1.setHorizontalAlignment(JLabel.CENTER);
    status_1.setBorder(
        new CompoundBorder(
            new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2)));
    status_1.setPreferredSize(new Dimension(180, 16));

    status_2.setBorder(
        new CompoundBorder(
            new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2)));
    status_2.setPreferredSize(new Dimension(200, 16));

    status_3.setBorder(
        new CompoundBorder(
            new SoftBevelBorder(SoftBevelBorder.LOWERED), new EmptyBorder(0, 2, 0, 2)));
    status_3.setPreferredSize(new Dimension(300, 16));

    greenStatusIcon =
        new MutableImageLabel(resource.getIcon("green_off.gif"), resource.getIcon("green_on.gif"));
    greenStatusIcon.setBorder(new EmptyBorder(2, 2, 2, 1));

    redStatusIcon =
        new MutableImageLabel(resource.getIcon("red_off.gif"), resource.getIcon("red_on.gif"));
    redStatusIcon.setBorder(new EmptyBorder(2, 1, 2, 3));
    // =====================================================================

    constraints.insets = new Insets(0, 0, 0, 4);
    constraints.anchor = GridBagConstraints.EAST;
    constraints.fill = GridBagConstraints.VERTICAL;

    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    this.add(status_1, constraints);

    constraints.weightx = 0.0;
    constraints.gridx++;
    this.add(status_2, constraints);

    constraints.gridx = 2;
    this.add(status_3, constraints);

    constraints.gridx++;
    if (greenStatusIcon != null) {
      this.add(greenStatusIcon, constraints);
    }

    constraints.insets = new Insets(0, 0, 0, 0);
    constraints.gridx++;
    if (redStatusIcon != null) {
      this.add(redStatusIcon, constraints);
    }
  }
  protected JComponent createNorthPanel() {
    myNameField = new NameSuggestionsField(myProject);
    myNameChangedListener =
        new NameSuggestionsField.DataChanged() {
          public void dataChanged() {
            updateOkStatus();
          }
        };
    myNameField.addDataChangedListener(myNameChangedListener);

    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gbConstraints = new GridBagConstraints();

    gbConstraints.insets = JBUI.insets(4);
    gbConstraints.anchor = GridBagConstraints.WEST;
    gbConstraints.fill = GridBagConstraints.BOTH;

    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 0;
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 0;
    JLabel type = new JLabel(RefactoringBundle.message("variable.of.type"));
    panel.add(type, gbConstraints);

    gbConstraints.gridx++;
    myTypeSelector = myTypeSelectorManager.getTypeSelector();
    panel.add(myTypeSelector.getComponent(), gbConstraints);

    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 0;
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 1;
    JLabel namePrompt = new JLabel(RefactoringBundle.message("name.prompt"));
    namePrompt.setLabelFor(myNameField.getComponent());
    panel.add(namePrompt, gbConstraints);

    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 1;
    gbConstraints.gridx = 1;
    gbConstraints.gridy = 1;
    panel.add(myNameField.getComponent(), gbConstraints);

    myNameSuggestionsManager =
        new NameSuggestionsManager(
            myTypeSelector,
            myNameField,
            new NameSuggestionsGenerator() {
              public SuggestedNameInfo getSuggestedNameInfo(PsiType type) {
                return IntroduceVariableBase.getSuggestedName(type, myExpression);
              }
            });
    myNameSuggestionsManager.setLabelsFor(type, namePrompt);

    return panel;
  }
Example #18
0
  private void repaintContent() {
    if (content != null) {
      remove(content);
    }
    content = new JPanel();

    content.setLayout(new GridBagLayout());
    content.setBackground(Colors.TEMPLATE);
    int gridY = 0;
    GridBagConstraints c;
    for (Parameter p : shownParams.getParamList()) {
      c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = gridY;
      c.anchor = GridBagConstraints.WEST;
      c.fill = GridBagConstraints.NONE;
      c.insets = new Insets(0, 0, 0, 8);
      content.add(new JLabel(p.getName()), c);

      c = new GridBagConstraints();
      c.gridx = 1;
      c.gridy = gridY++;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1;
      final Parameter pFinal = p;
      final JTextField jTextField = new DJTextField();
      jTextField.setText(p.getValue());
      jTextField.addKeyListener(
          new KeyListener() {
            public void keyTyped(KeyEvent keyEvent) {
              // TODO
            }

            public void keyPressed(KeyEvent keyEvent) {
              // TODO
            }

            public void keyReleased(KeyEvent keyEvent) {
              pFinal.setValue(jTextField.getText());
            }
          });
      content.add(jTextField, c);
    }

    GridBagConstraints nc = new GridBagConstraints();
    nc.gridx = 0;
    nc.gridy = 0;
    nc.weightx = 1;
    nc.fill = GridBagConstraints.HORIZONTAL;

    add(content, nc);

    content.updateUI();
    content.repaint();
    this.repaint();
  }
Example #19
0
  public JFrame buildFrame() {

    f = new JFrame("AMSA World");
    f.setSize(800, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new GridBagLayout());

    textArea.setFocusable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            checkInput();
          }
        };
    inputText.addActionListener(listener);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1.0;
    c.gridwidth = 3;
    c.weighty = 0.025;
    c.gridx = 0;
    c.gridy = 0;
    f.add(topPanel, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 1;
    f.add(scrollPane, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 1;
    f.add(sidePanel, c);
    sidePanel.setVisible(false);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0.025;
    c.gridwidth = 3;
    c.gridx = 0;
    c.gridy = 2;
    f.add(inputText, c);

    f.setVisible(true);

    return f;
  }
Example #20
0
  public void addFields() {
    //		gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.ipadx = 20;
    content.add(new JLabel("Host", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Database", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Table", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Username", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Password", JLabel.CENTER), gbc);
    gbc.gridy = 0;
    gbc.gridx = 1;
    content.add(host, gbc);
    gbc.gridy++;
    content.add(database, gbc);
    gbc.gridy++;
    content.add(table, gbc);
    gbc.gridy++;
    content.add(username, gbc);
    gbc.gridy++;
    content.add(password, gbc);
    gbc.gridy++;
    login.setMnemonic(KeyEvent.VK_L);

    ActionListener act =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (e.getSource() == login) {
              if (username.getText().length() > 0) alive = false;
              else {
                showMessage("Username required", "At least enter a username :)");
              }
            }
            if (e.getSource() == exit) {
              System.exit(0);
            }
          }
        };

    login.addActionListener(act);
    exit.addActionListener(act);
    JPanel p = new JPanel(new FlowLayout());
    p.add(login);
    p.add(exit);

    gbc.gridx = 0;
    gbc.gridwidth = 2;
    content.add(p, gbc);

    username.addKeyListener(this);
    password.addKeyListener(this);
    login.addKeyListener(this);
  }
  /**
   * Used to create the top panel describing the current feedback question
   *
   * @param fb Feedback question to describe
   * @return Panel with title and description
   */
  public JPanel createQuestionDataPanel(AbstractFeedbackType fb) {
    JPanel questionPanel = new JPanel();
    questionPanel.setLayout(new GridBagLayout());
    questionPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));

    GridBagConstraints leftBoxConst = new GridBagConstraints();
    leftBoxConst.anchor = GridBagConstraints.LINE_START;
    leftBoxConst.gridx = 0;
    leftBoxConst.gridy = 0;
    leftBoxConst.gridheight = 2;

    JLabel titleLabel = new JLabel(fb.getTitle());
    GridBagConstraints titleLabelConst = new GridBagConstraints();
    titleLabelConst.anchor = GridBagConstraints.CENTER;
    titleLabelConst.gridx = 1;
    titleLabelConst.gridy = 0;
    titleLabelConst.weightx = 1.0;
    Font titleLabelFont = titleLabel.getFont();
    titleLabel.setFont(
        new Font(
            titleLabelFont.getName(),
            Font.BOLD,
            titleLabelFont.getSize() + 4)); // increase label font size by 2

    JLabel descLabel = new JLabel(fb.getDescription());
    GridBagConstraints descLabelConst = new GridBagConstraints();
    descLabelConst.anchor = GridBagConstraints.CENTER;
    descLabelConst.gridx = 1;
    descLabelConst.gridy = 1;
    descLabelConst.weightx = 1.0;

    JLabel exclLabel = new JLabel("!");
    exclLabel.setAlignmentX(RIGHT_ALIGNMENT);
    exclLabel.setToolTipText("Response is mandatory");
    try {
      exclLabel.setFont(loadGlyphFont(titleLabelFont.getSize() + 4));
      exclLabel.setText("\ue101");
    } catch (FontFormatException | IOException e) {
      e.printStackTrace();
    }
    GridBagConstraints rightBoxConst = new GridBagConstraints();
    rightBoxConst.anchor = GridBagConstraints.LINE_END;
    rightBoxConst.gridx = 2;
    rightBoxConst.gridy = 0;
    rightBoxConst.gridheight = 2;
    rightBoxConst.ipadx = 4;

    questionPanel.add(new JPanel(), leftBoxConst);
    questionPanel.add(titleLabel, titleLabelConst);
    questionPanel.add(descLabel, descLabelConst);
    questionPanel.add(fb.isMandatory() ? exclLabel : new JPanel(), rightBoxConst);

    return questionPanel;
  }
Example #22
0
  public FormBuilder addLabeledComponent(
      @Nullable JComponent label, @NotNull JComponent component, int topInset, boolean labelOnTop) {
    GridBagConstraints c = new GridBagConstraints();
    topInset = myLineCount > 0 ? topInset : 0;

    if (myVertical || labelOnTop || label == null) {
      c.gridwidth = 2;
      c.gridx = 0;
      c.gridy = myLineCount;
      c.weightx = 0;
      c.weighty = 0;
      c.fill = NONE;
      c.anchor = getLabelAnchor(component, false);
      c.insets = new Insets(topInset, myIndent, DEFAULT_VGAP, 0);

      if (label != null) myPanel.add(label, c);

      c.gridx = 0;
      c.gridy = myLineCount + 1;
      c.weightx = 1.0;
      c.weighty = getWeightY(component);
      c.fill = getFill(component);
      c.anchor = WEST;
      c.insets = new Insets(label == null ? topInset : 0, myIndent, 0, 0);

      myPanel.add(component, c);

      myLineCount += 2;
    } else {
      c.gridwidth = 1;
      c.gridx = 0;
      c.gridy = myLineCount;
      c.weightx = 0;
      c.weighty = 0;
      c.fill = NONE;
      c.anchor = getLabelAnchor(component, true);
      c.insets = new Insets(topInset, myIndent, 0, myHorizontalGap);

      myPanel.add(label, c);

      c.gridx = 1;
      c.weightx = 1;
      c.weighty = getWeightY(component);
      c.fill = getFill(component);
      c.anchor = WEST;
      c.insets = new Insets(topInset, myIndent, 0, 0);

      myPanel.add(component, c);

      myLineCount++;
    }

    return this;
  }
 public void drawItems() {
   itemList.removeAll();
   OrderedItem orders[] = commande.getOrders();
   for (int i = 0; i < orders.length; i++) {
     GridBagConstraints constraintLeft = new GridBagConstraints(),
         constraintRight = new GridBagConstraints();
     constraintLeft.gridx = 0;
     constraintLeft.gridy = GridBagConstraints.RELATIVE;
     constraintLeft.fill = GridBagConstraints.HORIZONTAL;
     constraintRight.gridx = 1;
     constraintRight.gridy = GridBagConstraints.RELATIVE;
     constraintRight.fill = GridBagConstraints.HORIZONTAL;
     String itemText = orders[i].getItem().getNom();
     if (itemText.length() > 15) {
       itemText = itemText.substring(0, 12) + "...";
     }
     JLabel item = new JLabel(itemText);
     JPanel itemTextHolder = new JPanel();
     itemTextHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE));
     itemTextHolder.setBackground(Color.WHITE);
     itemTextHolder.add(item);
     itemList.add(itemTextHolder, constraintLeft);
     Color bg = Color.WHITE;
     String statusIcon = "";
     JLabel itemStatus = new JLabel();
     JPanel statusHolder = new JPanel();
     switch (orders[i].getStatus()) {
       case 0:
         bg = Color.RED;
         statusIcon = "\u2718";
         break;
       case 1:
         bg = Color.YELLOW;
         statusIcon = "\u2718";
         break;
       case 2:
         bg = Color.GREEN;
         statusIcon = "\u2718";
         break;
       case 3:
         bg = Color.GRAY;
         statusIcon = "\u2713";
         break;
     }
     itemStatus.setText(statusIcon);
     statusHolder.setBackground(bg);
     statusHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE));
     statusHolder.add(itemStatus);
     itemList.add(statusHolder, constraintRight);
   }
   validate();
   repaint();
 }
  /**
   * Adds contact entry labels.
   *
   * @param nameLabelGridWidth the grid width of the contact entry name label
   */
  private void addLabels(int nameLabelGridWidth) {
    remove(nameLabel);
    remove(rightLabel);
    remove(displayDetailsLabel);

    if (treeNode != null && !(treeNode instanceof GroupNode))
      constraints.insets = new Insets(0, 0, V_GAP, H_GAP);
    else constraints.insets = new Insets(0, 0, 0, H_GAP);

    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.weightx = 1f;
    constraints.weighty = 0f;
    constraints.gridheight = 1;
    constraints.gridwidth = nameLabelGridWidth;
    this.add(nameLabel, constraints);

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = nameLabelGridWidth + 1;
    constraints.gridy = 0;
    constraints.gridheight = 3;
    constraints.weightx = 0f;
    constraints.weighty = 1f;
    this.add(rightLabel, constraints);

    if (treeNode != null && treeNode instanceof ContactNode) {
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.gridy = 1;
      constraints.weightx = 1f;
      constraints.weighty = 0f;
      constraints.gridwidth = nameLabelGridWidth;
      constraints.gridheight = 1;

      this.add(displayDetailsLabel, constraints);
    } else if (treeNode != null && treeNode instanceof GroupNode) {
      constraints.anchor = GridBagConstraints.WEST;
      constraints.fill = GridBagConstraints.NONE;
      constraints.gridx = 1;
      constraints.gridy = 1;
      constraints.weightx = 1f;
      constraints.weighty = 0f;
      constraints.gridwidth = nameLabelGridWidth;
      constraints.gridheight = 1;

      this.add(displayDetailsLabel, constraints);
    }
  }
  private JPanel getPredicatePanel() {

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();

    JPanel panel = new JPanel(gbl);
    panel.setBorder(new EmptyBorder(12, 12, 0, 11));

    // TODO: make variable query widget set a package for this and ParameterUpdateDialog

    gbc.gridy = 0;
    gbc.gridx = 0;
    gbc.weighty = 0;
    gbc.weightx = 0.333;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;

    gbc.insets = new Insets(0, 0, 5, 5);

    useXQuery = new JCheckBox("Use XQuery");
    useXQuery.setMnemonic('X');
    useXQuery.addActionListener(this);
    panel.add(useXQuery, gbc);

    JLabel inputVariableLabel = new JLabel("Variable:");
    inputVariableLabel.setHorizontalAlignment(JLabel.RIGHT);
    inputVariableLabel.setDisplayedMnemonic('v');

    panel.add(inputVariableLabel, gbc);

    gbc.gridx++;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(0, 5, 5, 5);
    panel.add(getInputVariableComboBox(), gbc);
    inputVariableLabel.setLabelFor(inputVariableComboBox);

    gbc.gridx++;
    gbc.anchor = GridBagConstraints.CENTER;
    panel.add(getNewInputVariableQueryButton(), gbc);

    gbc.gridx = 0;
    gbc.gridy++;
    gbc.gridwidth = 3;
    gbc.weighty = 1;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.BOTH;

    panel.add(getXQueryEditor(), gbc);

    return panel;
  }
Example #26
0
  public LoginScreen(DBConnectionFactory factory) {
    this.factory = factory;

    loginFrame = new JFrame("Login");
    loginFrame.setSize(500, 450);
    loginFrame.setVisible(true);

    Container content = loginFrame.getContentPane();
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints cs = new GridBagConstraints();
    cs.fill = GridBagConstraints.HORIZONTAL;

    lbUsername = new JLabel("Username: "******"Password: "******"Login");
    loginButton.addActionListener(this);

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(this);

    JPanel buttonPanel = new JPanel();
    buttonPanel.add(loginButton);
    buttonPanel.add(cancelButton);

    content.add(panel, BorderLayout.CENTER);
    content.add(buttonPanel, BorderLayout.SOUTH);

    loginFrame.addWindowListener(new ExitListener());
  }
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      JLabel label = null;

      // i18n
      // label = new JLabel( "File names can be constructed from a template. The LABEL field is " );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_"));
      label.setForeground(Color.black);
      // m_gbc.weightx = 0.5;
      showInstruction(m_gbl, m_gbc, 0, 0, 7, label);

      // i18n
      // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up."));
      showInstruction(m_gbl, m_gbc, 0, 1, 7, label);
      showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel(""));

      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 0; // reset to default
      m_gbc.gridwidth = 5;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE")));

      m_nRow = 3;
      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Example #28
0
  /** Créer les composants */
  private void initComponents() {

    text = new JTextArea();
    button_licence = new JButton();
    button_close = new JButton();
    logo = new LogoComponent();

    // Ajout des actions listeners
    button_licence.addActionListener(new ButtonLicenceActionListener());
    button_close.addActionListener(new ButtonCloseActionListener(this));

    logo.setPreferredSize(new Dimension(128, 128));

    text.setText(
        "Version : 1.0b \n"
            + "\n"
            + "Copyright © 2008-2012 Sipieter Clément \n"
            + "Copyright © 2011-2012 Sellem Lev-Arcady");
    text.setBackground(this.getBackground());

    button_licence.setText("Licence");
    button_close.setText("Fermer");

    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    this.add(logo, gbc);

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 3;
    gbc.insets = new Insets(20, 20, 20, 20);
    this.add(text, gbc);

    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 5, 20, 5);

    this.add(button_licence, gbc);

    gbc.gridx = 2;
    gbc.gridy = 2;
    this.add(button_close, gbc);
    this.pack();
  }
Example #29
0
  private void packDevices() {
    int i, j;
    GridBagLayout gbl = new GridBagLayout();
    getContentPane().setLayout(gbl);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(2, 2, 2, 2);

    for (i = 0, j = 0; i < cnt; i++) {
      if (devArray[i].isSpecial) continue;

      gbc.weightx = 0.8;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.gridx = 0;
      gbc.gridy = j;
      gbc.ipadx = 5;
      gbc.ipady = 5;
      gbl.setConstraints(devArray[i].widgetset.l1, gbc);
      getContentPane().add(devArray[i].widgetset.l1);

      gbc.weightx = 1.0;
      gbc.gridx = 1;
      gbc.gridy = j;
      gbc.ipadx = 0;
      gbc.ipady = 0;
      gbl.setConstraints(devArray[i].widgetset.wc, gbc);
      getContentPane().add(devArray[i].widgetset.wc);

      gbc.weightx = 0.8;
      gbc.gridx = 2;
      gbc.gridy = j;
      gbc.ipadx = 5;
      gbc.ipady = 5;
      gbl.setConstraints(devArray[i].widgetset.l2, gbc);
      getContentPane().add(devArray[i].widgetset.l2);

      gbc.gridx = 3;
      gbc.gridy = j;
      gbl.setConstraints(devArray[i].widgetset.ln, gbc);
      getContentPane().add(devArray[i].widgetset.ln);

      gbc.gridx = 4;
      gbc.gridy = j;
      gbl.setConstraints(devArray[i].widgetset.lval, gbc);
      getContentPane().add(devArray[i].widgetset.lval);

      j++;
    }

    pack();
  }
  public BaseGoogleLoginUI(@NotNull String signinText) {
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT));
    setOpaque(false);

    JLabel googleIcon = new JBLabel();

    setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15));
    googleIcon.setHorizontalAlignment(SwingConstants.CENTER);
    googleIcon.setVerticalAlignment(SwingConstants.CENTER);
    googleIcon.setOpaque(false);
    googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO);
    googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 0;
    add(googleIcon, c);

    JTextArea signinTextArea = new JTextArea();
    signinTextArea.setFont(UIUtil.getLabelFont());
    signinTextArea.setLineWrap(true);
    signinTextArea.setWrapStyleWord(true);
    signinTextArea.setOpaque(false);
    signinTextArea.setText(signinText);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    add(signinTextArea, c);
  }