Example #1
0
  private JScrollPane makeInputPanel() {
    boolean hasRequiredFields = false;
    JPanel inputPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbConst = new GridBagConstraints();
    gbConst.anchor = GridBagConstraints.WEST;
    gbConst.insets = new Insets(5, 5, 5, 5);

    for (RequestProp prop : props) {
      JLabel label = prop.getLabel();
      gbConst.gridwidth = 1;
      inputPanel.add(label, gbConst);

      inputPanel.add(Box.createHorizontalStrut(5));

      JComponent comp = prop.getValueComponent();
      gbConst.gridwidth = GridBagConstraints.REMAINDER;
      inputPanel.add(comp, gbConst);

      if (prop.isRequired) hasRequiredFields = true;
    }

    if (hasRequiredFields) {
      inputPanel.add(new JLabel(" * = Required Field"));
    }

    return new JScrollPane(inputPanel);
  }
Example #2
0
  public Plot2Da() {
    check_ = new JCheckBox("Hold on");
    plot_ = new Plot2D();

    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 2, 2);
    c.weightx = 1.0;
    c.weighty = 1.0;

    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 0;
    add(check_, c);

    c.gridwidth = 1;
    c.gridheight = 1;
    c.gridx = 0;
    c.gridy = 1;
    c.fill = GridBagConstraints.REMAINDER;
    c.ipadx = plot_.getSize().width + 100;
    c.ipady = plot_.getSize().height + 100;
    plot_.setBackground(Color.WHITE);

    add(plot_, c);

    setBorder(BorderFactory.createEtchedBorder());
  }
  /**
   * Adiciona um label, um componente de edia§a£o, mais um label e outro componente de edia§a£o.
   * Todos na mesma linha
   *
   * @param label Label 1
   * @param componente Componente de edia§a£o
   * @param label2 Label 2
   * @param componente2 Componente de edia§a£o 2
   */
  public void add(String label, JComponent componente, String label2, JComponent componente2) {
    GridBagConstraints cons = new GridBagConstraints();
    cons.fill = GridBagConstraints.BOTH;
    cons.insets = new Insets(4, 4, 4, 4);

    cons.fill = GridBagConstraints.NONE;
    cons.anchor = GridBagConstraints.NORTHWEST;
    cons.weightx = 0;
    cons.gridwidth = 1;
    this.getContentPane().add(new JLabel(label), cons);

    cons.weightx = 1;
    cons.gridwidth = 1;
    cons.fill = GridBagConstraints.BOTH;
    this.getContentPane().add(componente, cons);

    cons.fill = GridBagConstraints.NONE;
    cons.weightx = 0;
    cons.gridwidth = 1;
    this.getContentPane().add(new JLabel(label2), cons);

    cons.weightx = 1;
    cons.fill = GridBagConstraints.BOTH;
    cons.gridwidth = GridBagConstraints.REMAINDER;
    this.getContentPane().add(componente2, cons);
  }
  protected JPanel buildVersionLockingFieldChooser() {
    GridBagConstraints constraints = new GridBagConstraints();
    Pane lockingPanel = new Pane(new GridBagLayout());

    JLabel lockingFieldLabel = buildLabel("EIS_LOCKING_POLICY_XPATH");
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_START;
    constraints.insets = new Insets(0, 0, 0, 0);
    lockingPanel.add(lockingFieldLabel, constraints);

    XpathChooser xpathChooser =
        new XpathChooser(this.getWorkbenchContextHolder(), buildLockingFieldSelectionHolder());
    xpathChooser.setAccessibleLabeler(lockingFieldLabel);
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = new Insets(0, 5, 0, 0);
    lockingPanel.add(xpathChooser, constraints);

    return lockingPanel;
  }
  private JPanel getMainPanel() {
    if (mainPanel == null) {
      mainPanel = new JPanel();
      mainPanel.setPreferredSize(new Dimension(550, 300));
      GridBagLayout layout = new GridBagLayout();

      mainPanel.setLayout(layout);

      GridBagConstraints constraints = new GridBagConstraints();

      constraints.fill = GridBagConstraints.BOTH;
      constraints.weightx = 2;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.gridwidth = 2;
      layout.setConstraints(getAvailableRobotsPanel(), constraints);
      mainPanel.add(getAvailableRobotsPanel());
      constraints.gridwidth = 1;
      constraints.weightx = 0;
      constraints.weighty = 0;
      constraints.anchor = GridBagConstraints.CENTER;
      layout.setConstraints(getButtonsPanel(), constraints);
      mainPanel.add(getButtonsPanel());
      constraints.gridwidth = GridBagConstraints.REMAINDER;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      layout.setConstraints(getSelectedRobotsPanel(), constraints);
      mainPanel.add(getSelectedRobotsPanel());
    }
    return mainPanel;
  }
  /*
   * (non-Javadoc)
   *
   * @see com.intel.hpc.stl.ui.common.JSection#getMainPanel()
   */
  @Override
  protected JComponent getMainComponent() {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    mainPanel.add(getCtrlPanel(), BorderLayout.NORTH);
    errorsCardView = new PerfErrorsCardView(STLConstants.K0705_PORT_COUNTERS.getValue());

    JPanel propCardPanel = new JPanel();
    propCardPanel.setLayout(new GridBagLayout());
    propCardPanel.setBorder(BorderFactory.createEmptyBorder(5, 2, 2, 2));

    GridBagConstraints gc = new GridBagConstraints();
    gc.insets = new Insets(2, 2, 2, 2);
    gc.weightx = 1;
    gc.weighty = 1;
    gc.gridwidth = 1;
    gc.fill = GridBagConstraints.BOTH;
    propCardPanel.add(errorsCardView, gc);

    gc.gridwidth = GridBagConstraints.REMAINDER;
    otherCardView = new PerfErrorsCardView(STLConstants.K0715_OTHER_COUNTERS.getValue());
    propCardPanel.add(otherCardView, gc);
    mainPanel.add(propCardPanel, BorderLayout.CENTER);

    JScrollPane scrollPane = new JScrollPane(mainPanel);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    return scrollPane;
  }
  private void buildConfigPanel() {

    initConfigPanel();

    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(0, 0, 0, 0);

    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    configPanel.add(new JLabel("Database output directory:"), c);

    //        c.anchor = GridBagConstraints.FIRST_LINE_END;
    c.gridy = 1;
    configPanel.add(rdoUseGlobalDir, c);
    c.gridy = 2;
    configPanel.add(rdoUseCustomDir, c);

    c.anchor = GridBagConstraints.CENTER;
    c.gridy = 3;
    c.gridwidth = 2;
    configPanel.add(lblCustomOutDir, c);

    c.anchor = GridBagConstraints.FIRST_LINE_END;
    c.gridy = 4;
    c.gridwidth = 1;
    configPanel.add(btnCustomDir, c);
  }
  /** Init the panel contents */
  private void init() {
    setLayout(new GridBagLayout());
    JButton changeDirButton = ((ChangeCWDAction) table.getActionMap().get("cwd")).createButton();
    JButton upDirButton =
        ((ChangeCWDAction) table.getActionMap().get("cwd")).createParentDirButton();

    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 0;
    gbc.fill = GridBagConstraints.VERTICAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    add(changeDirButton, gbc);

    gbc.gridx = 1;
    gbc.gridwidth = gbc.gridheight = 1;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.LINE_START;
    add(table.getComboBox(), gbc);

    gbc.gridx = 2;
    gbc.gridwidth = gbc.gridheight = 1;
    gbc.weightx = 0;
    gbc.fill = GridBagConstraints.VERTICAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    add(upDirButton, gbc);
  }
Example #9
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);
  }
  private void createCellType_2() {
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 1;
    gbConstraints.gridwidth = 1;
    gbConstraints.gridheight = 1;
    gbConstraints.fill = GridBagConstraints.BOTH;
    gbConstraints.weightx = 1;
    gbConstraints.weighty = 0;
    gbConstraints.anchor = GridBagConstraints.NORTH;
    gbConstraints.insets = new Insets(1, 1, 1, 1);
    gbLayout.setConstraints((JTextField) al.get(0), gbConstraints);
    add((JTextField) al.get(0));

    gbConstraints.gridx = 0;
    gbConstraints.gridy = 2;
    gbConstraints.gridwidth = 1;
    gbConstraints.gridheight = 1;
    gbConstraints.fill = GridBagConstraints.BOTH;
    gbConstraints.weightx = 1;
    gbConstraints.weighty = 0;
    gbConstraints.anchor = GridBagConstraints.NORTH;
    gbConstraints.insets = new Insets(1, 1, 1, 1);
    gbLayout.setConstraints((JTextField) al.get(1), gbConstraints);
    add((JTextField) al.get(1));
  }
  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;
  }
  protected void showDefaultAccountWarning() {
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    GridBagLayout mainLayout = new GridBagLayout();
    GridBagConstraints mainConstraints = new GridBagConstraints();

    setLayout(mainLayout);

    mainConstraints.gridwidth = GridBagConstraints.REMAINDER;
    mainConstraints.anchor = GridBagConstraints.NORTHWEST;
    mainConstraints.weightx = 1.0;
    mainConstraints.insets = new Insets(0, 10, 5, 0);
    mainLayout.setConstraints(defaultAccountCheckBox, mainConstraints);
    add(defaultAccountCheckBox);

    mainConstraints = new GridBagConstraints();
    mainConstraints.weighty = 1.0;
    mainConstraints.gridwidth = GridBagConstraints.REMAINDER;

    /*
     * mainConstraints.fill = GridBagConstraints.BOTH;
     * mainConstraints.insets = new Insets(0, 0, 0, 0);
     * mainConstraints.gridwidth = GridBagConstraints.REMAINDER;
     * mainConstraints.weightx = 1.0; mainConstraints.weighty = 1.0;
     */
    JLabel label =
        new JLabel(
            MailResourceLoader.getString("dialog", "account", "using_default_account_settings"));
    Font newFont = label.getFont().deriveFont(Font.BOLD);
    label.setFont(newFont);
    mainLayout.setConstraints(label, mainConstraints);
    add(label);
  }
    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)));
    }
  protected void initializeLayout() {
    GridBagConstraints constraints = new GridBagConstraints();
    setBorder(
        BorderFactory.createTitledBorder(
            resourceRepository().getString("FIELD_ACCESSING_PANEL_BORDER_TEXT")));

    JRadioButton methodAccessingRadioButton = buildMethodAccessingRadioButton();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_START;
    constraints.insets = new Insets(0, 5, 0, 5);
    add(methodAccessingRadioButton, constraints);

    JRadioButton fieldAccessingRadioButton = buildFieldAccessingRadioButton();
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.insets = new Insets(0, 5, 0, 5);
    add(fieldAccessingRadioButton, constraints);
  }
Example #15
0
  /**
   * Construct the demo
   *
   * @param window
   * @param capture
   * @throws Exception
   */
  public VideoColourSIFT(final JComponent window, final VideoCapture capture) throws Exception {
    final int width = capture.getWidth();
    final int height = capture.getHeight();
    this.capture = capture;
    this.polygonListener = new PolygonDrawingListener();

    GridBagConstraints gbc = new GridBagConstraints();

    final JLabel label =
        new JLabel(
            "<html><body><p>Hold an object in front of the camera, and press space. Select<br/>"
                + "the outline of the object by clicking points on the frozen video<br/>"
                + "image, and press C when you're done. Press space to start the video<br/>"
                + "again, and the object should be tracked.</p></body></html>");
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    gbc.insets = new Insets(8, 8, 8, 8);
    window.add(label, gbc);

    this.vidPanel = new JPanel(new GridBagLayout());
    this.vidPanel.setBorder(BorderFactory.createTitledBorder("Live Video"));
    this.videoFrame = VideoDisplay.createVideoDisplay(capture, this.vidPanel);
    gbc = new GridBagConstraints();
    gbc.gridy = 1;
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    window.add(this.vidPanel, gbc);

    this.modelPanel = new JPanel(new GridBagLayout());
    this.modelPanel.setBorder(BorderFactory.createTitledBorder("Model"));
    this.modelFrame = new ImageComponent(true, false);
    this.modelFrame.setSize(width, height);
    this.modelFrame.setPreferredSize(new Dimension(width, height));
    this.modelPanel.add(this.modelFrame);
    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.PAGE_START;
    gbc.gridy = 1;
    gbc.gridx = 1;
    window.add(this.modelPanel, gbc);

    this.matchPanel = new JPanel(new GridBagLayout());
    this.matchPanel.setBorder(BorderFactory.createTitledBorder("Matches"));
    this.matchFrame = new ImageComponent(true, false);
    this.matchFrame.setSize(width * 2, height);
    this.matchFrame.setPreferredSize(new Dimension(width * 2, height));
    this.matchPanel.add(this.matchFrame);
    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.PAGE_END;
    gbc.gridy = 2;
    gbc.gridx = 0;
    gbc.gridwidth = 2;
    window.add(this.matchPanel, gbc);

    this.videoFrame.getScreen().addMouseListener(this.polygonListener);

    this.videoFrame.addVideoListener(this);
    this.engine = new DoGColourSIFTEngine();
    this.engine.getOptions().setDoubleInitialImage(false);
  }
  @Override
  protected void initializeLayout() {
    GridBagConstraints constraints = new GridBagConstraints();

    // Field pairs table
    JComponent tablePanel = this.buildFieldPairsTablePanel();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = new Insets(0, 0, 0, 0);
    this.add(tablePanel, constraints);

    // Button panel
    JPanel buttonPanel = this.buildButtonPanel();
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.PAGE_START;
    constraints.insets = new Insets(0, 5, 0, 0);
    this.add(buttonPanel, 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);
  }
  private void makePanel() {
    this.setBackground(ColorConsts.clrPanelBg);
    this.setLayout(new GridBagLayout());
    GridBagConstraints lc = new GridBagConstraints();
    lc.anchor = GridBagConstraints.LINE_START;
    lc.fill = GridBagConstraints.BOTH;
    lc.weightx = lc.weighty = 10;
    lc.gridx = lc.gridy = 0;
    lc.insets = new Insets(10, 0, 0, 0);
    lc.gridwidth = 8;
    this.add(tb_collection, lc);

    lc.fill = GridBagConstraints.NONE;
    lc.weightx = lc.weighty = 1;
    lc.gridx = 0;
    lc.gridy++;
    lc.insets = new Insets(20, 10, 0, 10);
    lc.gridwidth = 1;
    this.add(bt_add, lc);
    lc.gridx++;
    this.add(bt_close, lc);
    lc.gridx++;
    lc.fill = GridBagConstraints.HORIZONTAL;
    lc.gridwidth = 6;
    this.add(new JLabel(""), lc);
  }
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    savingDataLabel = new javax.swing.JLabel();

    setPreferredSize(new java.awt.Dimension(450, 50));
    setLayout(new java.awt.GridBagLayout());

    savingDataLabel.setText(
        org.openide.util.NbBundle.getMessage(
            SavingProjectDataPanel.class, "LBL_savingDataLabel")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 8);
    add(savingDataLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 8, 8, 8);
    gridBagConstraints.weightx = 1.0;
    add(component, gridBagConstraints);
  } // </editor-fold>//GEN-END:initComponents
    private void init() {
      setLayout(new GridBagLayout());

      for (Alignment alignment : Alignment.values()) alignmentCombo.addItem(alignment);

      GridBagConstraints gbc = createConstraints();

      add(addSection, gbc);
      add(addGlue, gbc);
      add(addTextField0, gbc);
      add(addTextField1, gbc);
      add(removeLast, gbc);
      add(new JSeparator(SwingConstants.HORIZONTAL), gbc);
      add(changeBackground, gbc);
      add(new JSeparator(SwingConstants.HORIZONTAL), gbc);
      add(columnStrategy, gbc);
      add(rowStrategy, gbc);
      add(new JSeparator(SwingConstants.HORIZONTAL), gbc);

      gbc.gridwidth = 1;
      add(new JLabel("space: "), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(spaceSpinner, gbc);
      gbc.gridwidth = 1;
      add(new JLabel("alignment: "), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(alignmentCombo, gbc);

      add(new JSeparator(SwingConstants.HORIZONTAL), gbc);

      gbc.weighty = 1;
      add(Box.createVerticalGlue(), gbc);
    }
  protected void initializeLayout() {
    this.sortedFieldsAdapter = this.buildSortedInsertFieldReturnOnlyFlagsAdapter();
    this.tableModel = this.buildTableModel();
    this.rowSelectionModel = this.buildRowSelectionModel();

    GridBagConstraints constraints = new GridBagConstraints();

    // Create the button panel first
    JPanel buttonPanel = buildButtonPanel();
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.LINE_END;
    constraints.insets = new Insets(5, 0, 0, 0);

    add(buttonPanel, constraints);

    // Create the table after since some listeners need access to the buttons
    JComponent insertTablePane = buildInsertPanel();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.insets = new Insets(0, 0, 0, 0);

    add(insertTablePane, constraints);
  }
Example #22
0
  private void initComponents() {
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;

    MLabel labLookAndFeel = new MLabel(resources.getString("text.lookAndFeel"));
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.insets = new Insets(12, 12, 12, 12);
    add(labLookAndFeel, c);

    comboLookAndFeels = new MComboBox(getInstalledLookAndFeels());
    c.gridx = 1;
    c.gridy = 0;
    c.gridwidth = 2;
    c.weightx = 0.5;
    c.weighty = 0.0;
    c.insets = new Insets(12, 0, 12, 12);
    add(comboLookAndFeels, c);

    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = GridBagConstraints.REMAINDER;
    c.weighty = 1.0;
    c.fill = GridBagConstraints.BOTH;
    add(new MLabel(), c);

    populateScreen();
  }
    protected JPanel buildContentPanel() {
      JPanel pnl = new JPanel(new GridBagLayout());
      GridBagConstraints gc = new GridBagConstraints();

      gc.anchor = GridBagConstraints.NORTHWEST;
      gc.fill = GridBagConstraints.HORIZONTAL;
      gc.weightx = 1.0;
      gc.gridwidth = 2;
      HtmlPanel html = new HtmlPanel();
      html.setText(
          tr(
              "<html>"
                  + "JOSM successfully retrieved a Request Token. "
                  + "JOSM is now launching an authorization page in an external browser. "
                  + "Please login with your OSM username and password and follow the instructions "
                  + "to authorize the Request Token. Then switch back to this dialog and click on "
                  + "<strong>{0}</strong><br><br>"
                  + "If launching the external browser fails you can copy the following authorize URL "
                  + "and paste it into the address field of your browser.</html>",
              tr("Request Access Token")));
      pnl.add(html, gc);

      gc.gridx = 0;
      gc.gridy = 1;
      gc.weightx = 0.0;
      gc.gridwidth = 1;
      pnl.add(new JLabel(tr("Authorize URL:")), gc);

      gc.gridx = 1;
      gc.weightx = 1.0;
      pnl.add(tfAuthoriseUrl = new JosmTextField(), gc);
      tfAuthoriseUrl.setEditable(false);

      return pnl;
    }
 private void populateFieldsPanel() {
   fieldsPanel.removeAll();
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.BOTH;
   gbc.anchor = GridBagConstraints.NORTHWEST;
   boolean first = true;
   for (ServerDescriptor server : orderedServers) {
     gbc.insets.left = 0;
     gbc.weightx = 0.0;
     if (!first) {
       gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
     }
     gbc.gridwidth = 4;
     fieldsPanel.add(hmLabels.get(server.getId()), gbc);
     gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
     gbc.gridwidth--;
     fieldsPanel.add(hmFields.get(server.getId()), gbc);
     gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
     gbc.gridwidth = GridBagConstraints.RELATIVE;
     fieldsPanel.add(hmCbs.get(server.getId()), gbc);
     gbc.gridwidth = GridBagConstraints.REMAINDER;
     gbc.weightx = 1.0;
     fieldsPanel.add(Box.createHorizontalGlue(), gbc);
     first = false;
   }
   addVerticalGlue(fieldsPanel);
 }
  private JPanel createPublishSettingsPanel() {
    final JComboBox fileFormat = new JComboBox(exportFormatModel);

    final GridBagConstraints c = new GridBagConstraints();
    final JPanel publishSettingsPanel = new JPanel(new GridBagLayout());

    c.insets = new Insets(5, 5, 0, 5);
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    publishSettingsPanel.add(
        new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.OutputType")), c);

    c.insets = new Insets(5, 5, 5, 0);
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 0.0;
    publishSettingsPanel.add(fileFormat, c);

    c.insets = new Insets(0, 5, 5, 5);
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 1.0;
    publishSettingsPanel.add(lockOutputTypeCheckBox, c);
    return publishSettingsPanel;
  }
Example #26
0
  // Tag interface
  // -------------------------------------------------------------------------
  public void doTag(final XMLOutput output) throws JellyTagException {
    tableLayoutTag = (TableLayoutTag) findAncestorWithClass(TableLayoutTag.class);
    if (tableLayoutTag == null) {
      throw new JellyTagException("this tag must be nested within a <tableLayout> tag");
    }
    rowIndex = tableLayoutTag.nextRowIndex();
    cells.clear();

    invokeBody(output);

    // now iterate through the rows and add each one to the layout...
    int colIndex = 0;
    for (Iterator iter = cells.iterator(); iter.hasNext(); ) {
      Cell cell = (Cell) iter.next();
      GridBagConstraints c = cell.getConstraints();

      // are we the last cell in the row
      if (iter.hasNext()) {
        // not last in row
        c.gridwidth = 1;
        c.gridx = colIndex++;
      } else {
        // end of row
        c.gridwidth = GridBagConstraints.REMAINDER;
      }
      c.gridy = rowIndex;

      // now lets add the cell to the table
      tableLayoutTag.addCell(cell);
    }
    cells.clear();
  }
  private void layoutComponents(String hebrewWord, String englishWord) {
    setLayout(new GridBagLayout());

    JLabel hebrewLabel = new JLabel(hebrewWord, SwingConstants.CENTER);
    hebrewLabel.setFont(hebrewLabel.getFont().deriveFont(100.0f));
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.ipadx = 15;
    constraints.insets = new Insets(10, 20, 10, 20);
    add(hebrewLabel, constraints);

    JLabel englishLabel = new JLabel(englishWord, SwingConstants.CENTER);
    englishLabel.setFont(englishLabel.getFont().deriveFont(50.0f));
    constraints = new GridBagConstraints();
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.insets = new Insets(10, 20, 10, 20);
    add(englishLabel, constraints);

    okButton = new JButton("OK");
    constraints = new GridBagConstraints();
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.insets = new Insets(10, 20, 10, 20);
    add(okButton, constraints);
  }
Example #28
0
 public SpeedSliderPanel(GUIWorkspace workspace, boolean labelsBelow) {
   this.workspace = workspace;
   this.labelsBelow = labelsBelow;
   speedSlider = new SpeedSlider((int) workspace.speedSliderPosition());
   speedSlider.setFocusable(false);
   speedSlider.addChangeListener(this);
   speedSlider.addMouseListener(this);
   speedSlider.setOpaque(false);
   org.nlogo.awt.Fonts.adjustDefaultFont(normal);
   setOpaque(false);
   if (labelsBelow) {
     GridBagLayout gridbag = new GridBagLayout();
     GridBagConstraints c = new GridBagConstraints();
     setLayout(gridbag);
     c.gridwidth = GridBagConstraints.REMAINDER;
     add(speedSlider, c);
     c.gridwidth = 1;
     c.anchor = GridBagConstraints.CENTER;
     add(normal, c);
   } else {
     java.awt.BorderLayout layout = new java.awt.BorderLayout();
     layout.setVgap(0);
     setLayout(layout);
     add(speedSlider, java.awt.BorderLayout.CENTER);
     add(normal, java.awt.BorderLayout.EAST);
   }
   enableLabels(0);
 }
Example #29
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jLabel1 = new javax.swing.JLabel();
    folderPanel = new javax.swing.JPanel();

    setBorder(javax.swing.BorderFactory.createEmptyBorder(12, 12, 12, 12));
    setLayout(new java.awt.GridBagLayout());

    jLabel1.setText(
        org.openide.util.NbBundle.getMessage(BrowseFolders.class, "LBL_Folders")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
    add(jLabel1, gridBagConstraints);

    folderPanel.setLayout(new java.awt.BorderLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    add(folderPanel, gridBagConstraints);
  } // </editor-fold>//GEN-END:initComponents
  /** Place le JPanel d'un enfant dans le JPanel courant (elpane). */
  private void placerAffichage(
      final AffichageFormulaire affEnfant,
      final JPanel elpane,
      final GridBagConstraints c,
      final int pos,
      final boolean dernier) {
    if (affEnfant.avecEnfants()) {
      final JPanel panelEnfant = affEnfant.getPanel(dernier);
      c.weightx = 1;
      c.gridwidth = 2;
      c.gridx = 0;
      c.gridy = pos;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.CENTER;
      elpane.add(panelEnfant, c);
    } else {
      final JPanel panelGaucheEnfant = affEnfant.getPanelGauche();
      c.weightx = 0;
      c.gridwidth = 1;
      c.gridx = 0;
      c.gridy = pos;
      c.fill = GridBagConstraints.NONE;
      c.anchor = GridBagConstraints.WEST;
      elpane.add(panelGaucheEnfant, c);

      final JPanel panelDroiteEnfant = affEnfant.getPanelDroite(dernier);
      c.weightx = 1;
      c.gridwidth = 1;
      c.gridx = 1;
      c.gridy = pos;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.CENTER;
      elpane.add(panelDroiteEnfant, c);
    }
  }