Пример #1
1
  /** Initializes contained components. */
  private void initComponents() {
    final SimpleDateFormat format = new SimpleDateFormat("mm:ss");
    final Calendar c = Calendar.getInstance();
    final JLabel counter = new JLabel();

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

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

    GridBagConstraints constraints = new GridBagConstraints();

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

    messageLabel.setForeground(Color.WHITE);

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

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

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

    long initialSeconds = 0;

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

    c.setTimeInMillis(initialSeconds);

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

    if (initialSeconds > 0)
      timer.schedule(
          new TimerTask() {
            @Override
            public void run() {
              if (c.getTimeInMillis() - 1000 > 0) {
                c.add(Calendar.SECOND, -1);
                counter.setText(format.format(c.getTime()));
              }
            }
          },
          1000,
          1000);
  }
  /** stellt das Datenidentifikationsauswahl-Panel zusammen */
  private void createAndShowGui() {
    GridBagConstraints gbc;

    // Zeile für Zeile hinzufügen
    // Attributgruppe
    gbc = makegbc(0, 0, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_atgLabel, gbc);
    add(_atgLabel);

    gbc = makegbc(1, 0, 1, 1);
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    _gridBagLayout.setConstraints(_atgTextField, gbc);
    add(_atgTextField);

    // Aspekte
    gbc = makegbc(0, 1, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_aspLabel, gbc);
    add(_aspLabel);

    gbc = makegbc(1, 1, 1, 1);
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    _gridBagLayout.setConstraints(_aspTextField, gbc);
    add(_aspTextField);

    // Simulationsvariante
    gbc = makegbc(0, 2, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_simLabel, gbc);
    add(_simLabel);

    gbc = makegbc(1, 2, 1, 1);
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    _gridBagLayout.setConstraints(_simTextField, gbc);
    add(_simTextField);

    // Objekte
    gbc = makegbc(0, 3, 1, 1);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    _gridBagLayout.setConstraints(_objLabel, gbc);
    add(_objLabel);

    JScrollPane scrollPane = new JScrollPane(_objList);
    gbc = makegbc(1, 3, 1, 1);
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    _gridBagLayout.setConstraints(scrollPane, gbc);
    add(scrollPane);

    // Ändern - Button
    gbc = makegbc(2, 0, 1, 4);
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    _gridBagLayout.setConstraints(_changeButton, gbc);
    add(_changeButton);
  }
  /** Creates the panel with the optional components. */
  private void _setupOptionsPanel(JComponent[] components) {
    JPanel mainButtons = new JPanel();
    JPanel emptyPanel = new JPanel();
    GridBagLayout gbLayout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    mainButtons.setLayout(gbLayout);

    for (JComponent b : components) {
      mainButtons.add(b);
    }
    mainButtons.add(emptyPanel);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;

    for (JComponent b : components) {
      gbLayout.setConstraints(b, c);
    }

    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.SOUTH;
    c.gridheight = GridBagConstraints.REMAINDER;
    c.weighty = 1.0;

    gbLayout.setConstraints(emptyPanel, c);

    _optionsPanel.add(mainButtons, BorderLayout.CENTER);
  }
  @Override
  public void reload(ScreenDeviceInfo deviceInfo) {
    super.reload(deviceInfo);

    JPanel contentPanel = getPanel().getContentPanel();
    contentPanel.removeAll();

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.weightx = 1.0;
    constraints.weightx = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = GridBagConstraints.REMAINDER;
    constraints.gridy = GridBagConstraints.RELATIVE;
    constraints.anchor = GridBagConstraints.NORTHWEST;

    for (DesignComponent item : getChildren()) {
      ScreenDisplayPresenter presenter = item.getPresenter(ScreenDisplayPresenter.class);
      if (presenter == null) {
        continue;
      }

      contentPanel.add(presenter.getView(), constraints);
      presenter.reload(deviceInfo);
    }

    constraints.weighty = 1.0;
    constraints.anchor = GridBagConstraints.CENTER;
    contentPanel.add(fillPanel, constraints);
  }
Пример #5
0
  public void insert(Container cont, GridBagLayout gbl, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = x;
    gbc.gridy = y;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.fill = GridBagConstraints.NONE;

    gbl.setConstraints(name, gbc);
    cont.add(name);

    gbc.gridx = x + 1;
    gbc.weightx = 10;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    gbl.setConstraints(scroll, gbc);
    cont.add(scroll);

    gbc.gridx = x + 2;
    gbc.weightx = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;

    gbl.setConstraints(field, gbc);
    cont.add(field);
  }
Пример #6
0
  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;
  }
Пример #7
0
  private static JPanel makePanel(String title, String href) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createTitledBorder(title));

    JLabel label = new JLabel(href);

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

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

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

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

    return p;
  }
Пример #8
0
  private void initialize() {
    setName("JunkPanel");
    setLayout(new GridBagLayout());
    refreshLanguage();

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

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

    add(hideJunkMessagesCheckBox, constraints);

    constraints.gridy++;

    add(markJunkIdentityBadCheckBox, constraints);

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

    add(stopBoardUpdatesWhenDosedCheckBox, constraints);

    constraints.gridy++;

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

      add(subPanel, constraints);
    }

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

    // Add listeners
    stopBoardUpdatesWhenDosedCheckBox.addActionListener(listener);
  }
Пример #9
0
 /**
  * Adds a popup menu.
  *
  * @param label the label
  * @param items the menu items
  * @param defaultItem the menu item initially selected
  */
 public void addChoice(String label, String[] items, String defaultItem) {
   String label2 = label;
   if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' ');
   Label theLabel = makeLabel(label2);
   c.gridx = 0;
   c.gridy = y;
   c.anchor = GridBagConstraints.EAST;
   c.gridwidth = 1;
   if (choice == null) {
     choice = new Vector(4);
     defaultChoiceIndexes = new Vector(4);
     c.insets = getInsets(5, 0, 5, 0);
   } else c.insets = getInsets(0, 0, 5, 0);
   grid.setConstraints(theLabel, c);
   add(theLabel);
   Choice thisChoice = new Choice();
   thisChoice.addKeyListener(this);
   thisChoice.addItemListener(this);
   for (int i = 0; i < items.length; i++) thisChoice.addItem(items[i]);
   if (defaultItem != null) thisChoice.select(defaultItem);
   else thisChoice.select(0);
   c.gridx = 1;
   c.gridy = y;
   c.anchor = GridBagConstraints.WEST;
   grid.setConstraints(thisChoice, c);
   add(thisChoice);
   choice.addElement(thisChoice);
   int index = thisChoice.getSelectedIndex();
   defaultChoiceIndexes.addElement(new Integer(index));
   if (Recorder.record || macro) saveLabel(thisChoice, label);
   y++;
 }
Пример #10
0
    public void addRow(String label, JComponent component) {
      GridBagConstraints labelConstraints = new GridBagConstraints();
      labelConstraints.gridx = 0;
      labelConstraints.gridy = rowCount;
      labelConstraints.insets = new Insets(0, 0, 5, 5);
      labelConstraints.anchor = GridBagConstraints.LINE_END;

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

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

      // Add another column/row that takes up all available space.
      // This moves the layout to the top-left corner.
      layout.columnWidths = new int[] {0, 0, 0};
      layout.columnWeights = new double[] {0.0, 0.0, 1.0E-4};
      layout.rowHeights = new int[rowCount + 1];
      layout.rowWeights = new double[rowCount + 1];
      layout.rowWeights[rowCount] = 1.0E-4;
    }
Пример #11
0
  public void initComponents() {
    GridBagLayout gridBag = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();

    JLabel label;
    JPanel panel;
    Dimension size;

    setBorder(new javax.swing.border.EtchedBorder());
    setLayout(gridBag);

    label = new JLabel(name);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBag.setConstraints(label, constraints);
    add(label);

    panel = filterOptions();
    gridBag.setConstraints(panel, constraints);
    add(panel);

    sliderCutoff = new JSlider(JSlider.VERTICAL);
    sliderCutoff.setPaintTicks(true);
    sliderCutoff.setToolTipText("Cutoff Frequency");
    sliderCutoff.setMinimum(0);
    sliderCutoff.setMaximum(500);
    sliderCutoff.setMinorTickSpacing(25);
    sliderCutoff.setMajorTickSpacing(100);
    sliderCutoff.setValue(100);
    sliderCutoff.addChangeListener(new CutoffListener(filter));
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.gridwidth = 1;
    gridBag.setConstraints(sliderCutoff, constraints);
    add(sliderCutoff);

    sliderResonance = new JSlider(JSlider.VERTICAL);
    sliderResonance.setPaintTicks(true);
    sliderResonance.setToolTipText("Resonance (Pass-band Ripple)");
    sliderResonance.setMinimum(1);
    sliderResonance.setMaximum(58);
    sliderResonance.setMinorTickSpacing(3);
    sliderResonance.setMajorTickSpacing(57);
    sliderResonance.setValue(1);
    sliderResonance.addChangeListener(new ResonanceListener(filter));
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBag.setConstraints(sliderResonance, constraints);
    add(sliderResonance);

    label = new JLabel("Cutoff");
    constraints.gridwidth = 1;
    constraints.ipadx = 10;
    gridBag.setConstraints(label, constraints);
    add(label);

    label = new JLabel("Resonance");
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBag.setConstraints(label, constraints);
    add(label);
  }
  // Color gre;
  Rules(String se) {
    email = se;
    conti = new Button("Continue");
    rules = new Button("ClicK Here For Rules");
    p1 = new JOptionPane();
    Icon image = new ImageIcon("books.jpg");
    Icon image1 = new ImageIcon("girl.jpg");
    Icon image2 = new ImageIcon("uit.jpg");
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    conti.addActionListener(this);
    rules.addActionListener(this);
    // gre=new Color(117,102,185);
    p = new Panel();
    p2 = new Panel();
    p3 = new Panel();
    p4 = new Panel();
    f = new Frame();
    pic = new JLabel(image);
    pic1 = new JLabel(image1);
    pic2 = new JLabel(image2);
    gbc.anchor = GridBagConstraints.SOUTHWEST;
    gl.setConstraints(pic1, gbc);
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    gl.setConstraints(pic, gbc);
    Insets is = new Insets(30, 30, 30, 30);
    gbc.insets = is;
    gbc.ipadx = 14;
    gbc.ipady = 8;
    gl.setConstraints(rules, gbc);
    gl.setConstraints(conti, gbc);
    p2.setLayout(gl);
    p4.add(pic2);
    p2.add(pic);
    p3.setLayout(gl);
    p3.add(pic1);
    p.add(conti);
    p.add(rules);
    p.setLayout(gl);
    f.add(p4, "North");
    f.add(p3, "East");
    f.add(p2, "West");

    f.add(p, "Center");
    f.setTitle("RULES BOOK");
    // f.setBackground(gre);
    f.setVisible(true);
    f.setSize(900, 600);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });
  }
Пример #13
0
  public FormBuilder addLabeledComponent(
      @Nullable JComponent label, @NotNull JComponent component, int topInset, boolean labelOnTop) {
    GridBagConstraints c = new GridBagConstraints();
    topInset = myLineCount > 0 ? topInset : 0;

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

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

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

      myPanel.add(component, c);

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

      myPanel.add(label, c);

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

      myPanel.add(component, c);

      myLineCount++;
    }

    return this;
  }
Пример #14
0
  /**
   * Used to create the top panel describing the current feedback question
   *
   * @param fb Feedback question to describe
   * @return Panel with title and description
   */
  public JPanel createQuestionDataPanel(AbstractFeedbackType fb) {
    JPanel questionPanel = new JPanel();
    questionPanel.setLayout(new GridBagLayout());
    questionPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));

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

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

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

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

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

    return questionPanel;
  }
  /**
   * Adds contact entry labels.
   *
   * @param nameLabelGridWidth the grid width of the contact entry name label
   */
  private void addLabels(int nameLabelGridWidth) {
    remove(nameLabel);
    remove(rightLabel);
    remove(displayDetailsLabel);

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

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

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

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

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

      this.add(displayDetailsLabel, constraints);
    }
  }
Пример #16
0
 /**
  * Adds a numeric field. The first word of the label must be unique or command recording will not
  * work.
  *
  * @param label the label
  * @param defaultValue value to be initially displayed
  * @param digits number of digits to right of decimal point
  * @param columns width of field in characters
  * @param units a string displayed to the right of the field
  */
 public void addNumericField(
     String label, double defaultValue, int digits, int columns, String units) {
   String label2 = label;
   if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' ');
   Label theLabel = makeLabel(label2);
   c.gridx = 0;
   c.gridy = y;
   c.anchor = GridBagConstraints.EAST;
   c.gridwidth = 1;
   if (firstNumericField) c.insets = getInsets(5, 0, 3, 0);
   else c.insets = getInsets(0, 0, 3, 0);
   grid.setConstraints(theLabel, c);
   add(theLabel);
   if (numberField == null) {
     numberField = new Vector(5);
     defaultValues = new Vector(5);
     defaultText = new Vector(5);
   }
   if (IJ.isWindows()) columns -= 2;
   if (columns < 1) columns = 1;
   String defaultString = IJ.d2s(defaultValue, digits);
   if (Double.isNaN(defaultValue)) defaultString = "";
   TextField tf = new TextField(defaultString, columns);
   if (IJ.isLinux()) tf.setBackground(Color.white);
   tf.addActionListener(this);
   tf.addTextListener(this);
   tf.addFocusListener(this);
   tf.addKeyListener(this);
   numberField.addElement(tf);
   defaultValues.addElement(new Double(defaultValue));
   defaultText.addElement(tf.getText());
   c.gridx = 1;
   c.gridy = y;
   c.anchor = GridBagConstraints.WEST;
   tf.setEditable(true);
   // if (firstNumericField) tf.selectAll();
   firstNumericField = false;
   if (units == null || units.equals("")) {
     grid.setConstraints(tf, c);
     add(tf);
   } else {
     Panel panel = new Panel();
     panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
     panel.add(tf);
     panel.add(new Label(" " + units));
     grid.setConstraints(panel, c);
     add(panel);
   }
   if (Recorder.record || macro) saveLabel(tf, label);
   y++;
 }
Пример #17
0
  private JPanel getPredicatePanel() {

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

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

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

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

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

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

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

    panel.add(inputVariableLabel, gbc);

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

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

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

    panel.add(getXQueryEditor(), gbc);

    return panel;
  }
  private JPanel initRelationPanel() {
    JPanel res = new JPanel();
    res.setBorder(new LineBorder(Color.DARK_GRAY));
    res.setLayout(new GridBagLayout());
    GridBagConstraints c = null;

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 3;
    c.weightx = 0.5;
    res.add(new JLabel(LABEL_RELATION_PANEL), c);

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 3, 0, 0);
    res.add(this.addRelationButton, c);

    c = new GridBagConstraints();
    c.gridx = 1;
    c.weightx = 0.5;
    c.gridy = 1;
    res.add(this.addGeneralizationButton, c);

    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_END;
    c.insets = new Insets(0, 0, 0, 3);
    res.add(this.addRealisationButton, c);

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 2;
    c.insets = new Insets(0, 3, 0, 0);
    c.anchor = GridBagConstraints.LINE_START;
    res.add(this.addCompositionButton, c);

    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 2;
    c.insets = new Insets(0, 0, 0, 3);
    c.anchor = GridBagConstraints.LINE_END;
    res.add(this.addAgregationButton, c);

    return res;
  }
Пример #19
0
  // Initializing this component.
  private void jbInit() {
    callStackTable.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            callStackTable_focusGained(e);
          }

          public void focusLost(FocusEvent e) {
            callStackTable_focusLost(e);
          }
        });
    callStackTable.setTableHeader(null);
    callStackTable.setDefaultRenderer(callStackTable.getColumnClass(0), getCellRenderer());
    scrollPane = new JScrollPane(callStackTable);
    setVisibleRows(DEFAULT_VISIBLE_ROWS);
    scrollPane.setLocation(0, 27);
    setBorder(BorderFactory.createEtchedBorder());
    // this.setLayout(null);
    this.setLayout(new GridBagLayout());
    nameLbl.setText("Call Stack");
    nameLbl.setBounds(new Rectangle(3, 4, 70, 23));
    nameLbl.setFont(Utilities.labelsFont);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 7;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.PAGE_END;
    c.gridx = 0;
    c.gridy = 2;
    this.add(scrollPane, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0.0;
    c.gridwidth = 3;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(5, 0, 0, 0);
    this.add(nameLbl, c);
  }
Пример #20
0
  protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints constr;

    // list label
    constr = new GridBagConstraints();
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 0, 5);
    panel.add(new JLabel(IdeBundle.message("label.macros")), constr);

    // macros list
    constr = new GridBagConstraints();
    constr.gridy = 1;
    constr.weightx = 1;
    constr.weighty = 1;
    constr.insets = new Insets(0, 5, 0, 5);
    constr.fill = GridBagConstraints.BOTH;
    constr.anchor = GridBagConstraints.WEST;
    panel.add(new JScrollPane(myMacrosList), constr);
    myMacrosList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    myMacrosList.setPreferredSize(null);

    // preview label
    constr = new GridBagConstraints();
    constr.gridx = 0;
    constr.gridy = 2;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 0, 5);
    panel.add(new JLabel(IdeBundle.message("label.macro.preview")), constr);

    // preview
    constr = new GridBagConstraints();
    constr.gridx = 0;
    constr.gridy = 3;
    constr.weightx = 1;
    constr.weighty = 1;
    constr.fill = GridBagConstraints.BOTH;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(0, 5, 5, 5);
    panel.add(new JScrollPane(myPreviewTextarea), constr);
    myPreviewTextarea.setEditable(false);
    myPreviewTextarea.setLineWrap(true);
    myPreviewTextarea.setPreferredSize(null);

    panel.setPreferredSize(new Dimension(400, 500));

    return panel;
  }
Пример #21
0
        {
          setLayout(new GridBagLayout()); // Elrendezés beállítása
          GridBagConstraints c = new GridBagConstraints(); // Szükséges konstans

          c.insets = new Insets(5, 5, 5, 5 - btSettings.getPreferredSize().width + 5); // Margó 5x5
          c.gridwidth = 1;
          c.weightx = 1;

          c.anchor = GridBagConstraints.LINE_START;
          add(btSettings, c); // A "Kapcsolatbeállítások" gomb hozzáadása

          c.weightx = Integer.MAX_VALUE;
          c.anchor = GridBagConstraints.CENTER;
          add(btLogin, c); // A "Bejelentkezés" gomb hozzáadása
        }
Пример #22
0
  public WelcomePane(String bannerMessage, ActionListener mainFrameActionListener) {

    this.setLayout(new GridBagLayout());
    GridBagConstraints bc = new GridBagConstraints();

    // adding bannerJLable to the WelcomePane
    JLabel bannerJLabel;
    bannerJLabel = new JLabel(bannerMessage);

    bc.gridy = 0;
    bc.gridx = 0;

    bc.gridwidth = 2;
    bc.weightx = 2;
    bc.weighty = 2;
    bc.anchor = GridBagConstraints.CENTER;
    this.add(bannerJLabel, bc);
    // ///////////////////////////////////////////////

    // adding signInButton to WelcomePane
    signInButton = new JButton("Sign-In");
    signInButton.setEnabled(false);
    signInButton.setPreferredSize(new Dimension(200, 50));

    bc.gridy = 1;
    bc.gridx = 0;

    bc.gridwidth = 1;
    bc.anchor = GridBagConstraints.CENTER;
    this.add(signInButton, bc);
    // ///////////////////////////////////////////////

    // adding orderAsGuestButton to WelcomePane
    orderAsGuestButton = new JButton("Order As Guest");
    orderAsGuestButton.setPreferredSize(new Dimension(200, 50));

    bc.gridy = 1;
    bc.gridx = 1;

    bc.gridwidth = 1;
    bc.weighty = 1;
    bc.anchor = GridBagConstraints.CENTER;
    this.add(orderAsGuestButton, bc);
    // ///////////////////////////////////////////////

    /// sets the actionListener to the MainFrame which implements ActionListener
    orderAsGuestButton.addActionListener(mainFrameActionListener);
  } // ends WelcomePane Constructor
  protected JComponent createNorthPanel() {
    class MyTextField extends JTextField {
      public MyTextField() {
        super("");
      }

      public Dimension getPreferredSize() {
        Dimension d = super.getPreferredSize();
        return new Dimension(200, d.height);
      }
    }

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

    gbConstraints.insets = new Insets(4, 0, 8, 8);
    gbConstraints.fill = GridBagConstraints.VERTICAL;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 1;
    gbConstraints.anchor = GridBagConstraints.EAST;
    JLabel label = new JLabel(IdeBundle.message("editbox.line.number"));
    panel.add(label, gbConstraints);

    gbConstraints.fill = GridBagConstraints.BOTH;
    gbConstraints.weightx = 1;
    myField = new MyTextField();
    panel.add(myField, gbConstraints);
    myField.setToolTipText(IdeBundle.message("tooltip.syntax.linenumber.columnnumber"));
    LogicalPosition position = myEditor.getCaretModel().getLogicalPosition();
    myField.setText(String.format("%d:%d", position.line + 1, position.column + 1));

    if (isInternal()) {
      gbConstraints.gridy = 1;
      gbConstraints.weightx = 0;
      gbConstraints.weighty = 1;
      gbConstraints.anchor = GridBagConstraints.EAST;
      final JLabel offsetLabel = new JLabel("Offset:");
      panel.add(offsetLabel, gbConstraints);

      gbConstraints.fill = GridBagConstraints.BOTH;
      gbConstraints.weightx = 1;
      myOffsetField = new MyTextField();
      panel.add(myOffsetField, gbConstraints);
      myOffsetField.setToolTipText(String.valueOf(myEditor.getCaretModel().getOffset()));
    }

    return panel;
  }
Пример #24
0
 public static void addComponent(
     Container container,
     Component component,
     int gridx,
     int gridy,
     int gridwidth,
     int gridheight,
     int fill,
     int anchor)
     throws AWTException {
   LayoutManager lm = container.getLayout();
   if (!(lm instanceof GridBagLayout)) {
     throw new AWTException("Invalid layout" + lm);
   } else {
     GridBagConstraints gbc = new GridBagConstraints();
     gbc.gridx = gridx;
     gbc.gridy = gridy;
     gbc.gridwidth = gridwidth;
     gbc.gridheight = gridheight;
     gbc.fill = fill;
     gbc.anchor = anchor;
     ((GridBagLayout) lm).setConstraints(component, gbc);
     container.add(component);
   }
 }
Пример #25
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);
  }
  private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) {
    lastAddedButton = button;

    constraints.insets = new Insets(0, 0, V_GAP, 0);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = gridX;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    this.add(button, constraints);

    int yBounds =
        TOP_BORDER
            + BOTTOM_BORDER
            + 2 * V_GAP
            + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height
            + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText())
                .height;

    button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT);

    button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    setButtonBg(button, gridX, isLast);

    return button.getWidth();
  }
Пример #27
0
 /**
  * Adds a radio button group.
  *
  * @param label group label (or null)
  * @param items radio button labels
  * @param rows number of rows
  * @param columns number of columns
  * @param defaultItem button initially selected
  */
 public void addRadioButtonGroup(
     String label, String[] items, int rows, int columns, String defaultItem) {
   Panel panel = new Panel();
   int n = items.length;
   panel.setLayout(new GridLayout(rows, columns, 0, 0));
   CheckboxGroup cg = new CheckboxGroup();
   for (int i = 0; i < n; i++) {
     Checkbox cb = new Checkbox(items[i], cg, items[i].equals(defaultItem));
     cb.addItemListener(this);
     panel.add(cb);
   }
   if (radioButtonGroups == null) radioButtonGroups = new Vector();
   radioButtonGroups.addElement(cg);
   Insets insets = getInsets(5, 10, 0, 0);
   if (label == null || label.equals("")) {
     label = "rbg" + radioButtonGroups.size();
     insets.top += 5;
   } else {
     setInsets(10, insets.left, 0);
     addMessage(label);
     insets.top = 2;
     insets.left += 10;
   }
   c.gridx = 0;
   c.gridy = y;
   c.gridwidth = 2;
   c.anchor = GridBagConstraints.WEST;
   c.insets = new Insets(insets.top, insets.left, 0, 0);
   grid.setConstraints(panel, c);
   add(panel);
   if (Recorder.record || macro) saveLabel(cg, label);
   y++;
 }
Пример #28
0
 public static void addComponent(
     Container container,
     Component component,
     int gridx,
     int gridy,
     int gridwidth,
     int gridheight,
     int fill,
     int anchor,
     Insets insets,
     int ipadx,
     int ipady,
     double weightx,
     double weighty) {
   java.awt.LayoutManager lm = container.getLayout();
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbc.gridwidth = gridwidth;
   gbc.gridheight = gridheight;
   gbc.fill = fill;
   gbc.anchor = anchor;
   gbc.insets = insets;
   gbc.ipadx = ipadx;
   gbc.ipady = ipady;
   gbc.weightx = weightx;
   gbc.weighty = weighty;
   ((GridBagLayout) lm).setConstraints(component, gbc);
   container.add(component);
 }
Пример #29
0
  private void createLayout() {
    mViewDocButton.setHorizontalAlignment(SwingConstants.LEFT);
    mViewDocButton.setEnabled(false);
    mLinksScrollPane.getViewport().add(mLinksList);
    setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.insets = GUIConstants.INSETS;
    constraints.gridwidth = 1;

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

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridheight = 1;
    constraints.gridx = 1;
    add(mViewDocButton, constraints);
  }
  public BaseGoogleLoginUI(@NotNull String signinText) {
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT));
    setOpaque(false);

    JLabel googleIcon = new JBLabel();

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

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