java类javax.swing.JTextField的实例源码

MessageManager.java 文件源码 项目:myster 阅读 27 收藏 0 点赞 0 评论 0
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);
}
DistributionsEditor.java 文件源码 项目:QN-ACTR-Release 阅读 29 收藏 0 点赞 0 评论 0
/**
 * 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;
}
TableCellEditor4Domains.java 文件源码 项目:AgentWorkbench 阅读 22 收藏 0 点赞 0 评论 0
@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;
}
DeptView.java 文件源码 项目:DocIT 阅读 26 收藏 0 点赞 0 评论 0
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();
}
AbstractMultiBitRegisterCP.java 文件源码 项目:jaer 阅读 25 收藏 0 点赞 0 评论 0
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();
    }
}
TimeLimit.java 文件源码 项目:GOLAD 阅读 23 收藏 0 点赞 0 评论 0
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);
        }
    }
}
WebCrawler.java 文件源码 项目:Community_Tieba-Data-Analyzer 阅读 26 收藏 0 点赞 0 评论 0
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);
    }
ZooInspectorConnectionPropertiesDialog.java 文件源码 项目:https-github.com-apache-zookeeper 阅读 24 收藏 0 点赞 0 评论 0
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);
                }
            }
        }
    }
}
TreeSearch.java 文件源码 项目:Cognizant-Intelligent-Test-Scripter 阅读 26 收藏 0 点赞 0 评论 0
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);

}
Test6505027.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
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));
}
PropertyPanel.java 文件源码 项目:incubator-netbeans 阅读 31 收藏 0 点赞 0 评论 0
/** 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);
}
NameAndLocationPanel.java 文件源码 项目:incubator-netbeans 阅读 26 收藏 0 点赞 0 评论 0
/** 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);
    }
}
IDEValidation.java 文件源码 项目:incubator-netbeans 阅读 23 收藏 0 点赞 0 评论 0
/** 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();
}
Test6505027.java 文件源码 项目:jdk8u-jdk 阅读 32 收藏 0 点赞 0 评论 0
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));
}
GenericToolbar.java 文件源码 项目:incubator-netbeans 阅读 27 收藏 0 点赞 0 评论 0
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;
}
DefaultButtonModelCrashTest.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
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);
    }
ConfigDialog.java 文件源码 项目:xdman 阅读 23 收藏 0 点赞 0 评论 0
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;
}
GUIRegistrationPanel.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
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();
                }
            }
        });
    }
}
SetupDisplay.java 文件源码 项目:Community_Tieba-Data-Analyzer 阅读 21 收藏 0 点赞 0 评论 0
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!");
    }
}
JListXTest.java 文件源码 项目:marathonv5 阅读 24 收藏 0 点赞 0 评论 0
@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();
        }
    });
}
Generica.java 文件源码 项目:TrabalhoCrisParte2 阅读 23 收藏 0 点赞 0 评论 0
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);
        }
    }
}
Query.java 文件源码 项目:OpenDA 阅读 33 收藏 0 点赞 0 评论 0
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;
}
FreshNameDialog.java 文件源码 项目:JavaGraph 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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;
}
FindReplaceDialog.java 文件源码 项目:JavaGraph 阅读 29 收藏 0 点赞 0 评论 0
/** 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;
}
DefaultsEditor.java 文件源码 项目:jmt 阅读 28 收藏 0 点赞 0 评论 0
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();
}
EmployeeView.java 文件源码 项目:DocIT 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Constructor.
 * 
 * @param model
 */
public EmployeeView(Model model) {
    super(model);

    address = new JTextField();

    createView();
}
CFGOptionsPanel.java 文件源码 项目:MaxSim 阅读 19 收藏 0 点赞 0 评论 0
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);
}
NameAndLocationPanel.java 文件源码 项目:incubator-netbeans 阅读 29 收藏 0 点赞 0 评论 0
/** 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);
    }
}
FreshNameDialog.java 文件源码 项目:JavaGraph 阅读 87 收藏 0 点赞 0 评论 0
/** 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;
}
ZooInspectorConnectionPropertiesDialog.java 文件源码 项目:fuck_zookeeper 阅读 21 收藏 0 点赞 0 评论 0
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;
}


问题


面经


文章

微信
公众号

扫码关注公众号