List of usage examples for javax.swing JTextArea JTextArea
public JTextArea()
From source file:events.KeyEventDemo.java
private void addComponentsToPane() { JButton button = new JButton("Clear"); button.addActionListener(this); typingArea = new JTextField(20); typingArea.addKeyListener(this); //Uncomment this if you wish to turn off focus //traversal. The focus subsystem consumes //focus traversal keys, such as Tab and Shift Tab. //If you uncomment the following line of code, this //disables focus traversal and the Tab events will //become available to the key event listener. //typingArea.setFocusTraversalKeysEnabled(false); displayArea = new JTextArea(); displayArea.setEditable(false);//from w ww. java 2s . com JScrollPane scrollPane = new JScrollPane(displayArea); scrollPane.setPreferredSize(new Dimension(375, 125)); getContentPane().add(typingArea, BorderLayout.PAGE_START); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(button, BorderLayout.PAGE_END); }
From source file:org.moeaframework.examples.gp.regression.SymbolicRegressionGUI.java
/** * Initialize the components on the GUI. *//* w w w . j ava 2 s . co m*/ protected void initialize() { container = new JPanel(new BorderLayout()); details = new JTextArea(); details.setWrapStyleWord(true); details.setEditable(false); details.setLineWrap(true); close = new JButton(new AbstractAction("Close") { private static final long serialVersionUID = 2365513341407994400L; @Override public void actionPerformed(ActionEvent e) { isCanceled = true; dispose(); } }); }
From source file:net.lmxm.ute.gui.editors.AbstractCommonEditorPanel.java
/** * Gets the description text area./* w w w.ja va2 s. c o m*/ * * @return the description text area */ private JTextArea getDescriptionTextArea() { if (descriptionTextArea == null) { descriptionTextArea = new JTextArea(); descriptionTextArea.setColumns(40); descriptionTextArea.setRows(5); descriptionTextArea.setLineWrap(true); descriptionTextArea.setTabSize(4); descriptionTextArea.setDragEnabled(true); descriptionTextArea.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void valueChanged(final String newValue) { if (getUserObject() instanceof DescribableBean) { ((DescribableBean) getUserObject()).setDescription(newValue); } } }); } return descriptionTextArea; }
From source file:gdt.jgui.tool.JTextEncrypter.java
/** * The default constructor.//w w w . j av a 2s .c o m */ public JTextEncrypter() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Master password", TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panel); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); JCheckBox chckbxNewCheckBox = new JCheckBox("Show"); chckbxNewCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); chckbxNewCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() != ItemEvent.SELECTED) { passwordField.setEchoChar('*'); } else { passwordField.setEchoChar((char) 0); } } }); panel.add(chckbxNewCheckBox); panel.setFocusTraversalPolicy( new FocusTraversalOnArray(new Component[] { chckbxNewCheckBox, passwordField })); passwordField = new JPasswordField(); passwordField.setMaximumSize(new Dimension(Integer.MAX_VALUE, passwordField.getPreferredSize().height)); panel.add(passwordField); JPanel panel_1 = new JPanel(); panel_1.setBorder(new TitledBorder(null, "Text", TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panel_1); panel_1.setLayout(new BorderLayout(0, 0)); textArea = new JTextArea(); textArea.setColumns(1); panel_1.add(textArea); }
From source file:events.FocusEventDemo.java
public void addComponentsToPane(final Container pane) { GridBagLayout gridbag = new GridBagLayout(); pane.setLayout(gridbag);//from w w w .java 2 s . co m GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; //Make column as wide as possible. JTextField textField = new JTextField("A TextField"); textField.setMargin(new Insets(0, 2, 0, 2)); textField.addFocusListener(this); gridbag.setConstraints(textField, c); add(textField); c.weightx = 0.1; //Widen every other column a bit, when possible. c.fill = GridBagConstraints.NONE; JLabel label = new JLabel("A Label"); label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); label.addFocusListener(this); gridbag.setConstraints(label, c); add(label); String comboPrefix = "ComboBox Item #"; final int numItems = 15; Vector<String> vector = new Vector<String>(numItems); for (int i = 0; i < numItems; i++) { vector.addElement(comboPrefix + i); } JComboBox comboBox = new JComboBox(vector); comboBox.addFocusListener(this); gridbag.setConstraints(comboBox, c); add(comboBox); c.gridwidth = GridBagConstraints.REMAINDER; JButton button = new JButton("A Button"); button.addFocusListener(this); gridbag.setConstraints(button, c); add(button); c.weightx = 0.0; c.weighty = 0.1; c.fill = GridBagConstraints.BOTH; String listPrefix = "List Item #"; Vector<String> listVector = new Vector<String>(numItems); for (int i = 0; i < numItems; i++) { listVector.addElement(listPrefix + i); } JList list = new JList(listVector); list.setSelectedIndex(1); //It's easier to see the focus change //if an item is selected. list.addFocusListener(this); JScrollPane listScrollPane = new JScrollPane(list); gridbag.setConstraints(listScrollPane, c); add(listScrollPane); c.weighty = 1.0; //Make this row as tall as possible. c.gridheight = GridBagConstraints.REMAINDER; //Set up the area that reports focus-gained and focus-lost events. display = new JTextArea(); display.setEditable(false); //The setRequestFocusEnabled method prevents a //component from being clickable, but it can still //get the focus through the keyboard - this ensures //user accessibility. display.setRequestFocusEnabled(false); display.addFocusListener(this); JScrollPane displayScrollPane = new JScrollPane(display); gridbag.setConstraints(displayScrollPane, c); add(displayScrollPane); setPreferredSize(new Dimension(450, 450)); ((JPanel) pane).setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:org.gumtree.vis.awt.AbstractPlotEditor.java
private JPanel createHelpPanel() { JPanel wrap = new JPanel(new GridLayout(1, 1)); JPanel helpPanel = new JPanel(new GridLayout(1, 1)); helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); // helpPanel.setBorder(BorderFactory.createTitledBorder( // BorderFactory.createEtchedBorder(), "Help Topics")); SpringLayout spring = new SpringLayout(); JPanel inner = new JPanel(spring); inner.setBorder(BorderFactory.createEmptyBorder()); final IHelpProvider provider = plot.getHelpProvider(); final JList list = new JList(provider.getHelpMap().keySet().toArray()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // list.setBorder(BorderFactory.createEtchedBorder()); JScrollPane listPane1 = new JScrollPane(list); inner.add(listPane1);//from w w w . j ava2s . c o m listPane1.setMaximumSize(new Dimension(140, 0)); listPane1.setMinimumSize(new Dimension(70, 0)); // JPanel contentPanel = new JPanel(new GridLayout(2, 1)); // inner.add(list); final JTextField keyField = new JTextField(); keyField.setMaximumSize(new Dimension(400, 20)); keyField.setEditable(false); // keyField.setMaximumSize(); // keyArea.setLineWrap(true); // keyArea.setWrapStyleWord(true); // keyArea.setBorder(BorderFactory.createEtchedBorder()); inner.add(keyField); // contentPanel.add(new JLabel()); // contentPanel.add(new JLabel()); final JTextArea helpArea = new JTextArea(); JScrollPane areaPane = new JScrollPane(helpArea); helpArea.setEditable(false); helpArea.setLineWrap(true); helpArea.setWrapStyleWord(true); // helpArea.setBorder(BorderFactory.createEtchedBorder()); inner.add(areaPane); // contentPanel.add(new JLabel()); // contentPanel.add(new JLabel()); // inner.add(contentPanel); spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner); spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner); spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1); spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner); spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField); spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1); spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField); spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner); spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane); spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { Object[] selected = list.getSelectedValues(); if (selected.length >= 0) { HelpObject help = provider.getHelpMap().get(selected[0]); if (help != null) { keyField.setText(help.getKey()); helpArea.setText(help.getDiscription()); } } } }); helpPanel.add(inner, BorderLayout.NORTH); wrap.setName("Help"); wrap.add(helpPanel, BorderLayout.NORTH); return wrap; }
From source file:gtu._work.ui.ObnfRepairDBUI.java
private void initGUI() { try {/*w ww.ja va 2 s. c om*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("obnf", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { jTextArea1 = new JTextArea(); jScrollPane1.setViewportView(jTextArea1); jTextArea1.setText(""); } } { jPanel4 = new JPanel(); jPanel1.add(jPanel4, BorderLayout.NORTH); jPanel4.setPreferredSize(new java.awt.Dimension(581, 62)); { jLabel1 = new JLabel(); jPanel4.add(jLabel1); jLabel1.setText("domainJar"); } { domainJarText = new JTextField(); ObnfRepairDBBatch test = new ObnfRepairDBBatch(); domainJarText.setText(test.fetchDomainJar()); JCommonUtil.jTextFieldSetFilePathMouseEvent(domainJarText, false); jPanel4.add(domainJarText); domainJarText.setPreferredSize(new java.awt.Dimension(400, 22)); } { readInfoBtn = new JButton(); jPanel4.add(readInfoBtn); readInfoBtn.setText("\u8b80\u53d6xml"); readInfoBtn.setPreferredSize(new java.awt.Dimension(179, 22)); readInfoBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { readInfo(); } }); } { clearAllBtn = new JButton(); jPanel4.add(clearAllBtn); clearAllBtn.setText("\u6e05\u9664\u5168\u90e8"); clearAllBtn.setPreferredSize(new java.awt.Dimension(179, 22)); clearAllBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jTextArea2.setText(""); jTextArea1.setText(""); } }); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("?", null, jPanel2, null); { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); { jScrollPane3 = new JScrollPane(); jScrollPane2.setViewportView(jScrollPane3); { jTextArea2 = new JTextArea(); jScrollPane3.setViewportView(jTextArea2); jTextArea2.setText(""); } } } } } pack(); this.setSize(594, 436); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:JavaXWin.java
public void newFrame() { JInternalFrame jif = new JInternalFrame("Frame " + m_count, true, true, true, true); jif.setBounds(20 * (m_count % 10) + m_tencount * 80, 20 * (m_count % 10), 200, 200); JTextArea text = new JTextArea(); JScrollPane scroller = new JScrollPane(); scroller.getViewport().add(text);//from w w w.j a v a 2 s. c om try { FileReader fileStream = new FileReader(""); text.read(fileStream, "JavaLinux.txt"); } catch (Exception e) { text.setText("* Could not read JavaLinux.txt *"); } jif.getContentPane().add(scroller); m_desktop.add(jif); try { jif.setSelected(true); } catch (PropertyVetoException pve) { System.out.println("Could not select " + jif.getTitle()); } m_count++; if (m_count % 10 == 0) { if (m_tencount < 3) m_tencount++; else m_tencount = 0; } }
From source file:com.offbynull.peernetic.debug.visualizer.JGraphXVisualizer.java
/** * Creates a {@link JGraphXVisualizer} object. *//*from www .j a v a2 s.c o m*/ public JGraphXVisualizer() { graph = new mxGraph(); graph.setCellsEditable(false); graph.setAllowDanglingEdges(false); graph.setAllowLoops(false); graph.setCellsDeletable(false); graph.setCellsCloneable(false); graph.setCellsDisconnectable(false); graph.setDropEnabled(false); graph.setSplitEnabled(false); graph.setCellsBendable(false); graph.setConnectableEdges(false); graph.setCellsMovable(false); graph.setCellsResizable(false); graph.setAutoSizeCells(true); component = new mxGraphComponent(graph); component.setConnectable(false); component.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); component.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); nodeLookupMap = new DualHashBidiMap<>(); connToEdgeLookupMap = new MultiValueMap<>(); edgeToConnLookupMap = new HashMap<>(); vertexLingerTriggerMap = new HashMap<>(); textOutputArea = new JTextArea(); textOutputArea.setLineWrap(false); textOutputArea.setEditable(false); JScrollPane textOutputScrollPane = new JScrollPane(textOutputArea); textOutputScrollPane.setPreferredSize(new Dimension(0, 100)); frame = new JFrame("Visualizer"); frame.setSize(400, 400); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, component, textOutputScrollPane); splitPane.setResizeWeight(1.0); frame.setContentPane(splitPane); component.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { zoomFit(); } }); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { Recorder<A> rec = recorder.get(); if (rec != null) { IOUtils.closeQuietly(rec); } VisualizerEventListener veListener = listener.get(); if (veListener != null) { veListener.closed(); } } }); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); splitPane.setDividerLocation(0.2); }
From source file:gtu._work.ui.RegexCatchReplacer_Ebao.java
private void initGUI() { try {//www . ja va2 s. c om { } BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("source", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { replaceArea = new JTextArea(); jScrollPane1.setViewportView(replaceArea); replaceArea.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JPopupMenuUtil.newInstance(replaceArea).applyEvent(evt) .addJMenuItem("load from file", true, new ActionListener() { Thread newThread; public void actionPerformed(ActionEvent arg0) { if (newThread != null && newThread.getState() != Thread.State.TERMINATED) { JCommonUtil._jOptionPane_showMessageDialog_error( "file is loading!"); return; } final File file = JCommonUtil._jFileChooser_selectFileOnly(); if (file == null) { JCommonUtil._jOptionPane_showMessageDialog_error( "file is not correct!"); return; } String defaultCharset = Charset.defaultCharset().displayName(); String chst = (String) JCommonUtil._jOptionPane_showInputDialog( "input your charset!", defaultCharset); final Charset charset2 = Charset.forName( StringUtils.defaultIfEmpty(chst, defaultCharset)); newThread = new Thread(Thread.currentThread().getThreadGroup(), new Runnable() { public void run() { try { loadFromFileSb = new StringBuilder(); BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(file), charset2)); for (String line = null; (line = reader .readLine()) != null;) { loadFromFileSb.append(line + "\n"); } reader.close(); replaceArea .setText(loadFromFileSb.toString()); JCommonUtil ._jOptionPane_showMessageDialog_info( "load completed!"); } catch (Exception e) { JCommonUtil.handleException(e); } } }, "" + System.currentTimeMillis()); newThread.setDaemon(true); newThread.start(); } }).show(); } }); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("param", null, jPanel2, null); { exeucte = new JButton(); jPanel2.add(exeucte, BorderLayout.SOUTH); exeucte.setText("exeucte"); exeucte.setPreferredSize(new java.awt.Dimension(491, 125)); exeucte.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exeucteActionPerformed(evt); } }); } { jPanel3 = new JPanel(); GroupLayout jPanel3Layout = new GroupLayout((JComponent) jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel2.add(jPanel3, BorderLayout.CENTER); { repFromText = new JTextField(); } { repToText = new JTextField(); } jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup() .addContainerGap(25, 25) .addGroup(jPanel3Layout.createParallelGroup() .addGroup(jPanel3Layout.createSequentialGroup().addComponent(repFromText, GroupLayout.PREFERRED_SIZE, 446, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(repToText, GroupLayout.PREFERRED_SIZE, 446, GroupLayout.PREFERRED_SIZE))) .addContainerGap(20, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addComponent(repFromText, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(repToText, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); } { addToTemplate = new JButton(); jPanel2.add(addToTemplate, BorderLayout.NORTH); addToTemplate.setText("add to template"); addToTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { prop.put(repFromText.getText(), repToText.getText()); reloadTemplateList(); } }); } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("result", null, jPanel4, null); { jScrollPane2 = new JScrollPane(); jPanel4.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(491, 283)); { DefaultTableModel resultAreaModel = JTableUtil.createModel(true, "match", "count"); resultArea = new JTable(); jScrollPane2.setViewportView(resultArea); JTableUtil.defaultSetting(resultArea); resultArea.setModel(resultAreaModel); } } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jPanel5.setLayout(jPanel5Layout); jTabbedPane1.addTab("template", null, jPanel5, null); { jScrollPane3 = new JScrollPane(); jPanel5.add(jScrollPane3, BorderLayout.CENTER); { templateList = new JList(); jScrollPane3.setViewportView(templateList); reloadTemplateList(); } templateList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (templateList.getLeadSelectionIndex() == -1) { return; } Entry<Object, Object> entry = (Entry<Object, Object>) JListUtil .getLeadSelectionObject(templateList); repFromText.setText((String) entry.getKey()); repToText.setText((String) entry.getValue()); } }); templateList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(templateList).defaultJListKeyPressed(evt); } }); } } { jPanel6 = new JPanel(); FlowLayout jPanel6Layout = new FlowLayout(); jPanel6.setLayout(jPanel6Layout); jTabbedPane1.addTab("result1", null, jPanel6, null); { resultBtn1 = new JButton(); jPanel6.add(resultBtn1); resultBtn1.setText("to String[]"); resultBtn1.setPreferredSize(new java.awt.Dimension(105, 32)); resultBtn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JTableUtil tableUtil = JTableUtil.newInstance(resultArea); int[] rowPoss = tableUtil.getSelectedRows(); DefaultTableModel model = tableUtil.getModel(); List<Object> valueList = new ArrayList<Object>(); for (int ii = 0; ii < rowPoss.length; ii++) { valueList.add(model.getValueAt(rowPoss[ii], 0)); } String reult = valueList.toString().replaceAll("[\\s]", "") .replaceAll("[\\,]", "\",\"").replaceAll("[\\[\\]]", "\""); ClipboardUtil.getInstance().setContents(reult); } }); } { resultBtn2 = new JButton(); jPanel6.add(resultBtn2); resultBtn2.setText("TODO"); resultBtn2.setPreferredSize(new java.awt.Dimension(105, 32)); resultBtn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("resultBtn1.actionPerformed, event=" + evt); // TODO add your code for // resultBtn1.actionPerformed JCommonUtil._jOptionPane_showMessageDialog_info("TODO"); } }); } } } this.setSize(512, 350); JCommonUtil.setFont(repToText, repFromText, replaceArea, templateList); { panel = new JPanel(); jTabbedPane1.addTab("eBao", null, panel, null); panel.setLayout(new BorderLayout(0, 0)); { scrollPane = new JScrollPane(); panel.add(scrollPane, BorderLayout.CENTER); { ebaoTable = new JTable(); scrollPane.setViewportView(ebaoTable); // TODO DefaultTableModel ebaoModel = JTableUtil.createModel(true, "match", "label"); JTableUtil.defaultSetting(ebaoTable); ebaoTable.setModel(ebaoModel); } } { exactEbaoSearchChk = new JCheckBox(""); panel.add(exactEbaoSearchChk, BorderLayout.NORTH); } } JCommonUtil.frameCloseDo(this, new WindowAdapter() { public void windowClosing(WindowEvent paramWindowEvent) { if (StringUtils.isNotBlank(repFromText.getText())) { prop.put(repFromText.getText(), repToText.getText()); } try { prop.store(new FileOutputStream(propFile), "regexText"); } catch (Exception e) { JCommonUtil.handleException("properties store error!", e); } setVisible(false); dispose(); } }); } catch (Exception e) { e.printStackTrace(); } }