Example #1
0
  public TextoSenha() {
    super(
        "User e Password"); // Ao chamada a classe Frame passa a String como parametro e gera o
                            // titulo da mesma
    setLayout(new FlowLayout()); // Os objetos se alinham conforma são inseridos

    campoTexto1 = new JTextField(10); // 10 colunas como campo
    add(campoTexto1);

    campoTexto2 = new JTextField("Entra com o texto aqui:");
    add(campoTexto2);

    campoTexto3 = new JTextField("Edição cortada", 21); // texto padrão e 21 colunas
    campoTexto3.setSize(200, 200);
    campoTexto3.setEditable(false); // Corta edição
    add(campoTexto3);

    campoSenha = new JPasswordField("texto escondido"); // constroi com texto padrão
    add(campoSenha);

    // handlers de eventos regustradores
    TextFieldHandler handler = new TextFieldHandler();
    campoTexto1.addActionListener(handler);
    campoTexto2.addActionListener(handler);
    campoTexto3.addActionListener(handler);
    campoSenha.addActionListener(handler);
  }
  public void getParamsForScript() {
    scriptTextArea = new JTextArea();
    scriptScrollPane = new JScrollPane();
    JPanel scriptTextPane = new JPanel();
    scriptTextPane.add(scriptScrollPane);

    xStartLabel = new JLabel("Start Value");
    xStartField = new JTextField(String.valueOf(xStart));
    xStartField.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              xStart = Double.valueOf(xStartField.getText());
            } catch (NumberFormatException nfe) {
              System.out.println("Number format exception for xStart value");
              nfe.printStackTrace();
            }
          }
        });

    xEndLabel = new JLabel("End Value");
    xEndField = new JTextField(String.valueOf(xEnd));
    xEndField.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              xEnd = Double.valueOf(xEndField.getText());
            } catch (NumberFormatException nfe) {
              System.out.println("Number format exception for xEnd value");
              nfe.printStackTrace();
            }
          }
        });

    JButton proceedButton = new JButton("Proceed to script ");
    proceedButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            xStart = Double.valueOf(xStartField.getText());
            xEnd = Double.valueOf(xEndField.getText());
            scriptCodeGenerationFrame.makescalaSciCodeFromParams(ODEWizardScalaSci.ODESolveMethod);
          };
        });

    JPanel startParamsPanel = new JPanel(new GridLayout(1, 2));
    startParamsPanel.add(xStartLabel);
    startParamsPanel.add(xStartField);
    JPanel endParamsPanel = new JPanel(new GridLayout(1, 2));
    endParamsPanel.add(xEndLabel);
    endParamsPanel.add(xEndField);
    JPanel proceedPanel = new JPanel();
    proceedPanel.add(proceedButton);
    setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
    add(startParamsPanel);
    add(endParamsPanel);
    add(proceedPanel);
    setLocation(100, 100);
    pack();
    setVisible(true);
  }
Example #3
0
  public LoginFrame() {
    super("Kullanıcı Giriş Ekranı");
    setLayout(new FlowLayout(FlowLayout.LEFT));

    kullaniciAdi = new JLabel("Kullanıcı Adı");
    kullaniciAdi.setFont(new Font("Dialog", Font.BOLD, 15));
    add(kullaniciAdi);

    txt1 = new JTextField(10);
    add(txt1);
    txt1.addActionListener(this);

    sifre = new JLabel("Åžifre");
    sifre.setFont(new Font("Dialog", Font.BOLD, 15));
    add(sifre);

    txt2 = new JTextField(10);
    add(txt2);
    txt2.addActionListener(this);

    giris = new JButton("GiriÅŸ");
    add(giris);
    giris.addActionListener(this);

    pack();
  }
  public void conectarCtl(CtlCargarVendedor c) {
    // TODO Auto-generated method stub

    // tglbtnEfectivo.addActionListener(c);
    // tglbtnEfectivo.addItemListener(c);
    txtEfectivo.addActionListener(c);
    txtEfectivo.addKeyListener(c);

    txtEfectivo.setActionCommand("BUSCAR");

    tglbtnEfectivo.addKeyListener(c);

    btnCerrar.addActionListener(c);
    btnCerrar.setActionCommand("CERRAR");
    this.btnCerrar.addKeyListener(c);

    btnCobrar.addActionListener(c);
    btnCobrar.setActionCommand("COBRAR");
    this.btnCobrar.addKeyListener(c);
    this.addWindowListener(c);

    txtCambio.addActionListener(c);
    txtCambio.addKeyListener(c);
    txtCambio.setActionCommand("IMPRIMIR");
  }
  private JPanel createArchiveSearchFieldSubPanel() {

    FormLayout fl =
        new FormLayout(
            "pref,2dlu,pref:grow,5dlu,pref,2dlu,pref,5dlu,pref,2dlu,pref,5dlu,pref,2dlu,120px,5dlu,pref",
            "pref,2dlu,pref");
    JPanel searchPanel = new JPanel(fl);

    startDatePicker.getMonthView().setAntialiased(true);
    startDatePicker.getMonthView().setBoxPaddingX(1);
    startDatePicker.getMonthView().setBoxPaddingY(1);
    startDatePicker.getMonthView().setSelectionMode(JXMonthView.SelectionMode.SINGLE_SELECTION);
    startDatePicker.getEditor().setValue(null);
    startDatePicker.setLinkPanel(null);
    endDatePicker.getMonthView().setAntialiased(true);
    endDatePicker.getMonthView().setBoxPaddingX(1);
    endDatePicker.getMonthView().setBoxPaddingY(1);
    endDatePicker.getMonthView().setSelectionMode(JXMonthView.SelectionMode.SINGLE_SELECTION);
    endDatePicker.getEditor().setValue(null);
    endDatePicker.setLinkPanel(null);

    searchButton.setActionCommand("search");
    searchButton.addActionListener(this);
    clearFieldButton.setActionCommand("clear");
    clearFieldButton.addActionListener(this);

    CellConstraints cc = new CellConstraints();
    searchPanel.add(patientNameLabel, cc.xy(1, 1));
    searchPanel.add(patientNameField, cc.xy(3, 1));
    searchPanel.add(descriptionLabel, cc.xy(5, 1));
    searchPanel.add(descriptionField, cc.xywh(7, 1, 5, 1));
    searchPanel.add(startDateLabel, cc.xy(13, 1));
    searchPanel.add(startDatePicker, cc.xy(15, 1));
    searchPanel.add(clearFieldButton, cc.xy(17, 1));
    searchPanel.add(patientIDLabel, cc.xy(1, 3));
    searchPanel.add(patientIDField, cc.xy(3, 3));
    searchPanel.add(modalityLabel, cc.xy(5, 3));
    searchPanel.add(modalityField, cc.xy(7, 3));
    searchPanel.add(anatomyLabel, cc.xy(9, 3));
    searchPanel.add(anatomyField, cc.xy(11, 3));
    searchPanel.add(endDateLabel, cc.xy(13, 3));
    searchPanel.add(endDatePicker, cc.xy(15, 3));
    searchPanel.add(searchButton, cc.xy(17, 3));

    patientIDField.setActionCommand("search");
    patientIDField.addActionListener(this);
    patientNameField.setActionCommand("search");
    patientNameField.addActionListener(this);
    descriptionField.setActionCommand("search");
    descriptionField.addActionListener(this);
    modalityField.setActionCommand("search");
    modalityField.addActionListener(this);
    anatomyField.setActionCommand("search");
    anatomyField.addActionListener(this);

    return searchPanel;
  }
  /**
   * Create the pixel location panel
   *
   * @param labelFont the font for the labels
   * @return the location panel
   */
  public JPanel createLocationPanel(Font labelFont) {

    // create a location panel
    JPanel locationPanel = new JPanel();
    locationPanel.setLayout(new FlowLayout());
    Box hBox = Box.createHorizontalBox();

    // create the labels
    rowLabel = new JLabel("Row:");
    colLabel = new JLabel("Column:");

    // create the text fields
    colValue = new JTextField(Integer.toString(colIndex + numberBase), 6);
    colValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });
    rowValue = new JTextField(Integer.toString(rowIndex + numberBase), 6);
    rowValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });

    // set up the next and previous buttons
    setUpNextAndPreviousButtons();

    // set up the font for the labels
    colLabel.setFont(labelFont);
    rowLabel.setFont(labelFont);
    colValue.setFont(labelFont);
    rowValue.setFont(labelFont);

    // add the items to the vertical box and the box to the panel
    hBox.add(Box.createHorizontalGlue());
    hBox.add(rowLabel);
    hBox.add(rowPrevButton);
    hBox.add(rowValue);
    hBox.add(rowNextButton);
    hBox.add(Box.createHorizontalStrut(10));
    hBox.add(colLabel);
    hBox.add(colPrevButton);
    hBox.add(colValue);
    hBox.add(colNextButton);
    locationPanel.add(hBox);
    hBox.add(Box.createHorizontalGlue());

    return locationPanel;
  }
Example #7
0
  /*
  Post: sets up all the options visually
  */
  public Options() {

    valuesArray = new ArrayList<Integer>();
    populateRandomArray();

    // size of the array
    enterSize = new JLabel("Array size:");
    arraySizeEntry = new JTextField("", 3);
    arraySizeEntry.addActionListener(this);
    arraySizeEntry.getDocument().addDocumentListener(new DocListener());

    // algorithm on top
    topAlgo = new JLabel("Top:");
    String[] topAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"};
    chooseTopAlgo = new JComboBox(topAlgos);
    chooseTopAlgo.addActionListener(this);

    // algorithm on bottom
    bottomAlgo = new JLabel("Bottom:");
    String[] bottomAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"};
    chooseBottomAlgo = new JComboBox(bottomAlgos);
    chooseBottomAlgo.addActionListener(this);

    // average case or worst case
    caseLabel = new JLabel("Choose case:");
    String[] cases = {"Average Case", "Worst Case"};
    chooseCase = new JComboBox(cases);
    chooseCase.addActionListener(this);

    // delay of comparisons in the visualizer
    enterSpeed = new JLabel("Delay:");
    speedEntry = new JTextField("10", 2);
    speedEntry.addActionListener(this);
    speedEntry.getDocument().addDocumentListener(this);

    // run button (runs the visualizer)
    run = new JButton("Run");
    run.addActionListener(this);
    // adding everything to the panel
    add(enterSize);
    add(arraySizeEntry);
    add(topAlgo);
    add(chooseTopAlgo);
    add(bottomAlgo);
    add(chooseBottomAlgo);
    add(caseLabel);
    add(chooseCase);
    add(enterSpeed);
    add(speedEntry);
    add(run);
  }
  /**
   * This method places all the components onto the panel.
   *
   * @param panel (a {@link JPanel} giving the the panel where to place components)
   */
  private void placeComponents(JPanel panel) {

    panel.removeAll();
    panel.setLayout(null);
    Font fontTitre = new Font("Courier", Font.BOLD, 20);

    //	Adding Labels
    JLabel addUserTitle = new JLabel();
    addUserTitle.setBounds(250, 30, 300, 100);
    addUserTitle.setFont(fontTitre);
    addUserTitle.setText("<html>Add a User</html>");
    panel.add(addUserTitle);

    // Adding Buttons
    returnUsersButton.addActionListener(this);
    panel.add(returnUsersButton);

    validateAddUserButton.addActionListener(this);
    panel.add(validateAddUserButton);

    // Adding Text Fields
    addUserNickname.addActionListener(this);
    addUserNickname.setBounds(250, 100, 200, 25);
    panel.add(addUserNickname);

    addUserPassword.addActionListener(this);
    addUserPassword.setBounds(250, 140, 200, 25);
    panel.add(addUserPassword);

    addUserEMail.addActionListener(this);
    addUserEMail.setBounds(250, 180, 200, 25);
    panel.add(addUserEMail);

    // Adding Roles List
    addUserRole.addItem("Simple User");
    addUserRole.addItem("Seller");
    addUserRole.addItem("Admin");
    addUserRole.setSelectedIndex(0);
    addUserRole.addActionListener(this);
    addUserRole.setBounds(250, 220, 200, 25);
    panel.add(addUserRole);

    // Adding Logo
    JLabel image = new JLabel(new ImageIcon("logo.png"));
    JPanel panelLogo = new JPanel();
    panelLogo.setBounds(5, 5, 150, 150);
    panelLogo.setLayout(new BorderLayout());
    panelLogo.add(image, BorderLayout.CENTER);
    panel.add(panelLogo);
  }
Example #9
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 #10
0
  public Mapper() {
    super("Action/Input Mapper");
    setSize(500, 600);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JPanel setupPane = new JPanel(new GridLayout(0, 1));
    JPanel classPane = new JPanel(new BorderLayout());
    classPane.add(new JLabel("Class: "), BorderLayout.WEST);
    classPane.add(nameF, BorderLayout.CENTER);
    classPane.add(stateC, BorderLayout.EAST);
    JPanel mapPane = new JPanel();
    mapPane.add(inputB);
    mapPane.add(actionB);
    mapPane.add(bindingB);

    setupPane.add(classPane);
    setupPane.add(mapPane);

    getContentPane().add(setupPane, BorderLayout.NORTH);
    getContentPane().add(new JScrollPane(results), BorderLayout.CENTER);

    nameF.addActionListener(this);
    stateC.addActionListener(this);
    stateC.setEditable(false);
    new Probe().loadAudioActions(); // !!!
    setVisible(true);
  }
Example #11
0
  private JPanel initServerChoice() {

    JPanel p = new JPanel();
    p.setLayout(new GridLayout(6, 1, 5, 2));
    p.add(new JLabel("Search At: "));

    chosenServer.setText(server.getHost().getHostName());
    p.add(chosenServer);
    chosenServer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            try {
              InetAddress newHost = InetAddress.getByName(chosenServer.getText());
              Whois newServer = new Whois(newHost);
              server = newServer;
            } catch (Exception e) {
              // should use an error dialog here, but that
              // doesn't teach much about networking
              chosenServer.setText(server.getHost().getHostName());
            }
          }
        });

    return p;
  }
Example #12
0
    /**
     * Create a panel containing an entry box and a button.
     *
     * @param owner The owner query.
     * @param name The name of the query.
     * @param parameter The parameter containing parameters.
     * @param widget The widget to use to edit the parameter.
     */
    public HierarchicalConfigurer(Query owner, String name, Settable parameter, Component widget) {
      super(BoxLayout.X_AXIS);
      _owner = owner;
      _parameter = parameter;
      JButton button = new JButton("Configure");
      button.addActionListener(this);
      add(widget);
      add(button);

      // Add the listener last so that there is no notification
      // of the first value.
      if (widget instanceof JTextField) {
        ((JTextField) widget).addActionListener(new QueryActionListener(_owner, name));

        // Add a listener for loss of focus.  When the entry gains
        // and then loses focus, listeners are notified of an update,
        // but only if the value has changed since the last notification.
        // FIXME: Unfortunately, Java calls this listener some random
        // time after the window has been closed.  It is not even a
        // a queued event when the window is closed.  Thus, we have
        // a subtle bug where if you enter a value in a line, do not
        // hit return, and then click on the X to close the window,
        // the value is restored to the original, and then sometime
        // later, the focus is lost and the entered value becomes
        // the value of the parameter.  I don't know of any workaround.
        ((JTextField) widget).addFocusListener(new QueryFocusListener(_owner, name));
      }
    }
  public Controls(EPGSwingEngine swingEngine) {
    _playButton = (JToggleButton) swingEngine.find("PLAY_BUTTON");
    _playButton.addActionListener(this);

    _allNotesOffButton = (JButton) swingEngine.find("ALL_NOTES_OFF_BUTTON");
    _allNotesOffButton.addActionListener(this);

    _tempoSlider = (JSlider) swingEngine.find("TEMPO_SLIDER");
    _tempoSlider.addChangeListener(this);

    _tempoInput = (JFormattedTextField) swingEngine.find("TEMPO_INPUT");
    _tempoInput.setPreferredSize(new Dimension(60, _tempoInput.getPreferredSize().height));
    _tempoInput.addActionListener(this);

    _midiOutBox = (JComboBox) swingEngine.find("MIDI_OUT_BOX");
    _midiOutBox.addActionListener(this);

    _midiCheckBox = (JCheckBox) swingEngine.find("MIDI_CHECKBOX");
    _midiCheckBox.addActionListener(this);

    _oscTextField = (JTextField) swingEngine.find("OSC_TEXTFIELD");
    _oscTextField.addActionListener(this);

    _oscCheckBox = (JCheckBox) swingEngine.find("OSC_CHECKBOX");
    _oscCheckBox.addActionListener(this);
  }
Example #14
0
  /** Adds listeners to the UI components. */
  private void initListeners() {
    user.getDocument().addDocumentListener(this);
    pass.getDocument().addDocumentListener(this);
    login.addActionListener(this);
    user.addActionListener(this);
    pass.addActionListener(this);
    cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            quit();
          }
        });
    configButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            config();
          }
        });
    encryptionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            encrypt();
          }
        };
    encryptedButton.addActionListener(encryptionListener);
    addWindowListener(
        new WindowAdapter() {
          public void windowOpened(WindowEvent e) {
            requestFocusOnField();
          }
        });
    user.addMouseListener(
        new MouseAdapter() {

          /**
           * Fires a property to move the window to the front.
           *
           * @see MouseListener#mouseClicked(MouseEvent)
           */
          public void mouseClicked(MouseEvent e) {
            firePropertyChange(TO_FRONT_PROPERTY, Boolean.valueOf(false), Boolean.valueOf(true));
            user.requestFocus();
            // if (user.getText() != null)
            //	user.selectAll();
          }
        });
    pass.addMouseListener(
        new MouseAdapter() {

          /**
           * Fires a property to move the window to the front.
           *
           * @see MouseListener#mouseClicked(MouseEvent)
           */
          public void mouseClicked(MouseEvent e) {
            firePropertyChange(TO_FRONT_PROPERTY, Boolean.valueOf(false), Boolean.valueOf(true));
            // requestFocusOnField();
          }
        });
  }
Example #15
0
  /* Oppretter kontroll-vinduet, og GUI-elementer og timer.
  Database og Selgervindu kobles internt i klassen. */
  public KontrollVindu(String title, Database reg, SelgerVindu Svindu) {
    aktivkortreg = reg.getAktive();
    vindu = Svindu;
    open = vindu.getSelgerMetoder().getOpen();

    info = new JTextArea(6, 10);
    info.setEditable(false);
    info.setFont(new Font("Serif", Font.ROMAN_BASELINE, 20));
    kortid = new JTextField(15);
    kortid.addActionListener(this);
    sjekk = new JButton("Kontroller");
    sjekk.addActionListener(this);

    BorderLayout layout = new BorderLayout(5, 5);
    setLayout(layout);

    add(info, BorderLayout.PAGE_START);
    add(kortid, BorderLayout.CENTER);
    add(sjekk, BorderLayout.PAGE_END);

    setSize(300, 300);
    setVisible(true);

    timer = new Timer();
    wait = false;

    setOpen(open);

    resetFocus();
  }
Example #16
0
  private void buildGui() {
    myListener = new MainFrameListener(this);

    JPanel pan = new JPanel();

    frame.setSize(500, 650);

    JScrollPane scroll =
        new JScrollPane(
            txtChatList,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    txtChatList.setEditable(false);
    txtChatList.setVisible(true);
    txtChatList.setLineWrap(true);
    ((DefaultCaret) txtChatList.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    frame.getContentPane().add(scroll);

    pan.add(txtInptChat);
    pan.add(btnSubmit, BorderLayout.SOUTH);

    frame.getContentPane().add(pan, BorderLayout.SOUTH);

    frame.setVisible(true);

    btnSubmit.addActionListener(myListener);
    btnSubmit.setActionCommand("submit");

    txtInptChat.setActionCommand("submit");
    txtInptChat.addActionListener(myListener);
  }
Example #17
0
  /**
   * this is the gui initialization method
   *
   * @param width - the main window width
   * @param height - the main window height
   */
  private void showClientGui(int width, int height) {
    int rows = 2;
    int cols = 2;

    JPanel panel = new JPanel();
    JButton send = new JButton("send");
    JButton disconnect = new JButton("disconnect");

    _textField = new JTextField();
    _textField.setMaximumSize(new Dimension(400, 40));
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    _frame = new JFrame("Chat client");
    _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    _frame.setSize(width, height);
    _textArea = new JTextArea("", rows, cols);
    _textArea.setLineWrap(true);
    panel.add(_textArea);
    panel.add(_textField);
    panel.add(send);
    panel.add(disconnect);

    _frame.add(panel);
    _frame.setVisible(true);
    SendMessageListener smlisten = new SendMessageListener();
    send.addActionListener(smlisten);
    _textField.addActionListener(smlisten);
    disconnect.addActionListener(new disconnectButtonListener());
  }
Example #18
0
  protected JPanel getMainPanel() {
    JPanel panel = new JPanel();
    String cols = "5dlu, fill:pref:grow, 5dlu, fill:pref:grow, 5dlu";
    String rows = "5dlu, pref, 5dlu, pref, 5dlu";

    FormLayout layout = new FormLayout(cols, rows);
    panel.setLayout(layout);
    CellConstraints cc = new CellConstraints();

    panel.add(new JLabel("Weight for edge:"), cc.xy(2, 2));

    String text = edge.getWS();

    tf = new JTextField(text);
    tf.addActionListener(this);
    panel.add(tf, cc.xy(4, 2));

    jcbAnchored.addActionListener(this);
    jcbAnchored.setSelected(edge.isFixed());
    if (!Configuration.getInstance().getGeneralConfig().getUnAnchor()) {
      panel.add(jcbAnchored, cc.xyw(2, 4, 3));
    }

    return panel;
  }
  public startServer() {
    this.setSize(getPreferredSize());
    portNumber = new JTextField("");
    getContentPane().add(portNumber);
    portNumber.addActionListener(new portListener());

    typePort = new JLabel("-Please Type a Telnet Port Below-");
    getContentPane().add(typePort);

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(typePort, GroupLayout.Alignment.CENTER)
            .addComponent(portNumber, GroupLayout.Alignment.CENTER));

    layout.setVerticalGroup(
        layout.createSequentialGroup().addComponent(typePort).addComponent(portNumber));
    setSize(getPreferredSize());

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  }
Example #20
0
 public InputFrame(SipModel sipModel) {
   super(Which.INPUT, sipModel, "Input");
   sipModel.addParseListener(
       new SipModel.ParseListener() {
         @Override
         public void updatedRecord(MetadataRecord metadataRecord) {
           exec(new RecordSetter(metadataRecord));
         }
       });
   recordTree =
       new JTree(EMPTY_MODEL) {
         @Override
         public String getToolTipText(MouseEvent evt) {
           TreePath treePath = recordTree.getPathForLocation(evt.getX(), evt.getY());
           return treePath != null
               ? ((GroovyTreeNode) treePath.getLastPathComponent()).toolTip
               : "";
         }
       };
   recordTree.setToolTipText("Input Record");
   recordTree.setCellRenderer(new Renderer());
   recordTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
   recordTree.setTransferHandler(new TreeTransferHandler());
   filterField.addActionListener(rewind);
 }
Example #21
0
    private ControlSlider(
        String labelText,
        String unitText,
        int minVal,
        int maxVal,
        int defaultVal,
        JPanel myParent) {
      JPanel sliderPanel = new JPanel();
      slider = new JSlider(JSlider.HORIZONTAL);
      field = new JTextField();
      sliderPanel.add(new JLabel(labelText));

      //			int maxFeedrate = (int)machine.getModel().getMaximumFeedrates().axis(axis);
      //			int currentFeedrate = Math.min(maxFeedrate, Base.preferences.getInt(getPrefName(),480));
      slider.setMinimum(minVal);
      slider.setMaximum(maxVal);
      slider.setValue(defaultVal);
      slider.addChangeListener(this);
      slider.setPaintLabels(true);
      slider.setPaintTicks(true);
      slider.setMajorTickSpacing(100);
      sliderPanel.add(slider, "growx");
      field.setMinimumSize(new Dimension(75, 22));
      field.setEnabled(true);
      field.setText(Integer.toString(defaultVal));
      field.addFocusListener(this);
      field.addActionListener(this);
      sliderPanel.add(field, "growx,wrap");
      sliderPanel.add(new JLabel(unitText), "growx,wrap");

      myParent.add(sliderPanel, "wrap");
    }
Example #22
0
  private void initialize() {
    dialogListener = new FindPluginListener();
    tableResults =
        new JTable(
            new DefaultTableModel(
                new String[] {"Plugin Name", "Author", "Date", "Description", "Access"},
                TABLE_ROW_COUNT));
    tableResults.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    tableResults.getColumnModel().getColumn(4).setCellRenderer(new TableRenderer());
    tableResults.getColumnModel().getColumn(0).setPreferredWidth(148);
    tableResults.getColumnModel().getColumn(3).setPreferredWidth(248);
    tableResults.getColumnModel().getColumn(4).setPreferredWidth(43);
    tableResults.getSelectionModel().addListSelectionListener(dialogListener);

    fieldKeywords = new JTextField(35);
    fieldKeywords.setActionCommand("FIND");
    fieldKeywords.addActionListener(dialogListener);

    areaComments = new JTextArea(10, 20);
    areaComments.setEditable(false);

    areaKeywords = new JTextArea(10, 20);
    areaKeywords.setEditable(false);

    labelName = new JLabel("Name:");
    labelCategory = new JLabel("Category:");

    pluginHits = new HashMap<Integer, File>();
  }
Example #23
0
  /**
   * Constructs the client by laying out the GUI and registering a listener with the textfield so
   * that pressing Return in the listener sends the textfield contents to the server. Note however
   * that the textfield is initially NOT editable, and only becomes editable AFTER the client
   * receives the NAMEACCEPTED message from the server.
   */
  public ChatClient(String i) {

    ip = i;
    name =
        ("Hawk"
            + ((int) (Math.random() * 10000)
                + (int) (Math.random() * 1000)
                + (int) Math.random() * 100
                + (int) Math.random() * 10));
    // Layout GUI
    textField.setEditable(false);
    messageArea.setEditable(false);
    frame.getContentPane().add(textField, "South");
    textField.setSize(1, 10);
    frame.getContentPane().add(new JScrollPane(messageArea), "Center");
    frame.pack();

    // Add Listeners
    textField.addActionListener(
        new ActionListener() {
          /**
           * Responds to pressing the enter key in the textfield by sending the contents of the text
           * field to the server. Then clear the text area in preparation for the next message.
           */
          public void actionPerformed(ActionEvent e) {
            out.println(textField.getText());
            textField.setText("");
          }
        });
  }
  private void initComponents() {
    jfxPanel = new JFXPanel();

    createScene();

    ActionListener al =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            loadURL(txtURL.getText());
          }
        };

    btnGo.addActionListener(al);
    txtURL.addActionListener(al);

    progressBar.setPreferredSize(new Dimension(150, 18));
    progressBar.setStringPainted(true);

    JPanel topBar = new JPanel(new BorderLayout(5, 0));
    topBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
    topBar.add(txtURL, BorderLayout.CENTER);
    topBar.add(btnGo, BorderLayout.EAST);

    JPanel statusBar = new JPanel(new BorderLayout(5, 0));
    statusBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
    statusBar.add(lblStatus, BorderLayout.CENTER);
    statusBar.add(progressBar, BorderLayout.EAST);

    panel.add(topBar, BorderLayout.NORTH);
    panel.add(jfxPanel, BorderLayout.CENTER);
    panel.add(statusBar, BorderLayout.SOUTH);

    frame.getContentPane().add(panel);
  }
Example #25
0
  public FloatCellEditor() {
    super();

    setComponent(panel, textfield);

    textfield.addActionListener(
        new java.awt.event.ActionListener() {
          @Override
          public void actionPerformed(java.awt.event.ActionEvent e) {
            finalizeEdit(false);
          }
        });

    button.setMargin(new Insets(0, 3, 0, 3));

    button.addActionListener(
        new java.awt.event.ActionListener() {
          @Override
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (getProperty() != null) {
              getProperty().onButtonClicked(button);
              textfield.setText(String.valueOf(getProperty().getValue()));
            }
          }
        });

    panel.add(textfield, BorderLayout.CENTER);
    panel.add(button, BorderLayout.EAST);
  }
Example #26
0
  public void addNode(final Node node) {
    final JTextField field = new JTextField(3);
    field.setText(node.getId());
    field.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            node.setId(field.getText());
          }
        });

    JPanel container = new JPanel(new FlowLayout());
    JButton deleteButton = new JButton("X");
    deleteButton.setFocusable(false);
    deleteButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            Main.getCurrentNetwork().deleteNode(node);
          }
        });

    container.add(field);
    container.add(deleteButton);

    panel.add(container);
  }
  public void buildPanel() {
    input.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (input.getText().isEmpty() == false) {
              outputLabel.setText("");
              outputLabel.append(sumNumbers(input.getText()));
              outputLabel.setEditable(false);
            }
          }
        });

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    JLabel header = new JLabel("Sum of all digits");
    JPanel headerFrame = new JPanel();
    headerFrame.add(header);
    mainPanel.add(headerFrame, BorderLayout.NORTH);

    inputPanel.add(inputLabel);
    inputPanel.add(input);
    mainPanel.add(inputPanel, BorderLayout.CENTER);

    outputPanel.add(outputLabel);
    mainPanel.add(outputPanel, BorderLayout.SOUTH);

    topPanel.add(mainPanel);
  }
Example #28
0
  /**
   * Instantiates a new help search panel.
   *
   * @param root the root
   * @param dialog the dialog
   */
  public HelpSearchPanel(HelpIndexRoot root, HelpDialog dialog) {
    this.root = root;
    this.dialog = dialog;

    setLayout(new BorderLayout());

    JPanel queryPanel = new JPanel();
    queryPanel.setLayout(new BorderLayout());
    queryPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    queryField = new JTextField();
    queryField.setActionCommand(MenuUtils.SEARCH_BUTTON);
    queryField.addActionListener(this);
    queryPanel.add(queryField, BorderLayout.CENTER);
    searchButton = new JButton(MenuUtils.SEARCH_BUTTON);
    searchButton.setActionCommand(MenuUtils.SEARCH_BUTTON);
    searchButton.addActionListener(this);
    queryPanel.add(searchButton, BorderLayout.EAST);
    add(queryPanel, BorderLayout.NORTH);

    listModel = new DefaultListModel();
    listModel.addElement("[No search results]");
    resultList = new JList(listModel);
    resultList.addListSelectionListener(this);
    resultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    resultsScrollPane = new JScrollPane(resultList);
    add(resultsScrollPane, BorderLayout.CENTER);
  }
Example #29
0
  public static void main(String[] args) {
    final Browser browser = new Browser();
    BrowserView browserView = new BrowserView(browser);

    final JTextField addressBar = new JTextField("http://www.teamdev.com/jxbrowser");
    addressBar.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            browser.loadURL(addressBar.getText());
          }
        });

    JPanel addressPane = new JPanel(new BorderLayout());
    addressPane.add(new JLabel(" URL: "), BorderLayout.WEST);
    addressPane.add(addressBar, BorderLayout.CENTER);

    JFrame frame = new JFrame("JxBrowser - Hello World");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.add(addressPane, BorderLayout.NORTH);
    frame.add(browserView, BorderLayout.CENTER);
    frame.setSize(800, 500);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    browser.loadURL(addressBar.getText());
  }
Example #30
0
 /**
  * Constructs a new ChatChannelFrame as a wrapper around the given channel.
  *
  * @param client the parent {@code ChatClient} of this frame.
  * @param channel the channel that this class will manage.
  */
 public ChatChannelFrame(ChatClient client, ClientChannel channel) {
   super("Channel: " + channel.getName());
   myChatClient = client;
   myChannel = channel;
   Container c = getContentPane();
   c.setLayout(new BorderLayout());
   JPanel eastPanel = new JPanel();
   eastPanel.setLayout(new BorderLayout());
   c.add(eastPanel, BorderLayout.EAST);
   eastPanel.add(new JLabel("Users"), BorderLayout.NORTH);
   memberList = new MemberList();
   memberList.addMouseListener(myChatClient.getDCCMouseListener());
   eastPanel.add(new JScrollPane(memberList), BorderLayout.CENTER);
   JPanel southPanel = new JPanel();
   c.add(southPanel, BorderLayout.SOUTH);
   southPanel.setLayout(new GridLayout(1, 0));
   inputField = new JTextField();
   southPanel.add(inputField);
   outputArea = new JTextArea();
   c.add(new JScrollPane(outputArea), BorderLayout.CENTER);
   inputField.addActionListener(this);
   setSize(400, 400);
   setClosable(true);
   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   addInternalFrameListener(new FrameClosingListener(this));
   setResizable(true);
   setVisible(true);
 }