public DisplayResults() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      text.setForeground(Color.black);
      add(text, gbc);
      gbc.gridy = 0;
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(emptyLabel, gbc);
      add(Box.createVerticalStrut(0), gbc);
      add(emptyLabel, gbc);

      /*	 gbc.gridy = 1;
      VTextMsg result = new VTextMsg(sshare, vnmrif, null);
      result.setPreferredSize(new Dimension(300, 30));
      result.setForeground(Color.black);
      add( result, gbc );
      */
      setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder("  Results  "),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Exemple #2
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
    public DisplayUserDirectory() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      hmlabel.setForeground(Color.black);
      add(hmlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(hmdir, gbc);
      add(Box.createVerticalStrut(15), gbc);

      gbc.gridwidth = 1;
      vjlabel.setForeground(Color.black);
      add(vjlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(vjdir, gbc);
      add(Box.createVerticalStrut(0), gbc);

      gbc.gridwidth = 1;
      vjlabel2.setForeground(Color.black);
      add(vjlabel2, gbc);
      setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder(" User_Directories "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
    GitCheckinOptions(@NotNull final Project project, @NotNull CheckinProjectPanel panel) {
      super(project, panel);
      myVcs = GitVcs.getInstance(project);
      final Insets insets = new Insets(2, 2, 2, 2);
      // add authors drop down
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.anchor = GridBagConstraints.WEST;
      c.insets = insets;
      final JLabel authorLabel = new JLabel(GitBundle.message("commit.author"));
      myPanel.add(authorLabel, c);

      c = new GridBagConstraints();
      c.anchor = GridBagConstraints.CENTER;
      c.insets = insets;
      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.fill = GridBagConstraints.HORIZONTAL;
      final List<String> usersList = getUsersList(project);
      final Set<String> authors =
          usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
      ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
      List<String> list = new ArrayList<String>(authors);
      Collections.sort(list);
      list =
          ObjectsConvertor.convert(
              list,
              new Convertor<String, String>() {
                @Override
                public String convert(String o) {
                  return StringUtil.shortenTextWithEllipsis(o, 30, 0);
                }
              });
      myAuthor = new ComboBox(ArrayUtil.toObjectArray(list));
      myAuthor.insertItemAt("", 0);
      myAuthor.setSelectedItem("");
      myAuthor.setEditable(true);
      authorLabel.setLabelFor(myAuthor);
      myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip"));
      myPanel.add(myAuthor, c);
    }
  private void addField(OptionField field) {
    // Add label
    JLabel l = new JLabel(field.getDisplayName() + ":");
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = currentRow;
    c.insets = new Insets(5, 2, 2, 2);
    c.anchor = GridBagConstraints.NORTHWEST;
    content.add(l, c);

    // Add enable checkbox
    if (field.getEnableToggle() != null) {
      c = new GridBagConstraints();
      c.gridx = 1;
      c.gridy = currentRow;
      c.fill = GridBagConstraints.BOTH;
      c.insets = new Insets(2, 2, 2, 2);
      c.anchor = GridBagConstraints.NORTHWEST;
      content.add(field.getEnableToggle(), c);
    }

    // Add field
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = currentRow;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(2, 2, 2, 2);
    c.anchor = GridBagConstraints.NORTHWEST;
    content.add(field.getComponent(), c);

    // Add change listener
    field.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            fireChangeEvent();
          }
        });

    // Update state
    currentRow++;
    pack();
  }
 private void addGrid(
     JPanel p, Component co, int x, int y, int w, int fill, double wx, int anchor) {
   GridBagConstraints c = new GridBagConstraints();
   c.gridx = x;
   c.gridy = y;
   c.gridwidth = w;
   c.anchor = anchor;
   c.weightx = wx;
   c.fill = fill;
   if (fill == GridBagConstraints.BOTH || fill == GridBagConstraints.VERTICAL) c.weighty = 1.0;
   c.insets = new Insets(y == 0 ? 10 : 0, GAP, GAP, GAP);
   p.add(co, c);
 }
  private void išdėstymas() {
    setLocation(500, 20);
    // sudedame duomenis į paneles
    panAutoSąr.add(scrNeregZona);
    panAutoSąr.add(scrRegZona);
    panDuomenys.add(panRegNumeris);
    panDuomenys.add(panRez);
    panDuomenys.add(panMygt);

    GridBagLayout dėstymoBūdas = new GridBagLayout();
    GridBagConstraints dėsnis = new GridBagConstraints();
    panRegNumeris.setLayout(dėstymoBūdas);
    panRez.setLayout(dėstymoBūdas);

    dėsnis.fill = GridBagConstraints.NONE;
    dėsnis.insets = new Insets(5, 8, 0, 6);

    dėsnis.anchor = GridBagConstraints.LINE_END;
    dėsnis.gridy = GridBagConstraints.RELATIVE;
    dėsnis.gridx = 0;
    panRegNumeris.add(new JLabel("Auto Numeris"), dėsnis);
    panRez.add(new JLabel("Neregistruotų kiekis"), dėsnis);
    panRez.add(new JLabel("Registruotų kiekis"), dėsnis);

    dėsnis.anchor = GridBagConstraints.LINE_START;
    dėsnis.gridx = 1;

    panRegNumeris.add(tfAutoNr, dėsnis);

    panRez.add(tfNeregKiekis, dėsnis);
    panRez.add(tfRegKiekis, dėsnis);

    panMygt.setLayout(new BoxLayout(panMygt, BoxLayout.Y_AXIS));
    panMygt.add(jbReg);
    panMygt.add(jbRasti);
    panMygt.add(jbSkaityti);
    panMygt.add(jbSaveObj);
    panMygt.add(jbLoadObj);
  }
    private Connector() {
      setLayout(new GridBagLayout());
      //      setBorder (new EmptyBorder (8, 8, 8, 8));
      GridBagConstraints c = new GridBagConstraints();

      c.insets = new Insets(0, 0, 3, 3);
      c.anchor = GridBagConstraints.WEST;
      add(new JLabel(bundle.getString("CTL_HostName")), c);

      tfHost = new JTextField(host, 25);
      c = new GridBagConstraints();
      c.gridwidth = 0;
      c.insets = new Insets(0, 3, 3, 0);
      c.fill = java.awt.GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      add(tfHost, c);

      c = new GridBagConstraints();
      c.insets = new Insets(3, 0, 0, 3);
      c.anchor = GridBagConstraints.WEST;
      add(new JLabel(bundle.getString("CTL_Password")), c);

      tfPassword = new JTextField(25);
      c = new GridBagConstraints();
      c.gridwidth = 0;
      c.fill = java.awt.GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      c.insets = new Insets(3, 3, 0, 0);
      add(tfPassword, c);

      c = new GridBagConstraints();
      c.fill = java.awt.GridBagConstraints.BOTH;
      c.weighty = 1.0;
      JPanel p = new JPanel();
      p.setPreferredSize(new Dimension(1, 1));
      add(p, c);
    }
 private JComponent createButtons() {
   JPanel pane = new JPanel(new GridBagLayout());
   JButton btnOK = new JButton(_I("ok"));
   btnOK.addActionListener(new ActionOK(this));
   JButton btnApply = new JButton(_I("apply"));
   btnApply.addActionListener(new ActionApply(this));
   JButton btnCancel = new JButton(_I("cancel"));
   btnCancel.addActionListener(new ActionCancel(this));
   GridBagConstraints c = new GridBagConstraints();
   c.gridy = 3;
   c.gridx = 0;
   c.insets = new Insets(5, 0, 10, 0);
   c.anchor = GridBagConstraints.LAST_LINE_END;
   pane.add(btnOK, c);
   c.gridx = 1;
   pane.add(btnApply, c);
   c.gridx = 2;
   pane.add(btnCancel, c);
   return pane;
 }
  /**
   * The constructor.
   *
   * @param parent The parent.
   * @param idata The installation data.
   */
  public FinishPanel(InstallerFrame parent, InstallData idata) {
    super(parent, idata);

    vs = new VariableSubstitutor(idata.getVariableValueMap());

    // The 'super' layout
    GridBagLayout superLayout = new GridBagLayout();
    setLayout(superLayout);
    GridBagConstraints gbConstraints = new GridBagConstraints();
    gbConstraints.insets = new Insets(0, 0, 0, 0);
    gbConstraints.fill = GridBagConstraints.NONE;
    gbConstraints.anchor = GridBagConstraints.CENTER;

    // We initialize our 'real' layout
    centerPanel = new JPanel();
    layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS);
    centerPanel.setLayout(layout);
    superLayout.addLayoutComponent(centerPanel, gbConstraints);
    add(centerPanel);
  }
    public DisplayTemplate(String strDir, String strDefDirFile) {
      setLayout(m_gbl);

      m_gbc.anchor = GridBagConstraints.NORTHWEST;
      m_gbc.fill = GridBagConstraints.HORIZONTAL;

      m_strPathDir = strDir;
      m_strDefDirFile = strDefDirFile;

      setLayout(new BorderLayout());
      m_pnlDisplay = new JPanel(m_gbl);
      JScrollPane spDisplay = new JScrollPane(m_pnlDisplay);
      add(spDisplay, BorderLayout.CENTER);

      JComponent pnlTool = getToolBar();
      add(pnlTool, BorderLayout.NORTH);

      layoutUIComponents(FileUtil.openPath(m_strDefDirFile), true);
      VItemArea1.addChangeListener(this);
      VUserToolBar.addChangeListener(this);
    }
  private void drawComponents() {
    GridBagConstraints con = new GridBagConstraints();
    con.gridx = 0;
    con.gridy = 0;
    con.gridwidth = 1;
    con.gridheight = 1;
    con.anchor = GridBagConstraints.NORTH;
    con.fill = GridBagConstraints.HORIZONTAL;
    con.insets = new Insets(5, 5, 5, 5);
    con.weightx = 0;
    con.weighty = 0;

    Box btns = Box.createHorizontalBox();
    btns.add(btnDetails);
    btns.add(Box.createHorizontalGlue());
    btns.add(btnClose);

    // Set up content
    Container content = getContentPane();
    content.setLayout(new GridBagLayout());

    // Add message label
    con.weightx = 1;
    con.weighty = 1;
    content.add(lblMessage, con);

    // Add button box
    con.gridy = 1;
    con.weighty = 0;
    content.add(btns, con);

    // Add trace pane
    con.gridy = 2;

    content.add(srlTrace, con);

    // Set default button
    getRootPane().setDefaultButton(btnClose);
  }
Exemple #13
0
  /** Shows a dialog with input for logs description. */
  private void uploadLogs() {
    ResourceManagementService resources = LoggingUtilsActivator.getResourceService();

    final SIPCommDialog dialog =
        new SIPCommDialog(false) {
          /** Serial version UID. */
          private static final long serialVersionUID = 0L;

          /**
           * Dialog is closed. Do nothing.
           *
           * @param escaped <tt>true</tt> if this dialog has been closed by pressing
           */
          @Override
          protected void close(boolean escaped) {}
        };

    dialog.setModal(true);
    dialog.setTitle(resources.getI18NString("plugin.loggingutils.UPLOAD_LOGS_BUTTON"));

    Container container = dialog.getContentPane();
    container.setLayout(new GridBagLayout());

    JLabel descriptionLabel = new JLabel("Add a comment:");
    final JTextArea commentTextArea = new JTextArea();
    commentTextArea.setRows(4);
    final JButton uploadButton =
        new JButton(resources.getI18NString("plugin.loggingutils.UPLOAD_BUTTON"));
    final SIPCommTextField emailField =
        new SIPCommTextField(resources.getI18NString("plugin.loggingutils.ARCHIVE_UPREPORT_EMAIL"));
    final JCheckBox emailCheckBox =
        new SIPCommCheckBox("Email me when more information is available");
    emailCheckBox.setSelected(true);
    emailCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!emailCheckBox.isSelected()) {
              uploadButton.setEnabled(true);
              emailField.setEnabled(false);
            } else {
              emailField.setEnabled(true);

              if (emailField.getText() != null && emailField.getText().trim().length() > 0)
                uploadButton.setEnabled(true);
              else uploadButton.setEnabled(false);
            }
          }
        });

    emailField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void insertUpdate(DocumentEvent e) {
                updateButtonsState();
              }

              public void removeUpdate(DocumentEvent e) {
                updateButtonsState();
              }

              public void changedUpdate(DocumentEvent e) {}

              /** Check whether we should enable upload button. */
              private void updateButtonsState() {
                if (emailCheckBox.isSelected()
                    && emailField.getText() != null
                    && emailField.getText().trim().length() > 0) uploadButton.setEnabled(true);
                else uploadButton.setEnabled(false);
              }
            });

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(10, 10, 3, 10);
    c.weightx = 1.0;
    c.gridx = 0;
    c.gridy = 0;

    container.add(descriptionLabel, c);

    c.insets = new Insets(0, 10, 10, 10);
    c.gridy = 1;
    container.add(new JScrollPane(commentTextArea), c);

    c.insets = new Insets(0, 10, 0, 10);
    c.gridy = 2;
    container.add(emailCheckBox, c);

    c.insets = new Insets(0, 10, 10, 10);
    c.gridy = 3;
    container.add(emailField, c);

    JButton cancelButton = new JButton(resources.getI18NString("service.gui.CANCEL"));
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dialog.dispose();
          }
        });

    uploadButton.setEnabled(false);
    uploadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              final ArrayList<String> paramNames = new ArrayList<String>();
              final ArrayList<String> paramValues = new ArrayList<String>();

              if (emailCheckBox.isSelected()) {
                paramNames.add("Email");
                paramValues.add(emailField.getText());
              }

              paramNames.add("Description");
              paramValues.add(commentTextArea.getText());

              // don't block the UI thread we may need to show
              // some ui for password input if protected area on the way
              new Thread(
                      new Runnable() {
                        public void run() {
                          uploadLogs(
                              getUploadLocation(),
                              LogsCollector.getDefaultFileName(),
                              paramNames.toArray(new String[] {}),
                              paramValues.toArray(new String[] {}));
                        }
                      })
                  .start();
            } finally {
              dialog.dispose();
            }
          }
        });
    JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonsPanel.add(uploadButton);
    buttonsPanel.add(cancelButton);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0;
    c.gridy = 4;
    container.add(buttonsPanel, c);

    dialog.setVisible(true);
  }
    public ExampleField(ExampleOption option) {
      super(option);

      model = new DefaultListModel();
      model.addListDataListener(
          new ListDataListener() {
            @Override
            public void intervalAdded(ListDataEvent e) {
              fireChangeEvent();
            }

            @Override
            public void intervalRemoved(ListDataEvent e) {
              fireChangeEvent();
            }

            @Override
            public void contentsChanged(ListDataEvent e) {
              fireChangeEvent();
            }
          });

      final JList list =
          new JList(model) {
            @Override
            public Dimension getPreferredScrollableViewportSize() {
              return new Dimension(3 * CELL_SIZE, 2 * CELL_SIZE);
            }
          };
      list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
      list.setVisibleRowCount(0);
      list.setFixedCellHeight(CELL_SIZE);
      list.setFixedCellWidth(CELL_SIZE);
      list.setTransferHandler(
          new URIImportTransferHandler() {
            @Override
            public boolean canImport(TransferSupport support) {
              support.setShowDropLocation(false);
              return super.canImport(support);
            }

            @Override
            public boolean importData(TransferSupport support) {
              try {
                List<BufferedImage> images = new ArrayList<BufferedImage>();
                for (URI u : getURIs(support)) {
                  try {
                    images.add(ImageIO.read(u.toURL()));
                  } catch (IOException e) {
                  }
                }
                addExamples(images);
                return true;
              } catch (IOException e) {
                return false;
              } catch (UnsupportedFlavorException e) {
                return false;
              } catch (URISyntaxException e) {
                return false;
              }
            }
          });
      list.setCellRenderer(
          new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(
                JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
              super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

              Example example = (Example) value;

              setHorizontalAlignment(SwingConstants.CENTER);
              setText(null);
              setIcon(example.getIcon());
              setBorder(BorderFactory.createEmptyBorder());

              return this;
            }
          });
      JScrollPane jsp = new JScrollPane(list);
      jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

      final JButton remove = new JButton("Remove");
      remove.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              int[] indices = list.getSelectedIndices();
              for (int i = indices.length - 1; i >= 0; i--) {
                model.remove(indices[i]);
              }
            }
          });
      list.addListSelectionListener(
          new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
              remove.setEnabled(list.getSelectedIndex() != -1);
            }
          });
      remove.setEnabled(false);

      panel = new JPanel(new GridBagLayout());
      // Add list
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.weightx = 1;
      c.weighty = 1;
      c.fill = GridBagConstraints.BOTH;
      panel.add(jsp, c);
      // Add remove button
      c = new GridBagConstraints();
      c.gridx = 0;
      c.anchor = GridBagConstraints.WEST;
      panel.add(remove, c);
    }
Exemple #15
0
  /**
   * Standard constructor: it needs the parent frame.
   *
   * @param parent the dialog's parent
   */
  public DialogPrint(JFrame parent) {
    super(400, 350, parent, Globals.messages.getString("Print_dlg"), true);
    addComponentListener(this);
    export = false;

    // Ensure that under MacOSX >= 10.5 Leopard, this dialog will appear
    // as a document modal sheet

    getRootPane().putClientProperty("apple.awt.documentModalSheet", Boolean.TRUE);

    GridBagLayout bgl = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    Container contentPane = getContentPane();
    contentPane.setLayout(bgl);

    constraints.insets.right = 30;

    JLabel empty = new JLabel("  ");
    constraints.weightx = 100;
    constraints.weighty = 100;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    contentPane.add(empty, constraints); // Add "   " label

    JLabel empty1 = new JLabel("  ");
    constraints.weightx = 100;
    constraints.weighty = 100;
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    contentPane.add(empty1, constraints); // Add "   " label

    mirror_CB = new JCheckBox(Globals.messages.getString("Mirror"));
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridwidth = 2;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.WEST;
    contentPane.add(mirror_CB, constraints); // Add Print Mirror cb

    fit_CB = new JCheckBox(Globals.messages.getString("FitPage"));
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.gridwidth = 2;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.WEST;
    contentPane.add(fit_CB, constraints); // Add Fit to page cb

    bw_CB = new JCheckBox(Globals.messages.getString("B_W"));
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.gridwidth = 2;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.WEST;
    contentPane.add(bw_CB, constraints); // Add BlackWhite cb

    landscape_CB = new JCheckBox(Globals.messages.getString("Landscape"));
    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.gridwidth = 2;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.WEST;
    contentPane.add(landscape_CB, constraints); // Add landscape cb

    // Put the OK and Cancel buttons and make them active.
    JButton ok = new JButton(Globals.messages.getString("Ok_btn"));
    JButton cancel = new JButton(Globals.messages.getString("Cancel_btn"));

    constraints.gridx = 0;
    constraints.gridy = 4;
    constraints.gridwidth = 4;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.EAST;

    // Put the OK and Cancel buttons and make them active.
    Box b = Box.createHorizontalBox();
    b.add(Box.createHorizontalGlue());
    ok.setPreferredSize(cancel.getPreferredSize());

    if (Globals.okCancelWinOrder) {
      b.add(ok);
      b.add(Box.createHorizontalStrut(12));
      b.add(cancel);

    } else {
      b.add(cancel);
      b.add(Box.createHorizontalStrut(12));
      b.add(ok);
    }

    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            export = true;
            setVisible(false);
          }
        });
    cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
    // Here is an action in which the dialog is closed

    AbstractAction cancelAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
          }
        };
    contentPane.add(b, constraints); // Add OK/cancel dialog

    DialogUtil.addCancelEscape(this, cancelAction);
    pack();
    DialogUtil.center(this);
    getRootPane().setDefaultButton(ok);
  }
Exemple #16
0
  /**
   * Creates the video advanced settings.
   *
   * @return video advanced settings panel.
   */
  private static Component createVideoAdvancedSettings() {
    ResourceManagementService resources = NeomediaActivator.getResources();

    final DeviceConfiguration deviceConfig = mediaService.getDeviceConfiguration();

    TransparentPanel centerPanel = new TransparentPanel(new GridBagLayout());
    centerPanel.setMaximumSize(new Dimension(WIDTH, 150));

    JButton resetDefaultsButton =
        new JButton(resources.getI18NString("impl.media.configform.VIDEO_RESET"));
    JPanel resetButtonPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
    resetButtonPanel.add(resetDefaultsButton);

    final JPanel centerAdvancedPanel = new TransparentPanel(new BorderLayout());
    centerAdvancedPanel.add(centerPanel, BorderLayout.NORTH);
    centerAdvancedPanel.add(resetButtonPanel, BorderLayout.SOUTH);

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(5, 5, 0, 0);
    constraints.gridx = 0;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.gridy = 0;

    centerPanel.add(
        new JLabel(resources.getI18NString("impl.media.configform.VIDEO_RESOLUTION")), constraints);
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 0, 0, 0);
    final JCheckBox frameRateCheck =
        new SIPCommCheckBox(resources.getI18NString("impl.media.configform.VIDEO_FRAME_RATE"));
    centerPanel.add(frameRateCheck, constraints);
    constraints.gridy = 2;
    constraints.insets = new Insets(5, 5, 0, 0);
    centerPanel.add(
        new JLabel(resources.getI18NString("impl.media.configform.VIDEO_PACKETS_POLICY")),
        constraints);

    constraints.weightx = 1;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.insets = new Insets(5, 0, 0, 5);
    Object[] resolutionValues = new Object[DeviceConfiguration.SUPPORTED_RESOLUTIONS.length + 1];
    System.arraycopy(
        DeviceConfiguration.SUPPORTED_RESOLUTIONS,
        0,
        resolutionValues,
        1,
        DeviceConfiguration.SUPPORTED_RESOLUTIONS.length);
    final JComboBox sizeCombo = new JComboBox(resolutionValues);
    sizeCombo.setRenderer(new ResolutionCellRenderer());
    sizeCombo.setEditable(false);
    centerPanel.add(sizeCombo, constraints);

    // default value is 20
    final JSpinner frameRate = new JSpinner(new SpinnerNumberModel(20, 5, 30, 1));
    frameRate.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            deviceConfig.setFrameRate(
                ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue());
          }
        });
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 0, 0, 5);
    centerPanel.add(frameRate, constraints);

    frameRateCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (frameRateCheck.isSelected()) {
              deviceConfig.setFrameRate(
                  ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue());
            } else // unlimited framerate
            deviceConfig.setFrameRate(-1);

            frameRate.setEnabled(frameRateCheck.isSelected());
          }
        });

    final JSpinner videoMaxBandwidth =
        new JSpinner(
            new SpinnerNumberModel(deviceConfig.getVideoMaxBandwidth(), 1, Integer.MAX_VALUE, 1));
    videoMaxBandwidth.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            deviceConfig.setVideoMaxBandwidth(
                ((SpinnerNumberModel) videoMaxBandwidth.getModel()).getNumber().intValue());
          }
        });
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.insets = new Insets(0, 0, 5, 5);
    centerPanel.add(videoMaxBandwidth, constraints);

    resetDefaultsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // reset to defaults
            sizeCombo.setSelectedIndex(0);
            frameRateCheck.setSelected(false);
            frameRate.setEnabled(false);
            frameRate.setValue(20);
            // unlimited framerate
            deviceConfig.setFrameRate(-1);
            videoMaxBandwidth.setValue(DeviceConfiguration.DEFAULT_VIDEO_MAX_BANDWIDTH);
          }
        });

    // load selected value or auto
    Dimension videoSize = deviceConfig.getVideoSize();

    if ((videoSize.getHeight() != DeviceConfiguration.DEFAULT_VIDEO_HEIGHT)
        && (videoSize.getWidth() != DeviceConfiguration.DEFAULT_VIDEO_WIDTH))
      sizeCombo.setSelectedItem(deviceConfig.getVideoSize());
    else sizeCombo.setSelectedIndex(0);
    sizeCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Dimension selectedVideoSize = (Dimension) sizeCombo.getSelectedItem();

            if (selectedVideoSize == null) {
              // the auto value, default one
              selectedVideoSize =
                  new Dimension(
                      DeviceConfiguration.DEFAULT_VIDEO_WIDTH,
                      DeviceConfiguration.DEFAULT_VIDEO_HEIGHT);
            }
            deviceConfig.setVideoSize(selectedVideoSize);
          }
        });

    frameRateCheck.setSelected(
        deviceConfig.getFrameRate() != DeviceConfiguration.DEFAULT_VIDEO_FRAMERATE);
    frameRate.setEnabled(frameRateCheck.isSelected());

    if (frameRate.isEnabled()) frameRate.setValue(deviceConfig.getFrameRate());

    return centerAdvancedPanel;
  }
Exemple #17
0
  /**
   * Creates the UI controls which are to control the details of a specific <tt>AudioSystem</tt>.
   *
   * @param audioSystem the <tt>AudioSystem</tt> for which the UI controls to control its details
   *     are to be created
   * @param container the <tt>JComponent</tt> into which the UI controls which are to control the
   *     details of the specified <tt>audioSystem</tt> are to be added
   */
  public static void createAudioSystemControls(AudioSystem audioSystem, JComponent container) {
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weighty = 0;

    int audioSystemFeatures = audioSystem.getFeatures();
    boolean featureNotifyAndPlaybackDevices =
        ((audioSystemFeatures & AudioSystem.FEATURE_NOTIFY_AND_PLAYBACK_DEVICES) != 0);

    constraints.gridx = 0;
    constraints.insets = new Insets(3, 0, 3, 3);
    constraints.weightx = 0;

    constraints.gridy = 0;
    container.add(
        new JLabel(getLabelText(DeviceConfigurationComboBoxModel.AUDIO_CAPTURE)), constraints);
    if (featureNotifyAndPlaybackDevices) {
      constraints.gridy = 2;
      container.add(
          new JLabel(getLabelText(DeviceConfigurationComboBoxModel.AUDIO_PLAYBACK)), constraints);
      constraints.gridy = 3;
      container.add(
          new JLabel(getLabelText(DeviceConfigurationComboBoxModel.AUDIO_NOTIFY)), constraints);
    }

    constraints.gridx = 1;
    constraints.insets = new Insets(3, 3, 3, 0);
    constraints.weightx = 1;

    JComboBox captureCombo = null;

    if (featureNotifyAndPlaybackDevices) {
      captureCombo = new JComboBox();
      captureCombo.setEditable(false);
      captureCombo.setModel(
          new DeviceConfigurationComboBoxModel(
              captureCombo,
              mediaService.getDeviceConfiguration(),
              DeviceConfigurationComboBoxModel.AUDIO_CAPTURE));
      constraints.gridy = 0;
      container.add(captureCombo, constraints);
    }

    int anchor = constraints.anchor;
    SoundLevelIndicator capturePreview =
        new SoundLevelIndicator(
            SimpleAudioLevelListener.MIN_LEVEL, SimpleAudioLevelListener.MAX_LEVEL);

    constraints.anchor = GridBagConstraints.CENTER;
    constraints.gridy = (captureCombo == null) ? 0 : 1;
    container.add(capturePreview, constraints);
    constraints.anchor = anchor;

    constraints.gridy = GridBagConstraints.RELATIVE;

    if (featureNotifyAndPlaybackDevices) {
      JComboBox playbackCombo = new JComboBox();

      playbackCombo.setEditable(false);
      playbackCombo.setModel(
          new DeviceConfigurationComboBoxModel(
              captureCombo,
              mediaService.getDeviceConfiguration(),
              DeviceConfigurationComboBoxModel.AUDIO_PLAYBACK));
      container.add(playbackCombo, constraints);

      JComboBox notifyCombo = new JComboBox();

      notifyCombo.setEditable(false);
      notifyCombo.setModel(
          new DeviceConfigurationComboBoxModel(
              captureCombo,
              mediaService.getDeviceConfiguration(),
              DeviceConfigurationComboBoxModel.AUDIO_NOTIFY));
      container.add(notifyCombo, constraints);
    }

    if ((AudioSystem.FEATURE_ECHO_CANCELLATION & audioSystemFeatures) != 0) {
      final SIPCommCheckBox echoCancelCheckBox =
          new SIPCommCheckBox(
              NeomediaActivator.getResources().getI18NString("impl.media.configform.ECHOCANCEL"));

      /*
       * First set the selected one, then add the listener in order to
       * avoid saving the value when using the default one and only
       * showing to user without modification.
       */
      echoCancelCheckBox.setSelected(mediaService.getDeviceConfiguration().isEchoCancel());
      echoCancelCheckBox.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              mediaService.getDeviceConfiguration().setEchoCancel(echoCancelCheckBox.isSelected());
            }
          });
      container.add(echoCancelCheckBox, constraints);
    }

    if ((AudioSystem.FEATURE_DENOISE & audioSystemFeatures) != 0) {
      final SIPCommCheckBox denoiseCheckBox =
          new SIPCommCheckBox(
              NeomediaActivator.getResources().getI18NString("impl.media.configform.DENOISE"));

      /*
       * First set the selected one, then add the listener in order to
       * avoid saving the value when using the default one and only
       * showing to user without modification.
       */
      denoiseCheckBox.setSelected(mediaService.getDeviceConfiguration().isDenoise());
      denoiseCheckBox.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              mediaService.getDeviceConfiguration().setDenoise(denoiseCheckBox.isSelected());
            }
          });
      container.add(denoiseCheckBox, constraints);
    }

    createAudioPreview(audioSystem, captureCombo, capturePreview);
  }
  public BundleOptionsFrame(String displayName, String instanceName, List<OptionGroup> options) {
    setResizable(false);
    this.displayName = displayName;
    content = (JComponent) getContentPane();
    content.setLayout(new GridBagLayout());

    final BundleOptionsFrame frame = this;

    // Close button
    Action closeAction =
        new AbstractAction("Close") {
          @Override
          public void actionPerformed(ActionEvent e) {
            frame.setVisible(false);
          }
        };
    JButton close_button = new JButton(closeAction);
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = currentRow++;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(2, 2, 2, 2);
    content.add(close_button, c);

    // Escape key binding
    JComponent root = frame.getRootPane();
    root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close");
    root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke("ctrl W"), "close");
    root.getActionMap().put("close", closeAction);

    if (instanceName != null) {
      // Predicate name
      StringOption opt = new StringOption();
      opt.setDisplayName("Predicate name");
      opt.setDefault(instanceName);
      instanceNameField = new StringField(opt);
      instanceNameField.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              updateTitle();
            }
          });
      addField(instanceNameField);
      JTextField tf = (JTextField) instanceNameField.getComponent();
      tf.selectAll();
      tf.requestFocusInWindow();
    } else {
      // We're a codec; no instance name
      instanceNameField = null;
    }
    updateTitle();

    // Options
    ExampleField example = null;
    for (OptionGroup group : options) {
      addSeparator(group.getDisplayName());
      for (Option option : group.getOptions()) {
        OptionField field;
        if (option instanceof BooleanOption) {
          field = new BooleanField((BooleanOption) option);
        } else if (option instanceof StringOption) {
          field = new StringField((StringOption) option);
        } else if (option instanceof NumberOption) {
          field = new NumberField((NumberOption) option);
        } else if (option instanceof ChoiceOption) {
          field = new ChoiceField((ChoiceOption) option);
        } else if (option instanceof ExampleOption) {
          if (example != null) {
            throw new IllegalArgumentException("Cannot display more than one ExampleOption");
          }
          example = new ExampleField((ExampleOption) option);
          field = example;
        } else {
          throw new IllegalArgumentException("Unknown option type");
        }
        addField(field);
        optionFields.add(field);
      }
    }
    this.exampleField = example;

    pack();
  }
  /**
   * Inizialize frame components
   *
   * @throws CMSException
   * @throws FileNotFoundException
   * @throws IOException
   * @throws GeneralSecurityException
   */
  private void initComponents()
      throws CMSException, FileNotFoundException, IOException, GeneralSecurityException {

    // *********************************

    panel4 = new JPanel();
    label2 = new JLabel();
    textPane1 = new JTextPane();
    panel5 = new JPanel();
    textArea1 = new JTextArea();
    textArea2 = new JTextArea();

    progressBar = new JProgressBar();

    textPane2 = new JTextPane();
    textField1 = new JTextField();
    button1 = new JButton();
    panel6 = new JPanel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    GridBagConstraints gbc;
    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout) contentPane.getLayout()).columnWidths = new int[] {165, 0, 0};
    ((GridBagLayout) contentPane.getLayout()).rowHeights = new int[] {105, 50, 0};
    ((GridBagLayout) contentPane.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4};
    ((GridBagLayout) contentPane.getLayout()).rowWeights = new double[] {1.0, 0.0, 1.0E-4};

    // ======== panel4 ========
    {
      panel4.setBackground(Color.white);
      panel4.setLayout(new GridBagLayout());
      ((GridBagLayout) panel4.getLayout()).columnWidths = new int[] {160, 0};
      ((GridBagLayout) panel4.getLayout()).rowHeights = new int[] {0, 0, 0};
      ((GridBagLayout) panel4.getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
      ((GridBagLayout) panel4.getLayout()).rowWeights = new double[] {1.0, 1.0, 1.0E-4};

      // ---- label2 ----
      label2.setIcon(
          new ImageIcon(
              "images" + System.getProperty("file.separator") + "logo-freesigner-piccolo.png"));
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      panel4.add(label2, gbc);

      // ---- textPane1 ----
      textPane1.setFont(new Font("Verdana", Font.BOLD, 12));
      textPane1.setText("Lettura\ncertificati\nda token");
      textPane1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.anchor = GridBagConstraints.NORTHWEST;
      panel4.add(textPane1, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    contentPane.add(panel4, gbc);

    // ======== panel5 ========
    {
      panel5.setBackground(Color.white);
      panel5.setLayout(new GridBagLayout());
      ((GridBagLayout) panel5.getLayout()).columnWidths = new int[] {0, 205, 0, 0};
      ((GridBagLayout) panel5.getLayout()).rowHeights = new int[] {100, 0, 30, 30, 0};
      ((GridBagLayout) panel5.getLayout()).columnWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel5.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0, 1.0, 1.0E-4};

      // ---- textArea1 ----
      textArea1.setFont(new Font("Verdana", Font.BOLD, 14));
      textArea1.setText("Lettura certificati da token");
      textArea1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.VERTICAL;
      gbc.insets.bottom = 5;
      panel5.add(textArea1, gbc);

      // ---- textArea2 ----
      textArea2.setFont(new Font("Verdana", Font.PLAIN, 12));
      textArea2.setText("Ricerca certificati...\n");
      textArea2.setEditable(false);
      textArea2.setColumns(30);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.BOTH;
      panel5.add(textArea2, gbc);
      progressBar.setValue(0);
      progressBar.setMaximum(1);
      progressBar.setStringPainted(true);
      progressBar.setBounds(0, 0, 300, 150);

      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 2;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      gbc.insets.right = 5;
      gbc.gridwidth = 3;
      panel5.add(progressBar, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    contentPane.add(panel5, gbc);

    // ======== panel6 ========
    {
      panel6.setBackground(Color.white);
      panel6.setLayout(new GridBagLayout());
      ((GridBagLayout) panel6.getLayout()).columnWidths = new int[] {0, 0, 0, 0};
      ((GridBagLayout) panel6.getLayout()).rowHeights = new int[] {0, 0};
      ((GridBagLayout) panel6.getLayout()).columnWeights = new double[] {1.0, 1.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel6.getLayout()).rowWeights = new double[] {1.0, 1.0E-4};

      // ---- button2 ----
      button2.setText("Indietro");
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.insets.right = 5;
      button2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {

              frame.hide();

              FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
            }
          });

      // panel6.add(button2, gbc);

      // ---- button4 ----
      button4.setText("Annulla");
      gbc = new GridBagConstraints();
      gbc.gridx = 2;
      gbc.gridy = 0;
      // panel6.add(button4, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    contentPane.add(panel6, gbc);
    contentPane.setBackground(Color.white);
    frame = new JFrame();
    frame.setContentPane(contentPane);
    frame.setTitle("Freesigner");
    frame.setSize(300, 150);
    frame.setResizable(false);
    frame.pack();
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getWidth()) / 2, (d.height - frame.getHeight()) / 2);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    timer =
        new Timer(
            10,
            new ActionListener() {

              public void actionPerformed(ActionEvent evt) {
                frame.show();
                if (task.getMessage() != null) {
                  String s = new String();
                  s = task.getMessage();
                  s = s.substring(0, Math.min(60, s.length()));

                  textArea2.setText(s + " ");
                  progressBar.setValue(task.getStatus());
                }
                if (task.isDone()) {
                  timer.stop();

                  // Finalizzo la cryptoki, onde evitare
                  // successivi errori PKCS11 "cryptoki alreadi initialized"

                  if ((task != null)) task.libFinalize();

                  ArrayList slotInfos = task.getSlotInfos();
                  if ((slotInfos == null) || slotInfos.isEmpty()) {

                    frame.show();

                    JOptionPane.showMessageDialog(
                        frame,
                        "Controllare la presenza sul sistema\n"
                            + "della libreria PKCS11 impostata.",
                        "Nessun lettore rilevato",
                        JOptionPane.WARNING_MESSAGE);

                    frame.hide();

                  } else {
                    String st = task.getCRLerror();

                    if (st.length() > 0) {
                      timer.stop();

                      JOptionPane.showMessageDialog(
                          frame,
                          "C'è stato un errore nella verifica CRL.\n" + st,
                          "Errore verifica CRL",
                          JOptionPane.ERROR_MESSAGE);
                      frame.hide();
                      FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
                    }
                    if (task.getDifferentCerts() == 0) {
                      if (task.getCIr() != null) {
                        JOptionPane.showMessageDialog(
                            frame,
                            "La carta "
                                + task.getCardDescription()
                                + " nel lettore "
                                + conf.getReader()
                                + " non contiene certificati",
                            "Attenzione",
                            JOptionPane.WARNING_MESSAGE);

                      } else
                        JOptionPane.showMessageDialog(
                            frame, task.getMessage(), "Errore:", JOptionPane.ERROR_MESSAGE);
                    }

                    frame.hide();

                    // confFrame.createTreeAndTokenNodes(task.getSlotInfos());

                  }
                }
              }
            });
  }
  /** Draw the contents of the dialog. */
  private void drawDialog() {

    JPanel oCenterPanel = new JPanel();

    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints gc = new GridBagConstraints();
    gc.anchor = GridBagConstraints.WEST;
    oCenterPanel.setLayout(gb);
    gc.insets = new Insets(5, 5, 5, 5);

    int y = 0;

    cbIncludeKeywords =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importKeywordData")); //$NON-NLS-1$
    cbIncludeKeywords.setSelected(true);
    cbIncludeKeywords.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeKeywords, gc);
    oCenterPanel.add(cbIncludeKeywords);

    cbIncludePlayList =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importPlayListData")); //$NON-NLS-1$
    cbIncludePlayList.setSelected(true);
    cbIncludePlayList.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludePlayList, gc);
    oCenterPanel.add(cbIncludePlayList);

    cbIncludeURLs =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importURLData")); //$NON-NLS-1$
    cbIncludeURLs.setSelected(true);
    cbIncludeURLs.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeURLs, gc);
    oCenterPanel.add(cbIncludeURLs);

    cbIncludeAttendees =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importAttendeeData")); //$NON-NLS-1$
    cbIncludeAttendees.setSelected(true);
    cbIncludeAttendees.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeAttendees, gc);
    oCenterPanel.add(cbIncludeAttendees);

    cbIncludeChats =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.imortChatData")); //$NON-NLS-1$
    cbIncludeChats.setSelected(true);
    cbIncludeChats.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeChats, gc);
    oCenterPanel.add(cbIncludeChats);

    cbIncludeWhiteboard =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importWhiteBoardData")); //$NON-NLS-1$
    cbIncludeWhiteboard.setSelected(true);
    cbIncludeWhiteboard.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeWhiteboard, gc);
    oCenterPanel.add(cbIncludeWhiteboard);

    cbIncludeAnnotations =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importAnnotationData")); //$NON-NLS-1$
    cbIncludeAnnotations.setSelected(true);
    cbIncludeAnnotations.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeAnnotations, gc);
    oCenterPanel.add(cbIncludeAnnotations);

    cbIncludeFileData =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importFileData")); //$NON-NLS-1$
    cbIncludeFileData.setSelected(true);
    cbIncludeFileData.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeFileData, gc);
    oCenterPanel.add(cbIncludeFileData);

    cbIncludeVotes =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importVotingData")); //$NON-NLS-1$
    cbIncludeVotes.setSelected(true);
    cbIncludeVotes.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbIncludeVotes, gc);
    oCenterPanel.add(cbIncludeVotes);

    // Add spacer label
    JLabel spacer = new JLabel(" "); // $NON-NLS-1$
    gc.gridy = y;
    y++;
    gb.setConstraints(spacer, gc);
    oCenterPanel.add(spacer);

    // flag to mark seen/unseen on import
    cbMarkSeen =
        new JCheckBox(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.markSeen")); //$NON-NLS-1$
    cbMarkSeen.setSelected(true);
    cbMarkSeen.addActionListener(this);
    gc.gridy = y;
    y++;
    gb.setConstraints(cbMarkSeen, gc);
    oCenterPanel.add(cbMarkSeen);

    // Add spacer label
    spacer = new JLabel(" "); // $NON-NLS-1$
    gc.gridy = y;
    y++;
    gb.setConstraints(spacer, gc);
    oCenterPanel.add(spacer);

    gc.gridwidth = 1;

    UIButtonPanel oButtonPanel = new UIButtonPanel();

    pbImport =
        new UIButton(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importMainButton")); //$NON-NLS-1$
    pbImport.setMnemonic(
        LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.importMainButtonMnemonic")
            .charAt(0));
    pbImport.addActionListener(this);
    getRootPane().setDefaultButton(pbImport);
    oButtonPanel.addButton(pbImport);

    pbClose =
        new UIButton(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.cancelButton")); //$NON-NLS-1$
    pbClose.setMnemonic(
        LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.cancelButtonMnemonic")
            .charAt(0));
    pbClose.addActionListener(this);
    oButtonPanel.addButton(pbClose);

    pbHelp =
        new UIButton(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.helpButton")); //$NON-NLS-1$
    pbHelp.setMnemonic(
        LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIImportFlashMeetingXMLDialog.helpButtonMnemonic")
            .charAt(0));
    ProjectCompendium.APP.mainHB.enableHelpOnButton(
        pbHelp, "io.import_flashmeeting_xml", ProjectCompendium.APP.mainHS); // $NON-NLS-1$
    oButtonPanel.addHelpButton(pbHelp);

    // other initializations
    oContentPane.setLayout(new BorderLayout());
    oContentPane.add(oCenterPanel, BorderLayout.CENTER);
    oContentPane.add(oButtonPanel, BorderLayout.SOUTH);

    pack();
    setResizable(false);
    return;
  }
Exemple #21
0
  /** Creating the configuration form */
  private void init() {
    ResourceManagementService resources = LoggingUtilsActivator.getResourceService();

    enableCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.loggingutils.ENABLE_DISABLE"));
    enableCheckBox.addActionListener(this);

    sipProtocolCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.sipaccregwizz.PROTOCOL_NAME"));
    sipProtocolCheckBox.addActionListener(this);

    jabberProtocolCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.jabberaccregwizz.PROTOCOL_NAME"));
    jabberProtocolCheckBox.addActionListener(this);

    String rtpDescription =
        resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_RTP_DESCRIPTION");
    rtpProtocolCheckBox =
        new SIPCommCheckBox(
            resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_RTP")
                + " "
                + rtpDescription);
    rtpProtocolCheckBox.addActionListener(this);
    rtpProtocolCheckBox.setToolTipText(rtpDescription);

    ice4jProtocolCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_ICE4J"));
    ice4jProtocolCheckBox.addActionListener(this);

    JPanel mainPanel = new TransparentPanel();

    add(mainPanel, BorderLayout.NORTH);

    mainPanel.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();

    enableCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.gridx = 0;
    c.gridy = 0;
    mainPanel.add(enableCheckBox, c);

    String label = resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_DESCRIPTION");
    JLabel descriptionLabel = new JLabel(label);
    descriptionLabel.setToolTipText(label);
    enableCheckBox.setToolTipText(label);
    descriptionLabel.setForeground(Color.GRAY);
    descriptionLabel.setFont(descriptionLabel.getFont().deriveFont(8));
    c.gridy = 1;
    c.insets = new Insets(0, 25, 10, 0);
    mainPanel.add(descriptionLabel, c);

    final JPanel loggersButtonPanel = new TransparentPanel(new GridLayout(0, 1));

    loggersButtonPanel.setBorder(
        BorderFactory.createTitledBorder(resources.getI18NString("service.gui.PROTOCOL")));

    loggersButtonPanel.add(sipProtocolCheckBox);
    loggersButtonPanel.add(jabberProtocolCheckBox);
    loggersButtonPanel.add(rtpProtocolCheckBox);
    loggersButtonPanel.add(ice4jProtocolCheckBox);

    c.insets = new Insets(0, 20, 10, 0);
    c.gridy = 2;
    mainPanel.add(loggersButtonPanel, c);

    final JPanel advancedPanel = new TransparentPanel(new GridLayout(0, 2));

    advancedPanel.setBorder(
        BorderFactory.createTitledBorder(resources.getI18NString("service.gui.ADVANCED")));

    fileCountField.getDocument().addDocumentListener(this);
    fileSizeField.getDocument().addDocumentListener(this);

    fileCountLabel =
        new JLabel(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_FILE_COUNT"));
    advancedPanel.add(fileCountLabel);
    advancedPanel.add(fileCountField);
    fileSizeLabel =
        new JLabel(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_FILE_SIZE"));
    advancedPanel.add(fileSizeLabel);
    advancedPanel.add(fileSizeField);

    c.gridy = 3;
    mainPanel.add(advancedPanel, c);

    archiveButton = new JButton(resources.getI18NString("plugin.loggingutils.ARCHIVE_BUTTON"));
    archiveButton.addActionListener(this);

    c = new GridBagConstraints();
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 4;
    mainPanel.add(archiveButton, c);

    if (!StringUtils.isNullOrEmpty(getUploadLocation())) {
      uploadLogsButton =
          new JButton(resources.getI18NString("plugin.loggingutils.UPLOAD_LOGS_BUTTON"));
      uploadLogsButton.addActionListener(this);

      c.insets = new Insets(10, 0, 0, 0);
      c.gridy = 5;
      mainPanel.add(uploadLogsButton, c);
    }
  }
Exemple #22
0
    public RecorderDialog(EditorServer parent) {

      super(parent, true);

      setTitle("Recorder Info");

      // fieldsPanel

      JPanel fieldsPanel = new JPanel();
      GridBagLayout gbLayout = new GridBagLayout();
      GridBagConstraints constraints;

      //		  	Address/Port/TTL :

      constraints = new GridBagConstraints();
      constraints.anchor = GridBagConstraints.EAST;
      constraints.insets = new Insets(5, 5, 0, 0);

      fieldsPanel.setLayout(gbLayout);

      JLabel AddPTTLabel = new JLabel("Address/Port/TTL :");
      gbLayout.setConstraints(AddPTTLabel, constraints);
      fieldsPanel.add(AddPTTLabel, constraints);

      constraints = new GridBagConstraints();
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.insets = new Insets(5, 5, 0, 5);
      constraints.weightx = 1.0D;

      addressPortTTL = new JTextField(25);
      addressPortTTL.setText("224.20.20.20/20002");

      gbLayout.setConstraints(addressPortTTL, constraints);

      fieldsPanel.add(addressPortTTL, constraints);

      // Outputfile...

      constraints = new GridBagConstraints();
      constraints.anchor = GridBagConstraints.EAST;
      constraints.insets = new Insets(5, 5, 0, 0);

      JLabel OFileLabel = new JLabel("Save file as... :");
      gbLayout.setConstraints(OFileLabel, constraints);
      fieldsPanel.add(OFileLabel, constraints);

      constraints = new GridBagConstraints();
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.insets = new Insets(5, 5, 0, 5);
      constraints.weightx = 1.0D;

      outFile = new JTextField(25);
      outFile.setText("Placebo.rtp");

      gbLayout.setConstraints(outFile, constraints);

      fieldsPanel.add(outFile, constraints);

      // Recording time...

      constraints = new GridBagConstraints();
      constraints.anchor = GridBagConstraints.EAST;
      constraints.insets = new Insets(5, 5, 0, 0);

      JLabel timeLabel = new JLabel("Recording time (in seconds) : ");
      gbLayout.setConstraints(timeLabel, constraints);
      fieldsPanel.add(timeLabel, constraints);

      constraints = new GridBagConstraints();
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.insets = new Insets(5, 5, 0, 5);
      constraints.weightx = 1.0D;

      durationField = new JTextField(25);
      durationField.setText("2700");

      gbLayout.setConstraints(durationField, constraints);

      fieldsPanel.add(durationField, constraints);

      // The buttons...

      JPanel buttonPanel = new JPanel();

      JButton startRecordingButton = new JButton("Start Recording");

      startRecordingButton.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent buttonPressed) {

              // startThread here !!!

              String apt = addressPortTTL.getText().trim();
              String ofile = outFile.getText().trim();
              String duration = durationField.getText().trim();

              System.out.println(
                  "\napt : *" + apt + "* ofile : *" + ofile + "* duration: *" + duration + "*");

              long dur = new Integer(duration).intValue() * 1000; // turned into ms

              recorder = new Recorder(apt, ofile, dur);

              recorder.start();

              document.resetStartTime(System.currentTimeMillis());

              // close dialog Box

              dispose();
            } //
          }); // endActionListener

      buttonPanel.add(startRecordingButton);

      Container dialogContainer = getContentPane();

      dialogContainer.setLayout(new BorderLayout());
      dialogContainer.add(fieldsPanel, BorderLayout.CENTER);
      dialogContainer.add(buttonPanel, BorderLayout.SOUTH);

      pack();

      setLocationRelativeTo(parent);
    }
  public SaveDialog(Frame parent) {
    super(parent, true);
    this.setLayout(new BorderLayout());
    // gather unsaved tab
    Set<Tab> unsaved = new LinkedHashSet<>();
    for (Tab tab : MainPanel.getAllTab()) {
      if (!tab.isSaved()) {
        unsaved.add(tab);
      }
    }
    if (unsaved.isEmpty()) {
      // close directly
      this.setTitle("Confirm close");
      // upper labels
      JPanel labels = new JPanel(new FlowLayout(FlowLayout.LEFT, 11, 7));
      labels.add(iconLabel);
      labels.add(new MyLabel(" Do you really want to close RefluxEdit?"));
      // buttons
      JPanel buttons = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 7));
      buttons.add(
          new MyButton("YES") {
            {
              SaveDialog.this.getRootPane().setDefaultButton(this);
              this.setFocusPainted(true);
            }

            @Override
            public void actionPerformed(ActionEvent ev) {
              close = true;
              SaveDialog.this.setVisible(false);
            }
          });
      buttons.add(
          new MyButton("NO") {
            {
              this.setFocusPainted(true);
            }

            @Override
            public void actionPerformed(ActionEvent ev) {
              close = false;
              SaveDialog.this.setVisible(false);
            }
          });
      buttons.setBorder(new EmptyBorder(0, 0, 5, 0));
      //
      this.add(labels, BorderLayout.CENTER);
      this.add(buttons, BorderLayout.PAGE_END);
    } else {
      // ask save changes
      this.setTitle("Unsaved changes");
      // upper components: icon and list
      JPanel upper = new JPanel(new GridBagLayout());
      JPanel listPane = new JPanel(new BorderLayout());
      final DefaultListModel<Tab> listModel = new DefaultListModel<>();
      final JList<Tab> tabList = new JList<>(listModel);
      tabList.setFont(f13);
      tabList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
      tabList.setCellRenderer(
          new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(
                JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
              JLabel label =
                  (JLabel)
                      (super.getListCellRendererComponent(
                          list, value, index, isSelected, cellHasFocus));
              if (value instanceof Tab) {
                String text = ((Tab) value).getTabLabel().getText();
                label.setText(text.substring(1)); // remove "*"
              }
              return label;
            }
          });
      for (Tab tab : unsaved) {
        listModel.addElement(tab);
      }
      tabList.getSelectionModel().setSelectionInterval(0, listModel.size() - 1);
      JScrollPane scrollPane = new JScrollPane(tabList);
      scrollPane.setPreferredSize(new Dimension(350, 170));
      listPane.add(new MyLabel("The following tabs are unsaved:"), BorderLayout.PAGE_START);
      listPane.add(scrollPane, BorderLayout.CENTER);
      // setup upper
      GridBagConstraints c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.weightx = 0;
      c.weighty = 1;
      c.insets = new Insets(5, 5, 5, 5);
      c.anchor = GridBagConstraints.FIRST_LINE_START;
      upper.add(iconLabel, c);
      //
      c.gridx = 1;
      c.weightx = 1;
      c.fill = GridBagConstraints.BOTH;
      upper.add(listPane, c);
      // lower components: buttons
      JPanel buttons = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 7));
      buttons.add(
          new MyButton("Save") {
            {
              this.setFocusPainted(true);
              this.setToolTipText("Save selected tab(s)");
              SaveDialog.this.getRootPane().setDefaultButton(this);
              if (isMetal) {
                this.setPreferredSize(METAL_BUTTON_DIZE);
              }
            }

            @Override
            public void actionPerformed(ActionEvent ev) {
              for (Tab tab : tabList.getSelectedValuesList()) {
                if (tab.getFile() != null) {
                  try {
                    tab.save();
                    MainPanel.close(tab);
                    listModel.removeElement(tab);
                  } catch (Exception ex) {
                    exception(ex);
                    break;
                  }
                } else {
                  File file =
                      FileChooser.showPreferredFileDialog(
                          RefluxEdit.getInstance(), FileChooser.SAVE, new String[0]);
                  if (file != null) {
                    try {
                      tab.save(file, false);
                      MainPanel.close(tab);
                      listModel.removeElement(tab);
                    } catch (Exception ex) {
                      exception(ex);
                      break;
                    }
                  }
                }
              }
              if (listModel.size() == 0) {
                RefluxEdit.getInstance().close();
              }
            }
          });
      buttons.add(
          new MyButton("Discard") {
            {
              this.setFocusPainted(true);
              this.setToolTipText("Discard selected tab(s)");
              if (isMetal) {
                this.setPreferredSize(METAL_BUTTON_DIZE);
              }
            }

            @Override
            public void actionPerformed(ActionEvent ev) {
              for (Tab tab : tabList.getSelectedValuesList()) {
                MainPanel.close(tab);
                listModel.removeElement(tab);
              }
              if (listModel.size() == 0) {
                RefluxEdit.getInstance().close();
              }
            }
          });
      buttons.add(
          new MyButton("Close") {
            {
              this.setFocusPainted(true);
              this.setToolTipText("Close RefluxEdit");
              if (isMetal) {
                this.setPreferredSize(METAL_BUTTON_DIZE);
              }
            }

            @Override
            public void actionPerformed(ActionEvent ev) {
              SaveDialog.this.close = true;
              SaveDialog.this.setVisible(false);
            }
          });
      buttons.add(
          new MyButton("Cancel") {
            {
              this.setFocusPainted(true);
              if (isMetal) {
                this.setPreferredSize(METAL_BUTTON_DIZE);
              }
            }

            @Override
            public void actionPerformed(ActionEvent ev) {
              SaveDialog.this.close = false;
              SaveDialog.this.setVisible(false);
            }
          });
      this.add(upper, BorderLayout.CENTER);
      this.add(buttons, BorderLayout.PAGE_END);
    }
  }
Exemple #24
0
  ShutdownFrame(CryoBay cb) {
    super("CryoBay Monitor");
    cryoB = cb;

    cmdClose =
        new JButton("Close") {
          public JToolTip createToolTip() {
            return new JToolTip();
          }
        };

    cmdClose.setToolTipText("Close program");

    cmdClose.addActionListener(this);
    addWindowListener(this);

    GridBagConstraints gbc = new GridBagConstraints();
    Border loweredbevel = BorderFactory.createLoweredBevelBorder();

    lblBStatus = new JLabel("Status: ");
    lblBHeater = new JLabel("Heater: ");
    lblBTemp = new JLabel("  Temp: ");
    lblBCli = new JLabel("   CLI: ");

    lblStatus = new JTextField(17);
    lblStatus.setEditable(false);
    lblStatus.setOpaque(true);
    lblStatus.setBorder(loweredbevel);

    lblHeater = new JTextField(17);
    lblHeater.setEditable(false);
    lblHeater.setOpaque(true);
    lblHeater.setBorder(loweredbevel);

    lblTemp = new JTextField(17);
    lblTemp.setEditable(false);
    lblTemp.setOpaque(true);
    lblTemp.setBorder(loweredbevel);

    lblCli = new JTextField(17);
    lblCli.setEditable(false);
    lblCli.setOpaque(true);
    lblCli.setBorder(loweredbevel);

    JPanel lblPanel = new JPanel();
    lblPanel.setLayout(new GridBagLayout());
    gbc.insets = new Insets(2, 5, 2, 5);
    setGbc(gbc, 0, 0, 1, 1);
    lblPanel.add(lblBStatus, gbc);
    setGbc(gbc, 0, 1, 1, 1);
    lblPanel.add(lblBHeater, gbc);
    setGbc(gbc, 0, 2, 1, 1);
    lblPanel.add(lblBTemp, gbc);
    setGbc(gbc, 0, 3, 1, 1);
    lblPanel.add(lblBCli, gbc);

    JPanel valPanel = new JPanel();
    valPanel.setLayout(new GridBagLayout());
    gbc.insets = new Insets(2, 5, 2, 5);
    setGbc(gbc, 0, 0, 1, 1);
    valPanel.add(lblStatus, gbc);
    setGbc(gbc, 0, 1, 1, 1);
    valPanel.add(lblHeater, gbc);
    setGbc(gbc, 0, 2, 1, 1);
    valPanel.add(lblTemp, gbc);
    setGbc(gbc, 0, 3, 1, 1);
    valPanel.add(lblCli, gbc);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    gbc.anchor = GridBagConstraints.CENTER;
    setGbc(gbc, 0, 5, 1, 1);
    buttonPanel.add(cmdClose, gbc);

    // finally, add the panels to the content pane
    getContentPane().setLayout(new GridBagLayout());
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.anchor = GridBagConstraints.CENTER;
    setGbc(gbc, 0, 0, 1, 4);
    getContentPane().add(lblPanel, gbc);
    setGbc(gbc, 1, 0, 1, 4);
    getContentPane().add(valPanel, gbc);
    setGbc(gbc, 0, 5, 0, 0);
    getContentPane().add(buttonPanel, gbc);

    setSize(300, 220);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(screenSize.width / 2 - 300, screenSize.height / 2 - 220);
    setResizable(true);
  }