Example #1
0
  public void initFields() {
    add = new JButton("Adauga admin");
    add.addActionListener(this);

    nume = new JTextField();
    nume.setPreferredSize(new Dimension(200, 30));
    prenume = new JTextField();
    prenume.setPreferredSize(new Dimension(200, 30));
    parola = new JTextField();
    parola.setPreferredSize(new Dimension(200, 30));
    nume_util = new JTextField();
    nume_util.setPreferredSize(new Dimension(200, 30));

    lbl1 = new JLabel("Nume Utilizator: ");
    lbl1.setOpaque(true);
    lbl1.setBorder(new EtchedBorder());

    lbl2 = new JLabel("Nume: ");
    lbl2.setOpaque(true);
    lbl2.setBorder(new EtchedBorder());

    lbl3 = new JLabel("Prenume: ");
    lbl3.setOpaque(true);
    lbl3.setBorder(new EtchedBorder());

    lbl4 = new JLabel("Parola: ");
    lbl4.setOpaque(true);
    lbl4.setBorder(new EtchedBorder());

    lbl1.setPreferredSize(new Dimension(120, 30));
    lbl2.setPreferredSize(new Dimension(120, 30));
    lbl3.setPreferredSize(new Dimension(120, 30));
    lbl4.setPreferredSize(new Dimension(120, 30));
  }
  public CalcPanel() {
    setPreferredSize(new Dimension(250, 105));
    lblNbr1.setPreferredSize(new Dimension(100, 20));
    lblNbr1.setFont(fontLabels);
    add(lblNbr1);

    tfNbr1.setPreferredSize(new Dimension(100, 20));
    add(tfNbr1);

    lblNbr2.setPreferredSize(new Dimension(100, 20));
    lblNbr2.setFont(fontLabels);
    add(lblNbr2);

    tfNbr2.setPreferredSize(new Dimension(100, 20));
    add(tfNbr2);

    btnAdd.setPreferredSize(new Dimension(100, 20));
    btnAdd.setFont(fontButtons);
    add(btnAdd);

    btnSubtract.setPreferredSize(new Dimension(100, 20));
    btnSubtract.setFont(fontButtons);
    add(btnSubtract);

    lblResult.setPreferredSize(new Dimension(200, 20));
    lblResult.setFont(fontLabels);
    add(lblResult);

    btnAdd.addActionListener(this);
    btnSubtract.addActionListener(this);
  }
  private void refreshContents(String environment) {
    MDFClientConfigRepository repository =
        MDFClientConfigurator.getInstance().getConfigRepository();

    MDFClientEnvConfigRepository envConfig = repository.getConfig(environment);

    textTcpAddress.setText(envConfig.getTcpInfo().getEndPointInfo().getDisplayable());
    userName.setPreferredSize(fieldSize);
    password.setPreferredSize(fieldSize);
    userName.setText(envConfig.getTcpInfo().getUserName());
    password.setText(envConfig.getTcpInfo().getPassword());

    /*
    String networkInterface=repository.getMDFClientRuntimeParameters().getMulticastNetworkInterface();

    if(networkInterface!=null)
    {
    	textMulticastNetworkInterface.setText(networkInterface);
    }
    else
    {
    	textMulticastNetworkInterface.setText("<default>");
    }

    textSequenceProblemAction.setText(repository.getMDFClientRuntimeParameters().getSequenceProblemAction().getAction());
    textMulticastInactivityThreshold.setText(Integer.toString(repository.getMDFClientRuntimeParameters().getMulticastInactivityThreshold()));
    */

    return;
  }
  private void buildPointPanels() {
    deleteBtns.clear();
    latTexts.clear();
    lngTexts.clear();
    points = layer.getPositions();
    if (pointPanels.size() != 0) {
      for (JPanel p : pointPanels) {
        this.remove(p);
      }
    }
    pointPanels.clear();

    if (points.size() > 1) {

      for (int i = 0; i < points.size(); i++) {
        JPanel panel = new JPanel();
        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
        Position p = points.get(i);
        final int index = i;
        JLabel label = new JLabel("点" + i + ":");
        label.setPreferredSize(labelDimension);
        panel.add(label);
        JTextField lngTextField = new JTextField();
        lngTextField.setText(p.getLongitude().getDegrees() + "");
        lngTextField.setPreferredSize(smallComponentDimension);
        panel.add(lngTextField);
        lngTexts.add(lngTextField);
        JTextField latTextField = new JTextField();
        latTextField.setText(p.getLatitude().getDegrees() + "");
        latTextField.setPreferredSize(smallComponentDimension);
        panel.add(latTextField);
        latTexts.add(latTextField);
        JButton deleteBtn = new JButton();
        deleteBtn.setText("删除");
        deleteBtn.setPreferredSize(deleteComponentDimension);
        ActionListener deleteListener =
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent event) {
                if (deleteBtns.size() > 2) {
                  deleteBtns.remove(index);
                  points.remove(index);
                  refreshPointsPanel();
                  layer.refresh();
                  if (deleteBtns.size() <= 2) {
                    for (JButton btn : deleteBtns) {
                      btn.setEnabled(false);
                    }
                  }
                }
              }
            };
        deleteBtn.addActionListener(deleteListener);
        deleteBtns.add(deleteBtn);
        panel.add(deleteBtn);
        pointPanels.add(panel);
        this.add(panel, pointPanels.size() + 1);
      }
    }
  }
  /**
   * Makes the control panel to show while in batch mode.
   *
   * @return Panel with batch controls.
   */
  public static JPanel makeBatchControlsPanel() {

    JPanel jLine1Controls = new JPanel(new FlowLayout(FlowLayout.LEFT));

    // Bins boxes
    JLabel jTemp = new JLabel("Number of bins:");
    jTemp.setFont(new sortie.gui.components.SortieFont());
    jLine1Controls.add(jTemp);

    JTextField jNumBins = new JTextField(String.valueOf(NUMBER_BINS_DEFAULT));
    jNumBins.setFont(new SortieFont());
    jNumBins.setPreferredSize(
        new java.awt.Dimension(50, (int) jNumBins.getPreferredSize().getHeight()));
    jNumBins.setName(NUMBER_BINS_NAME);
    jLine1Controls.add(jNumBins);

    jTemp = new JLabel("Bin size:");
    jTemp.setFont(new sortie.gui.components.SortieFont());
    jLine1Controls.add(jTemp);
    JTextField jBinSize = new JTextField(String.valueOf(BIN_SIZE_DEFAULT));
    jBinSize.setFont(new SortieFont());
    jBinSize.setPreferredSize(
        new java.awt.Dimension(50, (int) jBinSize.getPreferredSize().getHeight()));
    jBinSize.setName(BIN_SIZE_NAME);
    jLine1Controls.add(jBinSize);

    return jLine1Controls;
  }
  /** Builds the Network panel. */
  protected JPanel buildNetworkPanel() {
    JGridBagPanel p = new JGridBagPanel();
    p.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16));

    JLabel proxyLabel = new JLabel(Resources.getString(PREFERENCE_KEY_LABEL_HTTP_PROXY));
    JLabel hostLabel = new JLabel(Resources.getString(PREFERENCE_KEY_LABEL_HOST));
    JLabel portLabel = new JLabel(Resources.getString(PREFERENCE_KEY_LABEL_PORT));
    JLabel colonLabel = new JLabel(Resources.getString(PREFERENCE_KEY_LABEL_COLON));
    Font f = hostLabel.getFont();
    float size = f.getSize2D() * 0.85f;
    f = f.deriveFont(size);
    hostLabel.setFont(f);
    portLabel.setFont(f);
    host = new JTextField();
    host.setPreferredSize(new Dimension(200, 20));
    port = new JTextField();
    port.setPreferredSize(new Dimension(40, 20));

    p.add(proxyLabel, 0, 0, 1, 1, EAST, NONE, 0, 0);
    p.add(host, 1, 0, 1, 1, WEST, HORIZONTAL, 0, 0);
    p.add(colonLabel, 2, 0, 1, 1, WEST, NONE, 0, 0);
    p.add(port, 3, 0, 1, 1, WEST, HORIZONTAL, 0, 0);
    p.add(hostLabel, 1, 1, 1, 1, WEST, NONE, 0, 0);
    p.add(portLabel, 3, 1, 1, 1, WEST, NONE, 0, 0);

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

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

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

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

    // =============== BEGIN EDIT melville ===============
    m_PrecTex.setPreferredSize(COMBO_SIZE);
    m_PrecTex.setMaximumSize(COMBO_SIZE);
    m_PrecTex.setMinimumSize(COMBO_SIZE);
    // =============== END EDIT melville ===============
  }
  public MyGUIProgram() {
    super("Swing app");
    setSize(400, 300);
    setResizable(true);

    fileLocationField.setPreferredSize(new Dimension(150, 20));
    p.add(fileLocationField);
    p.add(fileLocationLabel);

    phoneNumberField.setPreferredSize(new Dimension(150, 20));
    p.add(phoneNumberField);
    p.add(phoneNumberLabel);

    operationField.setPreferredSize(new Dimension(150, 20));
    p.add(operationField);
    p.add(operationLabel);

    b.addActionListener(new MyActionListner(this));
    p.add(b);

    output.setEditable(false);
    p.add(output);

    add(p);

    setVisible(true);
  }
  protected void setSizes() {

    l_name.setPreferredSize(textSize);
    name.setPreferredSize(textSize);
    l_numeroVal.setPreferredSize(numSize);
    l_numeroNum.setPreferredSize(numSize);
    numeroVal.setPreferredSize(numSize);
    numeroNum.setPreferredSize(numSize);
  }
  public CommercialModel(JFrame mFrame) {
    mainFrame = mFrame;
    // Set the FlowLayout and the Dimensions for panels
    pnlName.setPreferredSize(new Dimension(450, 50));
    pnlName.setLayout(new FlowLayout());
    pnlAddress.setPreferredSize(new Dimension(450, 50));
    pnlAddress.setLayout(new FlowLayout());
    pnlContactPerson.setPreferredSize(new Dimension(450, 50));
    pnlContactPerson.setLayout(new FlowLayout());
    pnlContactPersonPhone.setPreferredSize(new Dimension(450, 50));
    pnlContactPersonPhone.setLayout(new FlowLayout());

    // Add buttons and labels to panels
    lblContactPersonPhone.setPreferredSize(new Dimension(450, 20));
    lblContactPersonPhone.setHorizontalAlignment(JLabel.CENTER);
    txtContactPersonPhone.setPreferredSize(new Dimension(250, 20));
    pnlContactPersonPhone.add(lblContactPersonPhone);
    pnlContactPersonPhone.add(txtContactPersonPhone);
    // Home
    lblContactPerson.setPreferredSize(new Dimension(450, 20));
    lblContactPerson.setHorizontalAlignment(JLabel.CENTER);
    txtContactPerson.setPreferredSize(new Dimension(250, 20));
    pnlContactPerson.add(lblContactPerson);
    pnlContactPerson.add(txtContactPerson);
    // Address
    lblAddress.setPreferredSize(new Dimension(450, 20));
    lblAddress.setHorizontalAlignment(JLabel.CENTER);
    txtAddress.setPreferredSize(new Dimension(250, 20));
    pnlAddress.add(lblAddress);
    pnlAddress.add(txtAddress);
    // Name
    lblName.setPreferredSize(new Dimension(450, 20));
    lblName.setHorizontalAlignment(JLabel.CENTER);
    txtName.setPreferredSize(new Dimension(250, 20));
    pnlName.add(lblName);
    pnlName.add(txtName);
    // Buttons
    btnAddCommercial.setPreferredSize(new Dimension(200, 30));
    btnCancel.setPreferredSize(new Dimension(200, 30));
    pnlButtons.add(btnAddCommercial);
    pnlButtons.add(btnCancel);

    // Container framePane = frame.getContentPane();
    CommercialModelWrapper.setLayout(new FlowLayout());
    CommercialModelWrapper.add(pnlButtons, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlContactPersonPhone, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlContactPerson, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlAddress, FlowLayout.LEFT);
    CommercialModelWrapper.add(pnlName, FlowLayout.LEFT);
    // Add the event handler to the button
    btnCancel.addActionListener(new btnCancel_Handler(mainFrame));
    btnAddCommercial.addActionListener(
        new CommercialModel_btnAddNew_Handler(
            mainFrame, txtName, txtAddress, txtContactPerson, txtContactPersonPhone));
  }
  /** Initialisiert die Komponenten. */
  private void initComponents() {

    setBorder(border);

    phone.setMinimumSize(new Dimension(120, 20));
    phone.setPreferredSize(new Dimension(120, 20));

    fax.setMinimumSize(new Dimension(120, 20));
    fax.setPreferredSize(new Dimension(120, 20));

    email.setMinimumSize(new Dimension(120, 20));
    email.setPreferredSize(new Dimension(120, 20));
  }
Example #12
0
  /** Initialise l'interface graphique */
  public void initDialog() {
    content = new JPanel();

    namepanel = new JPanel();
    namepanel.setBorder(BorderFactory.createTitledBorder("Nom du Flux"));
    name = new JTextField();
    name.setPreferredSize(new Dimension(300, 20));
    name.setMaximumSize(new Dimension(300, 20));
    name.setMinimumSize(new Dimension(200, 20));
    namepanel.add(name);

    urlpanel = new JPanel();
    urlpanel.setBorder(BorderFactory.createTitledBorder("URL du Flux"));
    url = new JTextField();
    url.setPreferredSize(new Dimension(300, 20));
    url.setMaximumSize(new Dimension(300, 20));
    url.setMinimumSize(new Dimension(200, 20));
    urlpanel.add(url);

    categorypanel = new JPanel();
    categorypanel.setBorder(BorderFactory.createTitledBorder("Categories"));
    categorypanel.setPreferredSize(new Dimension(300, 70));
    category = new JComboBox();
    category.addItem(listeCategories.get(0));
    newCategory = new JButton("Nouvelle Categorie");
    newCategory.setActionCommand("NewCatAddSource");
    categorypanel.add(category);
    categorypanel.add(newCategory);

    content.add(namepanel, BorderLayout.NORTH);
    content.add(urlpanel, BorderLayout.WEST);
    content.add(categorypanel, BorderLayout.EAST);

    control = new JPanel();

    okbutton = new JButton("OK");
    okbutton.setActionCommand("OkAddSource");

    cancel = new JButton("Annuler");
    cancel.setActionCommand("CancelAddSource");

    defaultbutton = new JButton("Reinitialiser");
    defaultbutton.setActionCommand("RenewAddSource");

    control.add(okbutton);
    control.add(cancel);
    control.add(defaultbutton);

    this.getContentPane().add(content, BorderLayout.CENTER);
    this.getContentPane().add(control, BorderLayout.SOUTH);
  }
Example #13
0
 /**
  * This method initializes jTextField
  *
  * @return javax.swing.JTextField
  */
 private JTextField getM_txtMax1() {
   if (m_txtMax1 == null) {
     m_txtMax1 = new JTextField();
     m_txtMax1.setPreferredSize(new java.awt.Dimension(100, 20));
   }
   return m_txtMax1;
 }
  private void createUserSpecifiedCollisionsBoxes() {
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    final JTextField objectTypeName = new JTextField();
    buttonPanel.add(objectTypeName);
    objectTypeName.setPreferredSize(OBJECT_TYPE_DIMENSION);
    objectTypeName.setMaximumSize(OBJECT_TYPE_DIMENSION);
    JButton addObjectTypeButton = new JButton(ADD_OBJECT_TYPE_BUTTON);
    addObjectTypeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            String st = objectTypeName.getText().replaceAll("\\s", "_");

            myCollisionIDMap.put(st, myCollisionIDMap.size());
            recreateObjectPanel();
            validate();

            objectTypeName.setText("");
          }
        });
    addObjectTypeButton.setFocusable(false);
    buttonPanel.add(addObjectTypeButton);

    homePanel.add(buttonPanel);
  }
Example #15
0
 /**
  * This method initializes regFileTextField
  *
  * @return javax.swing.JTextField
  */
 private JTextField getRegFileTextField() {
   if (regFileTextField == null) {
     regFileTextField = new JTextField();
     regFileTextField.setPreferredSize(new Dimension(220, 22));
   }
   return regFileTextField;
 }
Example #16
0
  private JPanel panelOpciones() {
    jlb_buscar = new JLabel("Buscar");
    jtf_buscar = new JTextField();
    jbtn_buscar = new JButton();
    jbtn_agregar = new JButton();

    jbtn_buscar.setIcon(iconos.getIcono(Iconos.ICON_BUSCAR));
    jbtn_agregar.setIcon(iconos.getIcono(Iconos.ICON_AGREGAR));

    jlb_buscar.setPreferredSize(new Dimension(50, 27));
    jtf_buscar.setPreferredSize(new Dimension(150, 27));
    jbtn_buscar.setPreferredSize(new Dimension(40, 27));
    jbtn_agregar.setPreferredSize(new Dimension(40, 27));

    JPanel pnlOpciones = new JPanel(new FlowLayout(FlowLayout.LEFT));
    pnlOpciones.setBorder(BorderFactory.createTitledBorder("Opciones"));
    pnlOpciones.setPreferredSize(new Dimension(-1, 60));

    pnlOpciones.add(jlb_buscar);
    pnlOpciones.add(jtf_buscar);
    pnlOpciones.add(jbtn_buscar);
    pnlOpciones.add(jbtn_agregar);

    return pnlOpciones;
  }
Example #17
0
  public Console() {
    super("Javacalculus Test GUI");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    System.setOut(new PrintStream(new consoleOutputStream()));
    // System.setErr(new PrintStream(new consoleOutputStream(true)));
    inputLabel.setLabelFor(input);
    input.setPreferredSize(new Dimension(300, 20));
    input.setBorder(BorderFactory.createLoweredBevelBorder());
    input.addKeyListener(this);
    commandHistory.add("");
    execute.addActionListener(this);
    execute.setBackground(Color.GREEN);
    execute.setForeground(Color.WHITE);
    console.setLineWrap(true);
    console.setWrapStyleWord(true);
    console.setEditable(false);
    console.setFont(new Font("Dialog", Font.BOLD, 14));
    JScrollPane consolePane =
        new JScrollPane(
            console,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    consolePane.setPreferredSize(new Dimension(600, 300));
    consolePane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		error.setLineWrap(true);
    //		error.setWrapStyleWord(true);
    //		error.setEditable(false);
    //    	error.setFont(new Font("Dialog", Font.ITALIC, 12));
    //		JScrollPane errorPane = new JScrollPane(error, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    //				JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    //		errorPane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		errorPane.setPreferredSize(new Dimension(600,300));
    // content.setPreferredSize(new Dimension(400,400));
    content.setLayout(new GridBagLayout());
    content.setBorder(BorderFactory.createLoweredBevelBorder());
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    content.add(inputLabel, c);
    c.gridx = 1;
    c.gridy = 0;
    content.add(input, c);
    c.gridx = 2;
    c.gridy = 0;
    content.add(execute, c);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 3;
    content.add(consolePane, c);
    //		c.gridx = 0; c.gridy = 2;
    //		content.add(errorPane, c);
    add(content);

    pack();
    setVisible(true);
    input.requestFocus();
  }
Example #18
0
 /**
  * This method initializes logFileTextField
  *
  * @return javax.swing.JTextField
  */
 private JTextField getLogFileTextField() {
   if (logFileTextField == null) {
     logFileTextField = new JTextField();
     logFileTextField.setPreferredSize(new Dimension(220, 22));
   }
   return logFileTextField;
 }
Example #19
0
 /**
  * JBuilder自动生成的初始化界面方法
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   jPanel1.setLayout(borderLayout1);
   jPanel3.setPreferredSize(new Dimension(10, 30));
   jPanel4.setPreferredSize(new Dimension(30, 10));
   jPanel5.setPreferredSize(new Dimension(30, 10));
   jPanel6.setPreferredSize(new Dimension(10, 30));
   jPanel2.setLayout(verticalFlowLayout1);
   MoneyDuom.setBackground(Color.white);
   MoneyDuom.setFont(new java.awt.Font("Dialog", 0, 16));
   MoneyDuom.setPreferredSize(new Dimension(100, 30));
   MoneyDuom.setEditable(true);
   MoneyDuom.setText("");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
   jLabel1.setPreferredSize(new Dimension(70, 23));
   jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
   jLabel1.setText("金  额:");
   this.getContentPane().add(jPanel1, BorderLayout.CENTER);
   jPanel1.add(jPanel2, BorderLayout.CENTER);
   jPanel2.add(jPanel8, null);
   jPanel8.add(jLabel1, null);
   jPanel8.add(MoneyDuom, null);
   jPanel2.add(jPanel7, null);
   jPanel1.add(jPanel3, BorderLayout.SOUTH);
   jPanel1.add(jPanel4, BorderLayout.WEST);
   jPanel1.add(jPanel5, BorderLayout.EAST);
   jPanel1.add(jPanel6, BorderLayout.NORTH);
 }
Example #20
0
  public void widgetLayout() {
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    this.add(new JLabel(this.p.getDisplayName()));

    final PropertyWidget th = this;

    control = new JTextField();
    String startText = "" + ((PDouble) th.p.getValue()).doubleValue();
    control.setText(startText);
    control.setMaximumSize(new Dimension(70, 20));
    control.setPreferredSize(new Dimension(70, 20));

    readOnlyControl = new JLabel();

    readOnlyControl.setText(startText);
    // readOnlyControl.setMaximumSize(new Dimension(200,20));

    control.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            th.propertyUpdated(new PDouble(Double.parseDouble(control.getText())));
          }
        });

    // this.add(Box.createRigidArea(new Dimension(5,1)));
    this.add(Box.createHorizontalGlue());
    this.add(control);

    setPropertyReadOnly(p.getReadOnly());
  }
Example #21
0
  /**
   * This method initializes tFichero
   *
   * @return javax.swing.JTextField
   */
  private JTextField getTxtName() {
    if (txtName == null) {
      txtName = new JTextField();
      txtName.setBounds(62, 8, 280, 20);
      txtName.setPreferredSize(new java.awt.Dimension(270, 20));
      txtName.setText(name);
      txtName.addKeyListener(
          new KeyListener() {

            public void keyPressed(KeyEvent e) {
              if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                acceptAction();
              } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                cancelAction();
              }
            }

            public void keyReleased(KeyEvent e) {
              // TODO Auto-generated method stub

            }

            public void keyTyped(KeyEvent e) {
              // TODO Auto-generated method stub

            }
          });
    }
    return txtName;
  }
  public StratumAttributePanel(DataColumnDefinition[] availableColumns) {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    columns = new JComboBox(availableColumns);
    // columns.setPreferredSize(new Dimension(columns.getPreferredSize().width, 20));
    conditions = new JComboBox(AtomicCondition.conds);
    // conditions.setPreferredSize(new Dimension(conditions.getPreferredSize().width, 20));
    value = new JTextField(10);
    value.setPreferredSize(new Dimension(150, 20));

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JLabel label = new JLabel("Column:");
    label.setPreferredSize(new Dimension(100, 20));
    panel.add(label);
    panel.add(columns);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    label = new JLabel("Condition:");
    label.setPreferredSize(new Dimension(100, 20));
    panel.add(label);
    panel.add(conditions);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    label = new JLabel("Value:");
    label.setPreferredSize(new Dimension(100, 20));
    panel.add(label);
    panel.add(value);
    add(panel);
  }
 private JTextField createColorField(boolean hex) {
   final NumberDocument doc = new NumberDocument(hex);
   int lafFix = UIUtil.isUnderWindowsLookAndFeel() || UIUtil.isUnderDarcula() ? 1 : 0;
   UIManager.LookAndFeelInfo info = LafManager.getInstance().getCurrentLookAndFeel();
   if (info != null
       && (info.getName().startsWith("IDEA") || info.getName().equals("Windows Classic")))
     lafFix = 1;
   final JTextField field;
   if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
     field = new JTextField("");
     field.setDocument(doc);
     field.setPreferredSize(new Dimension(hex ? 60 : 40, 26));
   } else {
     field = new JTextField(doc, "", (hex ? 5 : 2) + lafFix);
     field.setSize(50, -1);
   }
   doc.setSource(field);
   field.getDocument().addDocumentListener(this);
   field.addFocusListener(
       new FocusAdapter() {
         @Override
         public void focusGained(final FocusEvent e) {
           field.selectAll();
         }
       });
   return field;
 }
  /**
   * Creates a new NewStringPopupDialog object.
   *
   * @param parent DOCUMENT ME!
   * @param title DOCUMENT ME!
   */
  public NewStringPopupDialog(Frame parent, String title) {
    super(parent, true);
    setTitle(title);
    textField = new JTextField();
    textField.setPreferredSize(new Dimension(200, 25));
    theString = null;

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

    JPanel panel = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    panel.setLayout(gridbag);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    gridbag.setConstraints(textField, c);
    panel.add(textField);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    gridbag.setConstraints(okButton, c);
    panel.add(okButton);
    c.gridx = 1;
    c.gridy = 1;
    gridbag.setConstraints(cancelButton, c);
    panel.add(cancelButton);
    setContentPane(panel);
    pack();
    setLocationRelativeTo(parent);
    setVisible(true);
  }
Example #25
0
  /**
   * Sets the panel in which the GUI should be implemented Any standard swing components can be used
   *
   * @param panel The GUI panel
   */
  public void setPanel(JPanel panel) {
    this.panel = panel;

    panel.setLayout(new BorderLayout());

    JLabel label =
        new JLabel("Produces an effect similar to thermal erosion", (int) JLabel.CENTER_ALIGNMENT);
    panel.add(label, BorderLayout.PAGE_START);

    JPanel iterations = new JPanel();
    iterations.setLayout(new FlowLayout());

    label = new JLabel("Iterations ");
    iterations.add(label);
    sldIterations = new JSlider(1, 100, 1);
    sldIterations.addChangeListener(this);
    iterations.add(sldIterations);
    txtIterations = new JTextField(Integer.toString((int) sldIterations.getValue()));
    txtIterations.setEditable(false);
    txtIterations.setPreferredSize(new Dimension(35, 25));
    iterations.add(txtIterations);

    panel.add(iterations, BorderLayout.CENTER);

    btnApply = new JButton("Apply Thermal Erosion");
    btnApply.addActionListener(this);
    panel.add(btnApply, BorderLayout.PAGE_END);

    if (preview) parent.refreshMiniView(apply(preview));
  }
Example #26
0
 /**
  * Inicializa el TextField en el que se incluye el texto a buscar
  *
  * @return jTextField
  */
 public JTextField getSearchTextField() {
   if (searchTextField == null) {
     searchTextField = new JTextField();
     searchTextField.setPreferredSize(new Dimension(340, 20));
   }
   return searchTextField;
 }
  @Override
  public JFrame createWindow(JGamePanel gamePanel) {
    // Initialize layout components
    JPanel mainPanel = new JPanel();
    SpringLayout layout = new SpringLayout();
    mainPanel.setLayout(layout);

    // Initialize each component
    JFrame window = new JFrame();
    mainPanel.add(gamePanel);
    JTextArea logArea = new JTextArea();
    JScrollPane logScrollPane = new JScrollPane(logArea);
    logScrollPane.setPreferredSize(new Dimension(0, 0));
    mainPanel.add(logScrollPane);
    logArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    logArea.setEditable(false);
    JTextField commandField = new JTextField();
    commandField.setPreferredSize(new Dimension(0, 20));
    commandField.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    mainPanel.add(commandField);

    // Layout compo6nents
    layout.putConstraint(SpringLayout.NORTH, gamePanel, 0, SpringLayout.NORTH, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, logScrollPane, 0, SpringLayout.SOUTH, gamePanel);
    layout.putConstraint(SpringLayout.SOUTH, logScrollPane, 0, SpringLayout.NORTH, commandField);
    layout.putConstraint(SpringLayout.SOUTH, commandField, 0, SpringLayout.SOUTH, mainPanel);
    layout.putConstraint(SpringLayout.WEST, logScrollPane, 0, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.WEST, commandField, 0, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.EAST, logScrollPane, 0, SpringLayout.EAST, mainPanel);
    layout.putConstraint(SpringLayout.EAST, commandField, 0, SpringLayout.EAST, mainPanel);

    window.getContentPane().add(mainPanel);
    return window;
  }
Example #28
0
 @Override
 public void layoutView() {
   textField.setPreferredSize(
       new Dimension(UIConstants.widgetWidth(), UIConstants.maximumTextFieldHeight()));
   textField.setMaximumSize(
       new Dimension(UIConstants.widgetWidth(), UIConstants.maximumTextFieldHeight()));
 }
Example #29
0
  protected void addTextField(final String initValue) {
    final JPanel oneFieldRow = new JPanel();
    oneFieldRow.add(new JLabel("Rule " + (m_textFields.size() + 1) + ":"));
    oneFieldRow.setLayout(new BoxLayout(oneFieldRow, BoxLayout.X_AXIS));

    final JTextField newField = new JTextField(initValue);
    newField.setPreferredSize(new Dimension(70, 20));
    newField.setMaximumSize(new Dimension(70, 20));
    oneFieldRow.add(newField);

    final JButton removeButton = new JButton("-");
    removeButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(final ActionEvent e) {

            for (final Component p : removeButton.getParent().getComponents()) {

              if (p instanceof JTextField) {
                m_textFields.remove(p);
              }
            }
            m_textFieldsPanel.remove(removeButton.getParent());
            updateUI();
            doFilter();
          }
        });

    oneFieldRow.add(removeButton);
    m_textFields.add(newField);
    m_textFieldsPanel.add(oneFieldRow);

    updateUI();
  }
Example #30
0
 /**
  * This method initializes jTextField
  *
  * @return javax.swing.JTextField
  */
 private JTextField getJTextField() {
   if (jTextField == null) {
     jTextField = new JTextField();
     jTextField.setPreferredSize(new Dimension(40, 20));
     jTextField.addKeyListener(myAction);
   }
   return jTextField;
 }