List of usage examples for javax.swing WindowConstants DISPOSE_ON_CLOSE
int DISPOSE_ON_CLOSE
To view the source code for javax.swing WindowConstants DISPOSE_ON_CLOSE.
Click Source Link
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
/** * Constructs a new LicenseWindow./* w ww . j a va 2 s .co m*/ * @param license the License being displayed * @param urn the URN the license is validating against * @param listener a VerificationListener this license can forward * licenseVerified events to. */ private LicenseWindow(License license, URN urn, LimeXMLDocument document, VerificationListener listener, String keyValue) { super(GUIMediator.getAppFrame()); URN = urn; LICENSE = license; DETAILS = new JPanel(new GridBagLayout()); LISTENER = listener; KEY_VALUE = keyValue; DOCUMENT = document; setModal(false); setResizable(false); setTitle(getTitleString()); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JComponent pane = (JComponent) getContentPane(); GUIUtils.addHideAction(pane); pane.setPreferredSize(new Dimension(400, 230)); DETAILS.setPreferredSize(new Dimension(400, 210)); getContentPane().setLayout(new GridBagLayout()); constructDialog(getContentPane()); validate(); if (GUIMediator.isAppVisible()) setLocationRelativeTo(GUIMediator.getAppFrame()); else setLocation(GUIMediator.getScreenCenterPoint(this)); }
From source file:gtu._work.ui.SaveFileToPropertiesUI.java
private void initGUI() { try {/*from w ww . j av a2s . c o m*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); this.setTitle("save file to properties"); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("load", null, jPanel1, null); { jScrollPane2 = new JScrollPane(); jPanel1.add(jScrollPane2, BorderLayout.CENTER); { textArea = new JTextArea(); jScrollPane2.setViewportView(textArea); } } { jPanel2 = new JPanel(); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.setPreferredSize(new java.awt.Dimension(400, 40)); { addPropsFile = new JButton(); jPanel2.add(addPropsFile); addPropsFile.setText("load properties from file"); addPropsFile.setPreferredSize(new java.awt.Dimension(234, 30)); addPropsFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectFileOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!", "ERROR"); return; } try { props.load(new InputStreamReader(new FileInputStream(file), (String) openUnknowFilecharSet.getSelectedItem())); reloadPropertiesTable(); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { openFile = new JButton(); jPanel2.add(openFile); openFile.setText("open unknow file"); openFile.setPreferredSize(new java.awt.Dimension(204, 30)); openFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectFileOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!", "ERROR"); return; } try { String encode = (String) openUnknowFilecharSet.getSelectedItem(); BufferedReader reader = new BufferedReader( new InputStreamReader(new FileInputStream(file), encode)); StringBuilder sb = new StringBuilder(); for (String line = null; (line = reader.readLine()) != null;) { sb.append(line + "\n"); } reader.close(); textArea.setText(textArea.getText() + "\n" + sb); } catch (IOException e) { JCommonUtil.handleException(e); } } }); } { ComboBoxModel openUnknowFilecharSetModel = new DefaultComboBoxModel( new String[] { "BIG5", "UTF8" }); openUnknowFilecharSet = new JComboBox(); jPanel2.add(openUnknowFilecharSet); openUnknowFilecharSet.setModel(openUnknowFilecharSetModel); openUnknowFilecharSet.setPreferredSize(new java.awt.Dimension(73, 24)); } { appendTextAreaToProps = new JButton(); jPanel2.add(appendTextAreaToProps); appendTextAreaToProps.setText("append textarea to properties"); appendTextAreaToProps.setPreferredSize(new java.awt.Dimension(227, 30)); appendTextAreaToProps.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (StringUtils.isBlank(textArea.getText())) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("textArea is empty", "ERROR"); return; } try { BufferedReader reader = new BufferedReader( new StringReader(textArea.getText())); int pos = -1; String key = null; String value = null; for (String line = null; (line = reader.readLine()) != null;) { if ((pos = line.lastIndexOf("=")) != -1) { key = line.substring(0, pos); value = line.substring(pos + 1); props.put(key, value); } } reader.close(); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("append success!", "SUCCESS"); reloadPropertiesTable(); } catch (IOException e) { JCommonUtil.handleException(e); } } }); } } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("props edit", null, jPanel3, null); { jScrollPane1 = new JScrollPane(); jPanel3.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(629, 361)); { TableModel propsTableModel = new DefaultTableModel(); propsTable = new JTable(); jScrollPane1.setViewportView(propsTable); propsTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { if (propsTable.getRowCount() == 0) { return; } int rowPos = JTableUtil.newInstance(propsTable).getSelectedRow(); Object key = propsTable.getValueAt(rowPos, 0); Object value = propsTable.getValueAt(rowPos, 1); JMenuItem insertRowItem = JTableUtil.newInstance(propsTable) .jMenuItem_addRow(false, null); insertRowItem.setText("inert row..."); String rowInfo = "delete row : [" + key + "] = [" + value + "]"; JMenuItem delRowItem = JTableUtil.newInstance(propsTable) .jMenuItem_removeRow("are you sure remove row : \n" + rowInfo); delRowItem.setText(rowInfo); JPopupMenuUtil.newInstance(propsTable).applyEvent(evt) .addJMenuItem(insertRowItem, delRowItem).show(); } }); propsTable.setModel(propsTableModel); JTableUtil.defaultSetting(propsTable); } } { jPanel4 = new JPanel(); jPanel3.add(jPanel4, BorderLayout.SOUTH); jPanel4.setPreferredSize(new java.awt.Dimension(629, 45)); { clearProps = new JButton(); jPanel4.add(clearProps); clearProps.setText("clear properties"); clearProps.setPreferredSize(new java.awt.Dimension(182, 36)); clearProps.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { props.clear(); reloadPropertiesTable(); } }); } { savePropsToFile = new JButton(); jPanel4.add(savePropsToFile); savePropsToFile.setText("save properties to file"); savePropsToFile.setPreferredSize(new java.awt.Dimension(182, 36)); savePropsToFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectFileOnly().showSaveDialog() .getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!", "ERROR"); return; } try { props.clear(); DefaultTableModel model = (DefaultTableModel) propsTable.getModel(); Object key = null; Object value = null; for (int ii = 0; ii < model.getRowCount(); ii++) { key = model.getValueAt(ii, 0); value = model.getValueAt(ii, 1); props.put(key, value); } props.store(new FileOutputStream(file), SaveFileToPropertiesUI.class.getSimpleName()); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("save completed!\n" + file, "SUCCESS"); } catch (IOException e) { JCommonUtil.handleException(e); } } }); } } } } pack(); this.setSize(798, 505); } catch (Exception e) { e.printStackTrace(); } }
From source file:gtu._work.ui.EstoreCodeGenerateUI.java
private void initGUI() { try {//from w w w .j av a 2 s . com BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.setPreferredSize(new java.awt.Dimension(717, 582)); { jPanel1 = new JPanel(); GridLayout jPanel1Layout = new GridLayout(15, 1); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("", null, jPanel1, null); { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("\u985e\u5225\u540d\u7a31"); } { classNameText = new JTextField(); jPanel1.add(classNameText); } { jLabel6 = new JLabel(); jPanel1.add(jLabel6); jLabel6.setText("package\u4e2d\u9593\u540d"); } { packageMiddleNameText = new JTextField(); jPanel1.add(packageMiddleNameText); } { jLabel2 = new JLabel(); jPanel1.add(jLabel2); jLabel2.setText("jsp\u8def\u5f91"); } { jspPathText = new JTextField(); jPanel1.add(jspPathText); jspPathText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { String xmlConfigMessage = xmlConfigArea.getText(); if (StringUtils.isBlank(xmlConfigMessage)) { return; } StringBuilder sb = new StringBuilder(); String actionClassPath = jspPathText.getText(); actionClassPath = actionClassPath.replaceFirst("/src/main/webapp", ""); Pattern pattern = Pattern.compile("value=\"[\\w\\/]+\\.jsp\""); Matcher matcher = null; BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage)); for (String line = null; (line = reader.readLine()) != null;) { matcher = pattern.matcher(line); if (matcher.find()) { StringBuffer sb2 = new StringBuffer(); matcher.appendReplacement(sb2, "value=\"" + actionClassPath + "\""); matcher.appendTail(sb2); sb.append(sb2 + "\n"); } else { sb.append(line + "\n"); } } xmlConfigArea.setText(sb.toString()); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { jLabel3 = new JLabel(); jPanel1.add(jLabel3); jLabel3.setText("action\u8def\u5f91"); } { actionPathText = new JTextField(); jPanel1.add(actionPathText); actionPathText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { String xmlConfigMessage = xmlConfigArea.getText(); if (StringUtils.isBlank(xmlConfigMessage)) { return; } StringBuilder sb = new StringBuilder(); String actionClassPath = actionPathText.getText(); System.out.println(actionClassPath); actionClassPath = actionClassPath.replaceAll("/src/main/java/", "") .replace('/', '.').replaceAll(".java", ""); Pattern pattern = Pattern.compile("class=\"com\\.sti\\.[\\w\\.]+Action\""); Matcher matcher = null; BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage)); for (String line = null; (line = reader.readLine()) != null;) { matcher = pattern.matcher(line); if (matcher.find()) { StringBuffer sb2 = new StringBuffer(); matcher.appendReplacement(sb2, "class=\"" + actionClassPath + "\""); matcher.appendTail(sb2); sb.append(sb2 + "\n"); } else { sb.append(line + "\n"); } } xmlConfigArea.setText(sb.toString()); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { jLabel4 = new JLabel(); jPanel1.add(jLabel4); jLabel4.setText("service interface\u8def\u5f91"); } { serviceInterfaceText = new JTextField(); jPanel1.add(serviceInterfaceText); } { jLabel5 = new JLabel(); jPanel1.add(jLabel5); jLabel5.setText("service Impl\u8def\u5f91"); } { serviceImplText = new JTextField(); jPanel1.add(serviceImplText); serviceImplText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { String xmlConfigMessage = xmlConfigArea.getText(); if (StringUtils.isBlank(xmlConfigMessage)) { return; } StringBuilder sb = new StringBuilder(); String actionClassPath = serviceImplText.getText(); actionClassPath = actionClassPath.replaceFirst("/src/main/java/", "") .replaceAll(".java", "").replace('/', '.'); Pattern pattern = Pattern.compile("class=\"com.sti[\\w\\.]+ServiceImpl\""); Matcher matcher = null; BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage)); for (String line = null; (line = reader.readLine()) != null;) { matcher = pattern.matcher(line); if (matcher.find()) { StringBuffer sb2 = new StringBuffer(); matcher.appendReplacement(sb2, "class=\"" + actionClassPath + "\""); matcher.appendTail(sb2); sb.append(sb2 + "\n"); } else { sb.append(line + "\n"); } } xmlConfigArea.setText(sb.toString()); } catch (Exception e) { JCommonUtil.handleException(e); } } }); } { updateBtn = new JButton(); jPanel1.add(updateBtn); updateBtn.setText("\u66f4\u65b0"); updateBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { updateBtnActionPerformed(evt); } }); } { makeFileBtn = new JButton(); jPanel1.add(makeFileBtn); makeFileBtn.setText("\u7522\u751f\u6a94\u6848"); makeFileBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { makeFileBtnActionPerformed(evt); } catch (IOException e) { JCommonUtil.handleException(e); } } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("xml", null, jPanel2, null); { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); { xmlConfigArea = new JTextArea(); jScrollPane1.setViewportView(xmlConfigArea); } } } } pack(); this.setSize(733, 525); } catch (Exception e) { e.printStackTrace(); } }
From source file:edu.ku.brc.specify.tasks.subpane.security.UserAgentVSQBldr.java
/** * @param dataMap/*from w w w.j a v a2s.c o m*/ * @param fieldNames * @return */ @Override public String buildSQL(final Map<String, Object> dataMap, final List<String> fieldNames) { Vector<Object> disciplineIds = BasicSQLUtils .querySingleCol("SELECT DisciplineID FROM discipline ORDER BY Name"); if (disciplineIds.size() > 1) { Vector<Object> divisionNames = BasicSQLUtils .querySingleCol("SELECT Name FROM discipline ORDER BY Name"); ToggleButtonChooserDlg<Object> divDlg = new ToggleButtonChooserDlg<Object>((Dialog) null, UIRegistry.getResourceString("SEC_PK_SRCH"), divisionNames, ToggleButtonChooserPanel.Type.RadioButton); divDlg.setUseScrollPane(true); divDlg.createUI(); divDlg.getCancelBtn().setVisible(false); divDlg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); UIHelper.centerAndShow(divDlg); int inx = divisionNames.indexOf(divDlg.getSelectedObject()); disciplineID = (Integer) disciplineIds.get(inx); } else { disciplineID = (Integer) disciplineIds.get(0); } String searchName = cbx.getSearchName(); if (searchName != null) { esTblInfo = ExpressSearchConfigCache.getTableInfoByName(searchName); if (esTblInfo != null) { String sqlStr = esTblInfo.getViewSql(); return buildSearchString(dataMap, fieldNames, StringUtils.replace(sqlStr, "DSPLNID", disciplineID.toString())); } } return null; }
From source file:gtu._work.ui.RegexCatchReplacer.java
private void initGUI() { try {//from w ww.j a v a2s .co m { } 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); 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(); } }
From source file:gtu._work.ui.DownloadMoveUI.java
private void initGUI() { try {/*w w w .j av a 2 s . c o m*/ configProp = configUtil.loadConfig(); BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { isDeleteBox = new JCheckBox(); jPanel1.add(isDeleteBox); isDeleteBox.setText("\u662f\u5426\u522a\u9664\u642c\u51fa\u7684\u76ee\u9304"); isDeleteBox.setPreferredSize(new java.awt.Dimension(383, 21)); } { jLabel4 = new JLabel(); jPanel1.add(jLabel4); jLabel4.setText("\u4fdd\u7559\u7684\u526f\u6a94\u540d"); } { subFileNameText = new JTextField(); jPanel1.add(subFileNameText); subFileNameText .setText(".avi,.wmv,.mp4,.srt,.sub,.mkv,.rar,.rmvb,.idx,.zip,.7z,.flv,.asf,.ass"); subFileNameText.setPreferredSize(new java.awt.Dimension(304, 24)); if (configProp.containsKey(SUBFILENAME)) { subFileNameText.setText(configProp.get(SUBFILENAME)); } } { jLabel3 = new JLabel(); jPanel1.add(jLabel3); jLabel3.setText("\u7b26\u5408\u7684\u6a94\u6848\u5927\u5c0f(KB)"); } { fileSizeText = new JTextField(); jPanel1.add(fileSizeText); fileSizeText.setText("5000"); fileSizeText.setPreferredSize(new java.awt.Dimension(276, 24)); if (configProp.containsKey(FILESIZE)) { fileSizeText.setText(configProp.get(FILESIZE)); } } { jLabel2 = new JLabel(); jPanel1.add(jLabel2); jLabel2.setText("\u672a\u5b8c\u6210\u526f\u6a94\u540d"); } { unCompleteFileSubNameText = new JTextField(); jPanel1.add(unCompleteFileSubNameText); unCompleteFileSubNameText.setText(".td"); unCompleteFileSubNameText.setPreferredSize(new java.awt.Dimension(315, 24)); if (configProp.containsKey(UNCOMPLETEFILESUBNAME)) { unCompleteFileSubNameText.setText(configProp.get(UNCOMPLETEFILESUBNAME)); } } { jLabel1 = new JLabel(); jPanel1.add(jLabel1); jLabel1.setText("\u4e0b\u8f09\u76ee\u9304"); } { downloadDirText = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(downloadDirText, true); jPanel1.add(downloadDirText); downloadDirText.setText("D:/TDDOWNLOAD"); downloadDirText.setPreferredSize(new java.awt.Dimension(328, 24)); if (configProp.containsKey(DOWNLOADDIR)) { downloadDirText.setText(configProp.get(DOWNLOADDIR)); } } { executeBtn = new JButton(); jPanel1.add(executeBtn); executeBtn.setText("\u57f7\u884c"); { newConfigBtn = new JButton(""); newConfigBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { configUtil.next(); configProp = configUtil.loadConfig(); if (configProp.containsKey(SUBFILENAME)) { subFileNameText.setText(configProp.get(SUBFILENAME)); } if (configProp.containsKey(FILESIZE)) { fileSizeText.setText(configProp.get(FILESIZE)); } if (configProp.containsKey(UNCOMPLETEFILESUBNAME)) { unCompleteFileSubNameText.setText(configProp.get(UNCOMPLETEFILESUBNAME)); } if (configProp.containsKey(DOWNLOADDIR)) { downloadDirText.setText(configProp.get(DOWNLOADDIR)); } } }); jPanel1.add(newConfigBtn); } executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnAction(); saveConfig(); } }); } } { 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(411, 262)); { logArea = new JTextArea(); jScrollPane1.setViewportView(logArea); } } } } pack(); this.setSize(432, 329); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:net.pandoragames.far.ui.swing.dialog.SaveFormDialog.java
private void init(SwingConfig config) { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel basePanel = new JPanel(); basePanel.setBorder(BorderFactory.createEmptyBorder(SwingConfig.PADDING * 2, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING)); basePanel.setLayout(new BorderLayout()); registerCloseWindowKeyListener(basePanel); this.add(basePanel); MessageLabel errorLabel = new MessageLabel(); basePanel.add(errorLabel, BorderLayout.NORTH); messageBox = errorLabel;/* w ww . j a va 2 s . c om*/ JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); JLabel titleLabel = new JLabel(localizer.localize("label.name")); titleLabel.setAlignmentX(0); centerPanel.add(titleLabel); textbox = new JTextField(); textbox.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH, config.getStandardComponentHight())); textbox.setAlignmentX(0); registerEnterKeyListener(textbox, saveAction); centerPanel.add(textbox); basePanel.add(centerPanel, BorderLayout.CENTER); JPanel buttonPannel = new JPanel(); buttonPannel.setLayout(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton(localizer.localize("button.save")); okButton.addActionListener(saveAction); JButton cancelButton = new JButton(localizer.localize("button.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent eve) { SaveFormDialog.this.dispose(); } }); buttonPannel.add(okButton); buttonPannel.add(cancelButton); registerCloseWindowKeyListener(buttonPannel); this.add(buttonPannel, BorderLayout.SOUTH); }
From source file:gtu._work.ui.SqlCreaterUI.java
private void initGUI() { try {//from w ww . j a 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(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { jPanel2 = new JPanel(); jPanel1.add(jPanel2, BorderLayout.NORTH); jPanel2.setPreferredSize(new java.awt.Dimension(582, 112)); { jLabel1 = new JLabel(); jPanel2.add(jLabel1); jLabel1.setText("SQL"); } { JScrollPane jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2); jScrollPane2.setPreferredSize(new java.awt.Dimension(524, 57)); { sqlArea = new JTextArea(); jScrollPane2.setViewportView(sqlArea); } } { jLabel2 = new JLabel(); jPanel2.add(jLabel2); jLabel2.setText("\u4f86\u6e90\u6a94\u8def\u5f91"); } { excelFilePathText = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(excelFilePathText, false); jPanel2.add(excelFilePathText); excelFilePathText.setPreferredSize(new java.awt.Dimension(455, 22)); } } { executeBtn = new JButton(); jPanel1.add(executeBtn, BorderLayout.SOUTH); executeBtn.setText("\u7522\u751f"); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnPreformed(); } }); } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(582, 221)); { JScrollPane jScrollPane3 = new JScrollPane(); jScrollPane1.setViewportView(jScrollPane3); { logArea = new JTextArea(); jScrollPane3.setViewportView(logArea); } } } } { jPanel3 = new JPanel(); FlowLayout jPanel3Layout = new FlowLayout(); jTabbedPane1.addTab("jPanel3", null, jPanel3, null); jPanel3.setLayout(jPanel3Layout); { jLabel4 = new JLabel(); jPanel3.add(jLabel4); jLabel4.setText("Table\u540d\u7a31"); } { tableNameText = new JTextField(); jPanel3.add(tableNameText); tableNameText.setPreferredSize(new java.awt.Dimension(463, 23)); } { jLabel3 = new JLabel(); jPanel3.add(jLabel3); jLabel3.setText("\u4f86\u6e90\u6a94\u8def\u5f91"); } { excelFilePathText2 = new JTextField(); JCommonUtil.jTextFieldSetFilePathMouseEvent(excelFilePathText2, false); jPanel3.add(excelFilePathText2); excelFilePathText2.setPreferredSize(new java.awt.Dimension(455, 22)); } { firstRowMakeInsertSqlBtn = new JButton(); jPanel3.add(firstRowMakeInsertSqlBtn); firstRowMakeInsertSqlBtn.setText( "\u4ee5\u7b2c\u4e00\u5217\u70ba\u6b04\u4f4d\u540d\u7a31\u7522\u751fInsert SQL"); firstRowMakeInsertSqlBtn.setPreferredSize(new java.awt.Dimension(251, 22)); firstRowMakeInsertSqlBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { firstRowMakeInsertSqlBtn(evt); } }); } } } pack(); this.setSize(595, 409); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } }
From source file:gtu._work.ui.ObnfRepairDBUI.java
private void initGUI() { try {//from w ww . ja v a 2 s . co m 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:lisong_mechlab.view.graphs.DamageGraph.java
/** * Creates and displays the {@link DamageGraph}. * //from www.j a va 2s. co m * @param aLoadout * Which load out the diagram is for. * @param anXbar * A {@link MessageXBar} to listen for changes to the loadout on. * @param aMaxSustainedDpsMetric * A {@link MaxSustainedDPS} instance to use in calculation. */ public DamageGraph(LoadoutBase<?> aLoadout, MessageXBar anXbar, MaxSustainedDPS aMaxSustainedDpsMetric) { super("Max Sustained DPS over range for " + aLoadout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); anXbar.attach(this); loadout = aLoadout; maxSustainedDPS = aMaxSustainedDpsMetric; chartPanel = new ChartPanel(makechart()); setContentPane(chartPanel); chartPanel.getChart().getLegend().setHorizontalAlignment(HorizontalAlignment.RIGHT); chartPanel.getChart().getLegend().setVerticalAlignment(VerticalAlignment.TOP); LegendTitle legendTitle = chartPanel.getChart().getLegend(); XYTitleAnnotation titleAnnotation = new XYTitleAnnotation(0.98, 0.98, legendTitle, RectangleAnchor.TOP_RIGHT); titleAnnotation.setMaxWidth(0.4); ((XYPlot) (chartPanel.getChart().getPlot())).addAnnotation(titleAnnotation); chartPanel.getChart().removeLegend(); chartPanel.setLayout(new OverlayLayout(chartPanel)); JButton button = new JButton( new OpenHelp("What is this?", "Max-sustained-dps-graph", KeyStroke.getKeyStroke('w'))); button.setMargin(new Insets(10, 10, 10, 10)); button.setFocusable(false); button.setAlignmentX(Component.RIGHT_ALIGNMENT); button.setAlignmentY(Component.BOTTOM_ALIGNMENT); chartPanel.add(button); setIconImage(ProgramInit.programIcon); setSize(800, 600); setVisible(true); }