Java 类javax.swing.JTextField 实例源码

项目:myster    文件:MessageManager.java   
public MessagePreferencesPanel() {
    setLayout(null);

    refuseMessages = new JCheckBox("Refuse Messages");
    refuseMessages.setSize(150, 25);
    refuseMessages.setLocation(10, 25);
    refuseMessages.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            updateEnabled();
        }
    });
    add(refuseMessages);

    denyMessageLabel = new JLabel("Refusal Message:");
    denyMessageLabel.setSize(150, 25);
    denyMessageLabel.setLocation(20, 50);
    add(denyMessageLabel);

    denyMessageText = new JTextField(REFUSAL_MESSAGE_DEFAULT);
    denyMessageText.setSize(400, 25);
    denyMessageText.setLocation(25, 75);
    add(denyMessageText);

    setSize(STD_XSIZE, STD_YSIZE);
}
项目:QN-ACTR-Release    文件:DistributionsEditor.java   
/**
 * Helper method to extract the probability components the dialog's components.
 * These components are the probability labels and the probability TextFields.
 * @return a Vector of probability related components
 * @author Federico Dal Castello
 */
private Vector<Component> getProbabilityComponents() {
    Vector<Component> probabilityComponents = new Vector<Component>();

    Vector<Component> components = new Vector<Component>();
    components.addAll(Arrays.asList(intervalPanels[1].getComponents()));
    components.addAll(Arrays.asList(intervalPanels[2].getComponents()));

    Iterator<Component> it = components.iterator();

    while (it.hasNext()) {
        Component comp = it.next();

        if (comp instanceof JTextField) {
            if (comp.getName().equals(PROBABILITY_INTERVAL_A) || comp.getName().equals(PROBABILITY_INTERVAL_B)) {
                probabilityComponents.add(comp);
            }
        }

        if (comp instanceof JLabel && ((JLabel) comp).getText().equals(PROBABILITY)) {
            probabilityComponents.add(comp);
        }
    }

    return probabilityComponents;
}
项目:AgentWorkbench    文件:TableCellEditor4Domains.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {

    Component editComponent = null;

    this.domainVector = ctsDialog.getDomainVector();
    this.domainName = (String) value;
    if (this.domainName!=null && this.domainName.equals(GeneralGraphSettings4MAS.DEFAULT_DOMAIN_SETTINGS_NAME)==true) {
        JLabel jLabel = new JLabel(this.domainName);
        editComponent = jLabel;

    } else {
        JTextField jTextField = new JTextField(this.domainName);
        jTextField.setBorder(BorderFactory.createEmptyBorder());
        jTextField.getDocument().addDocumentListener(this.getTextFieldDocumentListener());
        editComponent = jTextField;

    }
    return editComponent;
}
项目:DocIT    文件:DeptView.java   
public DeptView(Controller controller) {
    this.controller = controller;
    frame = new JFrame();
    namePanel = new JPanel(new GridLayout(1, 2, 0, 0));
    managerPanel = new JPanel(new GridLayout(1, 2, 66, 0));
    employeePanel = new JPanel(new GridLayout(1, 2, 30, 0));
    subDeptPanel = new JPanel(new GridLayout(1, 2, 20, 0));
    salaryPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 0));
    buttonPanel = new JPanel(new GridLayout(1, 3, 20, 0));
    subDeptLabel = new JLabel();
    salaryLabel = new JLabel();
    cutButton = new JButton();
    saveButton = new JButton();
    okButton = new JButton();
    cancelButton = new JButton();
    nameField = new JTextField();
    managerButton = new JButton();
    employeeListModel = new DefaultListModel();
    subDeptListModel = new DefaultListModel();
    employeeList = new JList(employeeListModel);
    subDeptList = new JList(subDeptListModel);
    init();
}
项目:jaer    文件:AbstractMultiBitRegisterCP.java   
private void setValueFromGUI(final JTextField tf) {
    final AbstractMultiBitRegisterCP embeddingCP = (AbstractMultiBitRegisterCP) tf.getParent();

    embeddingCP.startEdit();
    try {
        embeddingCP.reg.setPartialValue(componentID, Integer.parseInt(tf.getText()));
        embeddingCP.reg.setFileModified();
        tf.setBackground(Color.white);
    }
    catch (final Exception ex) {
        tf.selectAll();
        tf.setBackground(Color.red);
        log.warning(ex.toString());
    }
    finally {
        embeddingCP.endEdit();
    }
}
项目:GOLAD    文件:TimeLimit.java   
public void clickAction(){
    JTextField hours = new JTextField();
    JTextField minutes = new JTextField();
    JTextField seconds = new JTextField();
    Object[] message = {
        "Hours", hours,
        "Minutes", minutes,
        "Seconds",seconds
    };
    int option = JOptionPane.showConfirmDialog(null, message, "Time Limit", JOptionPane.OK_CANCEL_OPTION);
    if (option == JOptionPane.OK_OPTION) {
        try{
            w.setTimeLimit(Integer.parseInt(hours.getText()),
            Integer.parseInt(minutes.getText()),
            Integer.parseInt(seconds.getText()),0);
        }catch(Exception e){
            w.setTimeLimit(Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE);
        }
    }
}
项目:Community_Tieba-Data-Analyzer    文件:WebCrawler.java   
public void paintCrawler(JPanel _panel) {
        //Define all new Components GUI
        JPanel crawlerPanel = new JPanel();
        JPanel configPanel = new JPanel();
        JButton crawl = new JButton(" Crawl ");
        JTextField name = new JTextField(25);
        name.setText("userNameID");
        JButton random = new JButton("Random");

        //Add action Listener
        crawl.addActionListener(event -> crawlInfo(name.getText()));
//      random.addActionListener();

        //add to pane and manage layout
        _panel.add(configPanel, BorderLayout.CENTER);
        _panel.add(crawlerPanel, BorderLayout.SOUTH);
        crawlerPanel.add(crawl);
        configPanel.add(name);
        crawlerPanel.add(random);
    }
项目:https-github.com-apache-zookeeper    文件:ZooInspectorConnectionPropertiesDialog.java   
private void loadConnectionProps(Properties props) {
    if (props != null) {
        for (Object key : props.keySet()) {
            String propsKey = (String) key;
            if (components.containsKey(propsKey)) {
                JComponent component = components.get(propsKey);
                String value = props.getProperty(propsKey);
                if (component instanceof JTextField) {
                    ((JTextField) component).setText(value);
                } else if (component instanceof JComboBox) {
                    ((JComboBox) component).setSelectedItem(value);
                }
            }
        }
    }
}
项目:Cognizant-Intelligent-Test-Scripter    文件:TreeSearch.java   
private void createToolBar() {
    searchBar = new JToolBar();
    searchBar.setFloatable(false);
    searchBar.setLayout(new BoxLayout(searchBar, BoxLayout.X_AXIS));
    searchBar.setBorder(BorderFactory.createEtchedBorder());

    JLabel searchLabel = new JLabel(Utils.getIconByResourceName("/ui/resources/search"));

    searchField = new JTextField();
    searchField.setActionCommand("SearchField");
    searchField.addActionListener(this);

    searchBar.add(searchLabel);
    searchBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(5, 0),
            new java.awt.Dimension(5, 0),
            new java.awt.Dimension(5, 32767)));
    searchBar.add(searchField);

}
项目:openjdk-jdk10    文件:Test6505027.java   
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
项目:incubator-netbeans    文件:PropertyPanel.java   
/** Creates new form PropertyPanel */
public PropertyPanel(String propCat, boolean add, SessionFactory sessionFactory, String propName, String propValue) {
    initComponents();

    // The comb box only contains the property names that are not defined yet when adding
    if (add) {
        nameComboBox.setModel(new DefaultComboBoxModel(Util.getAvailPropNames(propCat, sessionFactory)));
    } else {
        nameComboBox.setModel(new DefaultComboBoxModel(Util.getAllPropNames(propCat)));
        nameComboBox.setSelectedItem(propName);
    }

    valueTextField = new JTextField();
    valueComboBox = new JComboBox();

    // Add the appropriate component for the value 
    String selectedPropName = (String) nameComboBox.getSelectedItem();
    addValueComponent(selectedPropName, propValue);

    nameComboBox.addActionListener((ActionListener) this);

    // Disable the name combo box for editing
    nameComboBox.setEnabled(add);
}
项目:incubator-netbeans    文件:NameAndLocationPanel.java   
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final HTMLIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);

    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }
}
项目:incubator-netbeans    文件:IDEValidation.java   
/** Test Options  
 * - open Options window from main menu Tools|Options
 * - select Editor category
 * - select Fonts & Colors category
 * - select Keymap category
 * - select General category
 * - pick Manual Proxy Setting
 * - set Proxy Host to emea-proxy.uk.oracle.com
 * - set Proxy Port to 80
 * - click OK to confirm and close Options window
 */
public void testOptions() {
    OptionsOperator optionsOper = OptionsOperator.invoke();
    optionsOper.selectEditor();
    optionsOper.selectFontAndColors();
    optionsOper.selectKeymap();
    optionsOper.selectGeneral();
    // "Manual Proxy Setting"
    String hTTPProxyLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Use_HTTP_Proxy");
    new JRadioButtonOperator(optionsOper, hTTPProxyLabel).push();
    // "HTTP Proxy:"
    String proxyHostLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Host");
    JLabelOperator jloHost = new JLabelOperator(optionsOper, proxyHostLabel);
    new JTextFieldOperator((JTextField) jloHost.getLabelFor()).setText("emea-proxy.uk.oracle.com"); // NOI18N
    // "Port:"
    String proxyPortLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Port");
    JLabelOperator jloPort = new JLabelOperator(optionsOper, proxyPortLabel);
    new JTextFieldOperator((JTextField) jloPort.getLabelFor()).setText("80"); // NOI18N
    optionsOper.ok();
}
项目:jdk8u-jdk    文件:Test6505027.java   
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
项目:incubator-netbeans    文件:GenericToolbar.java   
public Dimension getPreferredSize() {
    Dimension dim = super.getPreferredSize();
    if (PREFERRED_HEIGHT == -1) {
        GenericToolbar tb = new GenericToolbar();
        tb.setBorder(getBorder());
        tb.setBorderPainted(isBorderPainted());
        tb.setRollover(isRollover());
        tb.setFloatable(isFloatable());
        Icon icon = Icons.getIcon(GeneralIcons.SAVE);
        tb.add(new JButton("Button", icon)); // NOI18N
        tb.add(new JToggleButton("Button", icon)); // NOI18N
        tb.add(new JTextField("Text")); // NOI18N
        JComboBox c = new JComboBox();
        c.setEditor(new BasicComboBoxEditor());
        c.setRenderer(new BasicComboBoxRenderer());
        tb.add(c);
        tb.addSeparator();
        PREFERRED_HEIGHT = tb.getSuperPreferredSize().height;
    }
    dim.height = getParent() instanceof JToolBar ? 1 :
                 Math.max(dim.height, PREFERRED_HEIGHT);
    return dim;
}
项目:openjdk-jdk10    文件:DefaultButtonModelCrashTest.java   
private void go() {

        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container contentPane = frame.getContentPane();
        ButtonModel model = new DefaultButtonModel();

        JCheckBox check = new JCheckBox("a bit broken");
        check.setModel(model);
        panel = new JPanel(new BorderLayout());
        panel.add(new JTextField("Press Tab (twice?)"), BorderLayout.NORTH);
        panel.add(check);
        contentPane.add(panel);
        frame.setLocationRelativeTo(null);
        frame.pack();
        frame.setVisible(true);
    }
项目:xdman    文件:ConfigDialog.java   
Credential getCredential(String shost, String suser, String spass) {
    JTextField host = new JTextField(shost);
    JTextField user = new JTextField(suser);
    JPasswordField pass = new JPasswordField(spass);
    Object[] obj = new Object[6];
    obj[0] = getString("HOST");
    obj[1] = host;
    obj[2] = getString("USER_NAME");
    obj[3] = user;
    obj[4] = getString("PASSWORD");
    obj[5] = pass;

    while (JOptionPane.showOptionDialog(null, obj, getString("LBL_CR"),
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
            null, null, null) == JOptionPane.OK_OPTION) {
        if (host.getText() == null || host.getText().length() < 1) {
            JOptionPane.showMessageDialog(null, getString("LBL_HOST"));
            continue;
        }
        if (user.getText() == null || user.getText().length() < 1) {
            JOptionPane.showMessageDialog(null, getString("LBL_USER"));
            continue;
        }

        Credential c = new Credential();
        c.host = host.getText();
        c.user = user.getText();
        c.pass = pass.getPassword().length > 0 ? new String(pass
                .getPassword()) : null;
        return c;
    }
    return null;
}
项目:incubator-netbeans    文件:GUIRegistrationPanel.java   
private void setEditable(final JComboBox combo) {
    combo.setEditable(true);
    if (combo.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField) combo.getEditor().getEditorComponent();
        // XXX check if there are not multiple (--> redundant) listeners
        txt.getDocument().addDocumentListener(new UIUtil.DocumentAdapter() {
            public void insertUpdate(DocumentEvent e) {
                if (!UIUtil.isWaitModel(combo.getModel())) {
                    checkValidity();
                }
            }
        });
    }
}
项目:Community_Tieba-Data-Analyzer    文件:SetupDisplay.java   
private void generateSetupFile(JTextField t1, JTextField t2) throws UnknownHostException{
    if((t1.getText() != null) && (t2.getText() != null)){

        String str = createClientInfoString(t1, t2);

        byte[] ns = str.getBytes();
        byte[] ret = new byte[ns.length];
        for(int i = 0; i < ns.length; i++){
            ret[i] = (byte) (ns[i] + 4);
        }
        str = new String(ret);

        //String to File
        byte[] tempCharRead = str.getBytes();
        try{
            FileOutputStream write = new FileOutputStream(Config.getIns().getProgLocation() + Config.PATH_SEP + "emailMe.cstudio");
            for(int i = 0; i < tempCharRead.length; i ++){
                write.write((tempCharRead[i]));
            }
            write.close();  
        }catch(IOException e){
            e.printStackTrace();
            Util.errMessage(e.getMessage());
        }
    }else{
        t1.setText("You have to fillout this section!");
        t2.setText("You have to fillout this section!");
    }
}
项目:marathonv5    文件:JListXTest.java   
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
                @Override public void eventDispatched(AWTEvent event) {
                }
            }, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
            frame = new JFrame("My Dialog");
            frame.setName("dialog-1");
            Object[] listData = new Object[30];
            for (int i = 1; i <= listData.length; i++) {
                if (i == 25) {
                    listData[i - 1] = "List Item - '" + i + "'";
                } else {
                    listData[i - 1] = "List Item - " + i;
                }
            }
            list = new JList(listData);
            list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            list.setName("list-1");
            list.setDragEnabled(true);
            JPanel p = new JPanel(new BorderLayout());
            p.add(new JScrollPane(list), BorderLayout.NORTH);
            textfield = new JTextField(80);
            textfield.setName("text-field");
            textfield.setDropMode(DropMode.USE_SELECTION);
            p.add(textfield, BorderLayout.SOUTH);
            frame.getContentPane().add(p);
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
            list.requestFocusInWindow();
        }
    });
}
项目:TrabalhoCrisParte2    文件:Generica.java   
public static void Limpar_Campos_Tela(JPanel tela, Boolean bloquear_Componentes){
    for (Component componente : tela.getComponents()) {
        if (componente instanceof JPanel) {
            Limpar_Campos_Tela((JPanel) componente,bloquear_Componentes);
        }
        if(componente instanceof JScrollPane){
            JViewport viewport = ((JScrollPane)componente).getViewport(); 
            JTable table = (JTable)viewport.getView();

            DefaultTableModel model = (DefaultTableModel) table.getModel();
            model.getDataVector().removeAllElements();
            model.fireTableDataChanged();

            table.setEnabled(!bloquear_Componentes);
        }
        if (componente instanceof JTextField) {
            ((JTextField) componente).setText("");
            ((JTextField) componente).setEnabled(!bloquear_Componentes);
        }
        if (componente instanceof JFormattedTextField) {
            ((JFormattedTextField) componente).setText("");
            ((JFormattedTextField) componente).setEnabled(!bloquear_Componentes);
        }
        if(componente instanceof JButton){
            ((JButton) componente).setEnabled(!bloquear_Componentes);
        }
    }
}
项目:OpenDA    文件:Query.java   
public QueryFileChooser(
        String name,
        String defaultName,
        URI base,
        File startingDirectory,
        Color background) {
    super(BoxLayout.X_AXIS);
    _base = base;
    _startingDirectory = startingDirectory;
    _entryBox = new JTextField(defaultName, _width);
    _entryBox.setBackground(background);
    JButton button = new JButton("Browse");
    button.addActionListener(this);
    add(_entryBox);
    add(button);
    // Add the listener last so that there is no notification
    // of the first value.
    _entryBox.addActionListener(new QueryActionListener(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.
    _entryBox.addFocusListener(new QueryFocusListener(name));

    _name = name;
}
项目:JavaGraph    文件:FreshNameDialog.java   
/**
 * Lazily creates and returns the option pane that is to form the content of
 * the dialog.
 */
private JOptionPane getOptionPane() {
    if (this.optionPane == null) {
        JTextField nameField = getNameField();
        this.optionPane = new JOptionPane(new Object[] {nameField, getErrorLabel()},
            JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null,
            new Object[] {getOkButton(), getCancelButton()});
    }
    return this.optionPane;
}
项目:JavaGraph    文件:FindReplaceDialog.java   
/** Returns the text field in which the user is to enter his input. */
private JTextField getNewField() {
    if (this.newField == null) {
        this.newField = new JTextField();
        this.newField.getDocument().addDocumentListener(new OverlapListener());
        this.newField.addActionListener(getNameFieldListener());
    }
    return this.newField;
}
项目:jmt    文件:DefaultsEditor.java   
public void actionPerformed(ActionEvent e) {
    // Unregister all stringListener to avoid strange random things
    JTextField tmp;
    while (!registeredStringListener.isEmpty()) {
        tmp = registeredStringListener.remove(0);
        tmp.removeFocusListener(stringListener);
        tmp.removeKeyListener(stringListener);
    }
    Defaults.revertToDefaults();
    DefaultsEditor.this.getContentPane().removeAll();
    DefaultsEditor.this.initComponents(target);
    DefaultsEditor.this.show();
}
项目:DocIT    文件:EmployeeView.java   
/**
 * Constructor.
 * 
 * @param model
 */
public EmployeeView(Model model) {
    super(model);

    address = new JTextField();

    createView();
}
项目:MaxSim    文件:CFGOptionsPanel.java   
public FontChooser(String propertyName) {
    this.propertyName = propertyName;
    preview = new JTextField("");
    preview.setEditable(false);
    button = new JButton("...");
    button.setMargin(new Insets(0, 0, 0, 0));
    button.addActionListener(this);
}
项目:incubator-netbeans    文件:NameAndLocationPanel.java   
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final NewLoaderIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_LoaderWizardTitle"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);

    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }

    if (data.canUseMultiview()) {
        useMultiView.setEnabled(true);
        useMultiView.setSelected(true);
    } else {
        useMultiView.setEnabled(false);
        useMultiView.setSelected(false);
    }
}
项目:JavaGraph    文件:FreshNameDialog.java   
/** Returns the text field in which the user is to enter his input. */
private JTextField getNameField() {
    if (this.nameField == null) {
        this.nameField = new JTextField(30);
        this.nameField.getDocument()
            .addDocumentListener(new OverlapListener());
        this.nameField.addActionListener(getNameFieldListener());
    }
    return this.nameField;
}
项目:fuck_zookeeper    文件:ZooInspectorConnectionPropertiesDialog.java   
private Properties getConnectionProps() {
    Properties connectionProps = new Properties();
    for (Entry<String, JComponent> entry : components.entrySet()) {
        String value = null;
        JComponent component = entry.getValue();
        if (component instanceof JTextField) {
            value = ((JTextField) component).getText();
        } else if (component instanceof JComboBox) {
            value = ((JComboBox) component).getSelectedItem().toString();
        }
        connectionProps.put(entry.getKey(), value);
    }
    return connectionProps;
}
项目:BassNES    文件:AddBreakPoint.java   
/**
 * Create the frame.
 */
public AddBreakPoint(DefaultListModel<BreakPoint> breakpoint) {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JComboBox<Object> comboBox = new JComboBox<Object>();
    comboBox.setModel(new DefaultComboBoxModel<Object>(Variable.values()));
    comboBox.setBounds(10, 115, 141, 20);
    contentPane.add(comboBox);

    textField = new JTextField();
    textField.setBounds(226, 115, 141, 20);
    contentPane.add(textField);
    textField.setColumns(10);

    JButton btnAddBreakpoint = new JButton("Add BreakPoint");
    btnAddBreakpoint.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Object val = null;
            String text = textField.getText().toLowerCase();
            if(text.equals("true"))
                val = true;
            else if(text.equals("false"))
                val = false;
            else{
                val = Integer.parseInt(text, 16);
            }
            breakpoint.addElement(new BreakPoint((Variable) comboBox.getSelectedItem(),val));
            setVisible(false);
            dispose();
        }
    });
    btnAddBreakpoint.setBounds(138, 191, 141, 23);
    contentPane.add(btnAddBreakpoint);
}
项目:rapidminer    文件:OAuthValueCellEditor.java   
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    if (value != null) {
        ((JTextField) editorComponent).setText(String.valueOf(value));
    }
    return container;
}
项目:openjdk-jdk10    文件:JTextFieldOperator.java   
/**
 * Maps {@code JTextField.getScrollOffset()} through queue
 */
public int getScrollOffset() {
    return (runMapping(new MapIntegerAction("getScrollOffset") {
        @Override
        public int map() {
            return ((JTextField) getSource()).getScrollOffset();
        }
    }));
}
项目:incubator-netbeans    文件:PropertyPanel.java   
private void keyBundleTextChanged() {
    if (internalTextChange == 0) {
        String key = ((JTextField) keyBundleCombo.getEditor().getEditorComponent()).getText();

        if (!key.equals(i18nString.getKey())) {
            i18nString.setKey(key);
            firePropertyChange(PROP_STRING, null, null);
        }
    }
}
项目:Dahlem_SER316    文件:LoginDialogTest.java   
/**
 * Tests to ensure account is not generated when it shouldn't be. For
 * example: Differing passwords or account already exists. This does not
 * validate the account creation process details.
 */
@Test
public void testAccountCreation() {
    JTextField usernameField = dlg.getUsernameField();
    JPasswordField passPrimary = dlg.getPasswordFieldPrimary();
    JPasswordField passVerify = dlg.getPasswordFieldVerify();
    JButton button = dlg.getBtnCreateNewAccount();

    // Test account created no password
    usernameField.setText("HeyTestGuy1");
    passPrimary.setText("");
    passVerify.setText("");
    button.doClick();
    assertTrue(AccountManager.userExists("HeyTestGuy1"));

    // Test account NOT created - mismatched password
    usernameField.setText("HeyTestGuy2");
    passPrimary.setText("ardvark");
    passVerify.setText("");
    button.doClick();
    assertFalse(AccountManager.userExists("HeyTestGuy2"));

    //Test all correct values.
    usernameField.setText("HeyTestGuy3");
    passPrimary.setText("ardvark");
    passVerify.setText("ardvark");
    button.doClick();
    assertTrue(AccountManager.userExists("HeyTestGuy3"));

    assertTrue(AccountManager.removeUserAccount("HeyTestGuy1"));
    assertTrue(AccountManager.removeUserAccount("HeyTestGuy3"));
}
项目:COE1186    文件:ScheduleJTable.java   
private void addTextAreaToColumn() {
    //Create the ComboBox and add the line blocks to it
    JTextField textArea = new JTextField();

    //Add a listener to the ComboBox, add stop when state changes
    textArea.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            int row = table.getSelectedRow();
            String timeToDwell = textArea.getText();

            if(SimTime.isValid(timeToDwell) && row>=0) {
                schedule.addStop(row, new SimTime(timeToDwell));
                fireScheduleChanged();
            }
        }
    });

    //Put the TextArea into the JTable cell
    DefaultCellEditor textAreaEditor = new DefaultCellEditor(textArea);
    this.getColumnModel().getColumn(1).setCellEditor(textAreaEditor);

    //Add a tooltip
    DefaultTableCellRenderer textAreaRenderer = new DefaultTableCellRenderer();
    textAreaRenderer.setToolTipText("Type time to spend at the station");
    this.getColumnModel().getColumn(1).setCellRenderer(textAreaRenderer);
}
项目:Equella    文件:OAIPlugin.java   
@Override
public void initGUI()
{
    serverField = new JTextField();

    JPanel setsPanel = new JPanel();
    aSetField = new JComboBox<>();
    aSetField.setEditable(true);
    getSetsButton = new JButton(getString("oaiplugin.getsets"));
    getSetsButton.addActionListener(this);

    setupPanel(setsPanel, aSetField, getSetsButton);

    JPanel metaPanel = new JPanel();
    metaField = new JComboBox<>();
    metaField.setEditable(true);
    getMetaButton = new JButton(getString("oaiplugin.getmetas"));
    getMetaButton.addActionListener(this);

    setupPanel(metaPanel, metaField, getMetaButton);

    panel.addComponent(new JLabel(getString("oaiplugin.settings")));
    panel.addNameAndComponent(getString("oaiplugin.server"), serverField);
    panel.addNameAndComponent(getString("oaiplugin.format"), metaPanel);
    panel.addNameAndComponent(getString("oaiplugin.aset"), setsPanel);

}
项目:incubator-netbeans    文件:BaseTable.java   
public void focusGained(FocusEvent e) {
    //it will be the first focus gained event, so go select
    //whatever matches the first character
    processSearchText(((JTextField) e.getSource()).getText());

    JRootPane root = getRootPane();

    if (root != null) { // #57417 NPE
        root.getLayeredPane().repaint();
    }
    setCaretPosition(getText().length());
}
项目:ohjelmistotuotanto2017    文件:Tapahtumankuuntelija.java   
public Tapahtumankuuntelija(JButton plus, JButton miinus, JButton nollaa, JButton undo, JTextField tuloskentta, JTextField syotekentta) {
    this.plus = plus;
    this.miinus = miinus;
    this.nollaa = nollaa;
    this.undo = undo;
    this.tuloskentta = tuloskentta;
    this.syotekentta = syotekentta;
    this.sovellus = new Sovelluslogiikka();
}
项目:AgentWorkbench    文件:ClassSelectionPanel.java   
/**
 * This method checks if a given class reference is valid.
 *
 * @param jTextField the j text field
 * @param jButton the j button
 * @return true, if is valid class
 */
private boolean isValidClass(JTextField jTextField) {

    String className = jTextField.getText().trim();
    if (this.class2Search4DefaultValue==null && className.equals("")) {
        // --- If no default value is configured, an empty text field is allowed -----
        this.getJButtonCheckClass().setIcon(this.imageGreen);
        this.setValidClass(true);
        return true;
    } else if (isAllowNull()==true && className.equals("")) {
        this.getJButtonCheckClass().setIcon(this.imageGreen);
        this.setValidClass(true);
        return true;

    } else {
        // --- If a default value is configured, there should be a valid class ------ 
        try {
            @SuppressWarnings("unused")
            Class<?> clazz = BaseClassLoadServiceUtility.forName(className);
            this.getJButtonCheckClass().setIcon(this.imageGreen);
            this.setValidClass(true);
            return true;

        } catch (ClassNotFoundException e) {
            //e.printStackTrace();
            this.getJButtonCheckClass().setIcon(this.imageRed);
        }
    }
    this.setValidClass(false);
    return false;
}