Example usage for javax.swing JTextField JTextField

List of usage examples for javax.swing JTextField JTextField

Introduction

In this page you can find the example usage for javax.swing JTextField JTextField.

Prototype

public JTextField() 

Source Link

Document

Constructs a new TextField.

Usage

From source file:biomine.bmvis2.pipeline.TextFilterHider.java

public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) {
    JPanel ret = new JPanel();
    final JTextField filterField = new JTextField();
    ret.add(filterField);/*from  w w w.j  av  a2s.  c o  m*/
    filterField.getDocument().addDocumentListener(new DocumentListener() {
        private void update() {
            if (filterField.getText().equals(""))
                return;
            if (filterField.getText().equals(TextFilterHider.this.filter))
                return;
            TextFilterHider.this.filter = filterField.getText();
            v.settingsChanged(false);
        }

        public void insertUpdate(DocumentEvent documentEvent) {
            this.update();
        }

        public void removeUpdate(DocumentEvent documentEvent) {
            this.update();
        }

        public void changedUpdate(DocumentEvent documentEvent) {
            this.update();
        }
    });

    return ret;
}

From source file:gtu._work.ui.RenameUI.java

private void initGUI() {
    try {/*from w  w w.ja  v a 2  s .  c  o m*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("\u9078\u64c7\u76ee\u9304");
                }
                {
                    srcDirText = new JTextField();
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(srcDirText, true);
                    jPanel1.add(srcDirText);
                    srcDirText.setPreferredSize(new java.awt.Dimension(470, 22));
                }
                {
                    jLabel2 = new JLabel();
                    jPanel1.add(jLabel2);
                    jLabel2.setText("\u6a94\u540dRegex");
                    jLabel2.setPreferredSize(new java.awt.Dimension(68, 15));
                }
                {
                    findFileRegexText = new JTextField();
                    jPanel1.add(findFileRegexText);
                    findFileRegexText.setPreferredSize(new java.awt.Dimension(446, 22));
                }
                {
                    jLabel3 = new JLabel();
                    jPanel1.add(jLabel3);
                    jLabel3.setText("\u4fee\u6539\u5f8c\u6a94\u540d");
                    jLabel3.setPreferredSize(new java.awt.Dimension(68, 15));
                }
                {
                    renameRegexText = new JTextField();
                    jPanel1.add(renameRegexText);
                    renameRegexText.setPreferredSize(new java.awt.Dimension(446, 22));
                }
                {
                    scanBtn = new JButton();
                    jPanel1.add(scanBtn);
                    scanBtn.setText("\u6383\u63cf\u76ee\u9304");
                    scanBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            scanBtnActionPerformed();
                        }
                    });
                }
                {
                    usePatternNewNameBtn = new JButton();
                    jPanel1.add(usePatternNewNameBtn);
                    usePatternNewNameBtn.setText("\u5957\u7528\u6a94\u540d");
                    usePatternNewNameBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            usePatternNewNameBtnActionPerformed();
                        }
                    });
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn);
                    executeBtn.setText("\u4ee5\u8868\u683c\u8a2d\u5b9a\u66f4\u6b63");
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnActionPerformed();
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("jPanel2", null, jPanel2, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(552, 338));
                    {
                        renameTable = new JTable();
                        jScrollPane1.setViewportView(renameTable);
                        JTableUtil.defaultSetting(renameTable);
                        renameTable.setModel(createNewModel());
                    }
                }
            }
        }
        pack();
        this.setSize(565, 392);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}