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:gtu.log.finder.ExceptionLogFinderUI.java
private void initGUI() { try {// www .j a v a 2s . co m JCommonUtil.defaultLookAndFeel(); 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("?log", null, jPanel1, null); { jPanel4 = new JPanel(); jPanel1.add(jPanel4, BorderLayout.NORTH); jPanel4.setPreferredSize(new java.awt.Dimension(689, 115)); { isExceptionLogChkBox = new JCheckBox(); jPanel4.add(isExceptionLogChkBox); isExceptionLogChkBox.setText("\u53ea\u627e\u932f\u8aa4"); } { jLabel1 = new JLabel(); jPanel4.add(jLabel1); jLabel1.setText("\u8cbc\u4e0alog\u6a94\u8def\u5f91"); } { srcFilePathText = new JTextField(); jPanel4.add(srcFilePathText); srcFilePathText.setPreferredSize(new java.awt.Dimension(292, 22)); srcFilePathText.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { srcFilePathTextSetFileAction(evt); } }); } { jLabel3 = new JLabel(); jPanel4.add(jLabel3); jLabel3.setText("\u524d\u7f6e\u884c\u6578"); } { preLineText = new JTextField(); jPanel4.add(preLineText); preLineText.setText("5"); preLineText.setPreferredSize(new java.awt.Dimension(33, 22)); } { executeBtn = new JButton(); jPanel4.add(executeBtn); executeBtn.setText("\u57f7\u884c\u89e3\u6790"); executeBtn.setPreferredSize(new java.awt.Dimension(107, 22)); executeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { executeBtnAction(); } }); } { jLabel4 = new JLabel(); jPanel4.add(jLabel4); jLabel4.setText("\u76f4\u63a5\u8a2d\u5b9a\u89e3\u6790\u6a94\u8def\u5f91"); jLabel4.setPreferredSize(new java.awt.Dimension(119, 15)); } { setParseFileText = new JTextField(); jPanel4.add(setParseFileText); setParseFileText.setPreferredSize(new java.awt.Dimension(507, 22)); setParseFileText.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { setParseFileBtnAction(evt); } }); } { jLabel2 = new JLabel(); jPanel4.add(jLabel2); jLabel2.setText("\u641c\u5c0b\u95dc\u9375\u5b57"); } { searchText = new JTextField(); jPanel4.add(searchText); searchText.setPreferredSize(new java.awt.Dimension(355, 22)); } { ignoreCaseCheckBox = new JCheckBox(); jPanel4.add(ignoreCaseCheckBox); ignoreCaseCheckBox.setText("\u7121\u8996\u5927\u5c0f\u5beb"); ignoreCaseCheckBox.setSelected(true); } { searchTextBtn = new JButton(); jPanel4.add(searchTextBtn); searchTextBtn.setText("?"); searchTextBtn.setPreferredSize(new java.awt.Dimension(118, 22)); searchTextBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { searchTextBtnAction(); } }); } { jLabel5 = new JLabel(); jPanel4.add(jLabel5); jLabel5.setText( "\u4ee5\u958b\u59cb\u7d50\u675f\u95dc\u9375\u5b57\u89e3\u6790\u6587\u4ef6"); jLabel5.setPreferredSize(new java.awt.Dimension(155, 15)); } { startStrText = new JTextField(); jPanel4.add(startStrText); startStrText.setPreferredSize(new java.awt.Dimension(229, 22)); } { endStrText = new JTextField(); jPanel4.add(endStrText); endStrText.setPreferredSize(new java.awt.Dimension(244, 22)); } } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(689, 391)); { DefaultListModel searchMatchListModel = new DefaultListModel(); searchMatchList = new JList(); jScrollPane1.setViewportView(searchMatchList); searchMatchList.setModel(searchMatchListModel); searchMatchList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { searchMatchListMouseAction(evt); } }); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("", null, jPanel2, null); { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(689, 484)); { logDetailTextArea = new JTextArea(); jScrollPane2.setViewportView(logDetailTextArea); } } } } pack(); this.setSize(702, 538); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.ServerPropertiesWindow.java
public ServerPropertiesWindow(final GUI gui, final Collection<Server> selectedServers) { super(gui, true); setLayout(new BorderLayout()); setSize(550, 400);/* ww w. ja va 2 s . co m*/ if (selectedServers.size() > 1) { setTitle("Server Properties - Scarlet Nebula"); } else { setTitle(selectedServers.iterator().next().getFriendlyName() + " Properties - Scarlet Nebula"); } createOverviewPanel(selectedServers); add(overviewTab, BorderLayout.CENTER); add(getBottomPanel(), BorderLayout.SOUTH); updateOverviewTab(selectedServers); setLocationRelativeTo(gui); setLocationByPlatform(true); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setVisible(true); }
From source file:lisong_mechlab.view.graphs.DpsGraph.java
/** * Creates and displays the {@link DpsGraph}. * //from w w w. j a v a2 s.c o m * @param aLoadout * Which load out the diagram is for. * @param aXbar * A {@link MessageXBar} to listen for changes to the loadout on. */ public DpsGraph(LoadoutBase<?> aLoadout, MessageXBar aXbar) { super("Max DPS over range for " + aLoadout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); aXbar.attach(this); loadout = aLoadout; chartPanel = new ChartPanel(makechart()); setContentPane(chartPanel); setIconImage(ProgramInit.programIcon); setSize(800, 600); setVisible(true); }
From source file:gtu._work.ui.RegexCatchReplacer_Ebao.java
private void initGUI() { try {//from w w w. j a va 2 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(); } }
From source file:com.nvinayshetty.DTOnator.Ui.InputWindow.java
public InputWindow(PsiClass mClass) { this.mClass = mClass; project = mClass.getProject();//from ww w . ja va 2s . c o m mFile = mClass.getContainingFile(); setContentPane(contentPane); inputFeedText.getRootPane().setSize(750, 400); setSize(1000, 600); setTitle("Generate DTO"); getRootPane().setDefaultButton(buttonOk); initButtons(); initListeners(); setDefaultConditions(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); }
From source file:gtu._work.ui.RegexDirReplacer.java
private void initGUI() { try {//from w ww . j av a 2 s. c o 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); { ListModel srcListModel = new DefaultListModel(); srcList = new JList(); jScrollPane1.setViewportView(srcList); srcList.setModel(srcListModel); { panel = new JPanel(); jScrollPane1.setRowHeaderView(panel); panel.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); { childrenDirChkbox = new JCheckBox("??"); childrenDirChkbox.setSelected(true); panel.add(childrenDirChkbox, "1, 1"); } { subFileNameText = new JTextField(); panel.add(subFileNameText, "1, 2, fill, default"); subFileNameText.setColumns(10); subFileNameText.setText("(txt|java)"); } { replaceOldFileChkbox = new JCheckBox(""); replaceOldFileChkbox.setSelected(true); panel.add(replaceOldFileChkbox, "1, 3"); } { charsetText = new JTextField(); panel.add(charsetText, "1, 5, fill, default"); charsetText.setColumns(10); charsetText.setText("UTF8"); } } srcList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JListUtil.newInstance(srcList).defaultMouseClickOpenFile(evt); JPopupMenuUtil.newInstance(srcList).applyEvent(evt)// .addJMenuItem("load files from clipboard", new ActionListener() { public void actionPerformed(ActionEvent arg0) { String content = ClipboardUtil.getInstance().getContents(); DefaultListModel model = (DefaultListModel) srcList.getModel(); StringTokenizer tok = new StringTokenizer(content, "\t\n\r\f", false); for (; tok.hasMoreElements();) { String val = ((String) tok.nextElement()).trim(); model.addElement(new File(val)); } } }).show(); } }); srcList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(srcList).defaultJListKeyPressed(evt); } }); } } { addDirFiles = new JButton(); jPanel1.add(addDirFiles, BorderLayout.NORTH); addDirFiles.setText("add dir files"); addDirFiles.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null || !file.isDirectory()) { return; } List<File> fileLst = new ArrayList<File>(); String subName = StringUtils.trimToEmpty(subFileNameText.getText()); if (StringUtils.isBlank(subName)) { subName = ".*"; } String patternStr = ".*\\." + subName; if (childrenDirChkbox.isSelected()) { FileUtil.searchFileMatchs(file, patternStr, fileLst); } else { for (File f : file.listFiles()) { if (f.isFile() && f.getName().matches(patternStr)) { fileLst.add(f); } } } DefaultListModel model = new DefaultListModel(); for (File f : fileLst) { model.addElement(f); } srcList.setModel(model); } }); } } { 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); { ListModel newRepListModel = new DefaultListModel(); newRepList = new JList(); jScrollPane2.setViewportView(newRepList); newRepList.setModel(newRepListModel); newRepList.addMouseListener(new MouseAdapter() { static final String tortoiseMergeExe = "TortoiseMerge.exe"; static final String commandFormat = "cmd /c call \"%s\" /base:\"%s\" /theirs:\"%s\""; public void mouseClicked(MouseEvent evt) { if (!JListUtil.newInstance(newRepList).isCorrectMouseClick(evt)) { return; } OldNewFile oldNewFile = (OldNewFile) JListUtil .getLeadSelectionObject(newRepList); String base = oldNewFile.newFile.getAbsolutePath(); String theirs = oldNewFile.oldFile.getAbsolutePath(); String command = String.format(commandFormat, tortoiseMergeExe, base, theirs); System.out.println(command); try { Runtime.getRuntime().exec(command); } catch (IOException e) { JCommonUtil.handleException(e); } } }); newRepList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { Object[] objects = (Object[]) newRepList.getSelectedValues(); if (objects == null || objects.length == 0) { return; } DefaultListModel model = (DefaultListModel) newRepList.getModel(); int lastIndex = model.getSize() - 1; Object swap = null; StringBuilder dsb = new StringBuilder(); for (Object current : objects) { int index = model.indexOf(current); switch (evt.getKeyCode()) { case 38:// up if (index != 0) { swap = model.getElementAt(index - 1); model.setElementAt(swap, index); model.setElementAt(current, index - 1); } break; case 40:// down if (index != lastIndex) { swap = model.getElementAt(index + 1); model.setElementAt(swap, index); model.setElementAt(current, index + 1); } break; case 127:// del OldNewFile current_ = (OldNewFile) current; dsb.append(current_.newFile.getName() + "\t" + (current_.newFile.delete() ? "T" : "F") + "\n"); current_.newFile.delete(); model.removeElement(current); } } if (dsb.length() > 0) { JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("del result!\n" + dsb, "DELETE"); } } }); } } { replaceOrignFile = new JButton(); jPanel4.add(replaceOrignFile, BorderLayout.SOUTH); replaceOrignFile.setText("replace orign file"); replaceOrignFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { DefaultListModel model = (DefaultListModel) newRepList.getModel(); StringBuilder sb = new StringBuilder(); for (int ii = 0; ii < model.size(); ii++) { OldNewFile file = (OldNewFile) model.getElementAt(ii); boolean delSuccess = false; boolean renameSuccess = false; if (delSuccess = file.oldFile.delete()) { renameSuccess = file.newFile.renameTo(file.oldFile); } sb.append(file.oldFile.getName() + " del:" + (delSuccess ? "T" : "F") + " rename:" + (renameSuccess ? "T" : "F") + "\n"); } JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog(sb, getTitle()); } }); } } { 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(); reloadTemplateList(); jScrollPane3.setViewportView(templateList); 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); } }); } } { scheduleExecute = new JButton(); jPanel5.add(scheduleExecute, BorderLayout.SOUTH); scheduleExecute.setText("schedule execute"); scheduleExecute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { scheduleExecuteActionPerformed(evt); } }); } } } this.setSize(512, 350); JCommonUtil.setFontAll(this.getRootPane()); 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:genlib.output.gui.Graph2D.java
/** * Open a windows with the specified graph inside * * @param title the window-title/*from ww w . jav a 2 s . co m*/ */ private Graph2D(String title) { super(title); //we don't want the whole program to close setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); }
From source file:esmska.gui.AboutFrame.java
/** This method is called from within the constructor to * initialize the form.//from ww w .j a va2 s .co m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new JLabel(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); creditsButton = new JButton(); closeButton = new JButton(); licenseButton = new JButton(); jLabel5 = new JLabel(); jLabel4 = new JLabel(); jLabel6 = new JLabel(); jLabel7 = new JLabel(); jLabel8 = new JLabel(); homeHyperlink = new JXHyperlink(); supportHyperlink = new JXHyperlink(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ResourceBundle bundle = ResourceBundle.getBundle("esmska/resources/l10n"); // NOI18N setTitle(bundle.getString("AboutFrame.title")); // NOI18N setLocationByPlatform(true); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/esmska.png"))); // NOI18N jLabel1.setFocusable(false); jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | Font.BOLD, jLabel2.getFont().getSize() + 22)); jLabel2.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel2, "Esmska " + config.getLatestVersion()); jLabel2.setFocusable(false); jLabel3.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel3, bundle.getString("AboutFrame.jLabel3.text")); // NOI18N jLabel3.setFocusable(false); creditsButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/about-22.png"))); // NOI18N Mnemonics.setLocalizedText(creditsButton, bundle.getString("AboutFrame.creditsButton.text")); creditsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { creditsButtonActionPerformed(evt); } }); closeButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/close-22.png"))); // NOI18N Mnemonics.setLocalizedText(closeButton, bundle.getString("Close_")); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); Mnemonics.setLocalizedText(licenseButton, bundle.getString("AboutFrame.licenseButton.text")); licenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { licenseButtonActionPerformed(evt); } }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getSize() - 2f)); jLabel5.setHorizontalAlignment(SwingConstants.CENTER); jLabel5.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/copyleft-12.png"))); // NOI18N Mnemonics.setLocalizedText(jLabel5, bundle.getString("AboutFrame.jLabel5.text")); // NOI18N jLabel5.setFocusable(false); setURI(homeHyperlink, Links.getURI(Links.HOMEPAGE)); Mnemonics.setLocalizedText(homeHyperlink, l10n.getString("AboutFrame.homeHyperlink.text")); homeHyperlink.setToolTipText(l10n.getString("AboutFrame.homeHyperlink.toolTipText")); // NOI18N setURI(supportHyperlink, Links.getURI(Links.DONATE)); Mnemonics.setLocalizedText(supportHyperlink, l10n.getString("AboutFrame.supportHyperlink.text")); supportHyperlink.setToolTipText(l10n.getString("AboutFrame.supportHyperlink.toolTipText")); // NOI18N GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(jLabel5, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(homeHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(supportHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel2, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel1, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(creditsButton) .addPreferredGap(ComponentPlacement.RELATED).addComponent(licenseButton) .addPreferredGap(ComponentPlacement.RELATED, 151, Short.MAX_VALUE) .addComponent(closeButton)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addGap(108, 108, 108) .addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE) .addGap(138, 138, 138) .addComponent(jLabel7, GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))) .addContainerGap())); layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { closeButton, creditsButton, licenseButton }); layout.setVerticalGroup( layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(18, 18, 18) .addComponent(jLabel2).addPreferredGap(ComponentPlacement.RELATED) .addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jLabel5).addGap(18, 18, 18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel4).addComponent(jLabel6)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel7).addComponent(jLabel8))) .addComponent(homeHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(supportHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 48, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(creditsButton) .addComponent(closeButton).addComponent(licenseButton)) .addContainerGap())); layout.linkSize(SwingConstants.VERTICAL, new Component[] { jLabel4, jLabel6 }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { closeButton, creditsButton, licenseButton }); pack(); }
From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java
private void initGUI() { try {// w ww . j a v a 2s . c o m this.setTitle("Uppercase & Lowercase data"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); AnchorLayout thisLayout = new AnchorLayout(); getContentPane().setLayout(thisLayout); { panelMain = new JPanel(); BorderLayout panelMainLayout = new BorderLayout(); panelMain.setLayout(panelMainLayout); getContentPane().add(panelMain, new AnchorConstraint(0, 1000, 944, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelMain.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelMain.setPreferredSize(new java.awt.Dimension(775, 488)); { splitPaneMain = new JSplitPane(); panelMain.add(splitPaneMain, BorderLayout.CENTER); splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneMain.setDividerLocation(200); { panelColumnLog = new JPanel(); BorderLayout panelLogLayout = new BorderLayout(); panelColumnLog.setLayout(panelLogLayout); splitPaneMain.add(panelColumnLog, JSplitPane.RIGHT); panelColumnLog.setPreferredSize(new java.awt.Dimension(417, 482)); { splitPaneColumnAndLog = new JSplitPane(); panelColumnLog.add(splitPaneColumnAndLog, BorderLayout.CENTER); splitPaneColumnAndLog.setDividerLocation(200); { panelLog = new JPanel(); BorderLayout panelLogLayout1 = new BorderLayout(); panelLog.setLayout(panelLogLayout1); splitPaneColumnAndLog.add(panelLog, JSplitPane.RIGHT); { scrollPaneLog = new JScrollPane(); panelLog.add(scrollPaneLog, BorderLayout.CENTER); { textPaneLog = new JTextPane(); scrollPaneLog.setViewportView(textPaneLog); } } } { panelColumn = new JPanel(); BorderLayout panelColumnLayout = new BorderLayout(); panelColumn.setLayout(panelColumnLayout); splitPaneColumnAndLog.add(panelColumn, JSplitPane.LEFT); { scrollPaneColumn = new JScrollPane(); panelColumn.add(scrollPaneColumn, BorderLayout.CENTER); { tableField = new JTable() { @Override public boolean isCellEditable(int row, int column) { if (getColumnName(column).equals("Check")) { return true; } else { return false; } } @Override public Class<?> getColumnClass(int column) { if (getColumnName(column).equals("Check")) { return Boolean.class; } else { return super.getColumnClass(column); } } }; scrollPaneColumn.setViewportView(tableField); } } } } } { panelPath = new JPanel(); BorderLayout panelPathLayout = new BorderLayout(); panelPath.setLayout(panelPathLayout); splitPaneMain.add(panelPath, JSplitPane.LEFT); panelPath.setPreferredSize(new java.awt.Dimension(769, 316)); { scrollPanePath = new JScrollPane(); panelPath.add(scrollPanePath, BorderLayout.CENTER); { jListPath = new JList(); scrollPanePath.setViewportView(jListPath); jListPath.setFont(new java.awt.Font("Arial", 0, 14)); } } } } } { panelFooter = new JPanel(); AnchorLayout panelFooterLayout = new AnchorLayout(); getContentPane().add(panelFooter, new AnchorConstraint(944, 1000, 1000, 0, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); panelFooter.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); panelFooter.setLayout(panelFooterLayout); panelFooter.setPreferredSize(new java.awt.Dimension(775, 29)); { buttonRun = new JButton(); panelFooter.add(buttonRun, new AnchorConstraint(86, 998, 948, 890, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); buttonRun.setText("Run"); buttonRun.setFont(new java.awt.Font("Arial", 1, 16)); buttonRun.setPreferredSize(new java.awt.Dimension(83, 25)); buttonRun.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { buttonRunActionPerformed(evt); } }); } { checkboxRework = new JCheckBox(); panelFooter.add(checkboxRework, new AnchorConstraint(86, 155, 948, 3, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); checkboxRework.setText("Rework"); checkboxRework.setFont(new java.awt.Font("Arial", 1, 16)); checkboxRework.setForeground(new java.awt.Color(255, 0, 0)); checkboxRework.setPreferredSize(new java.awt.Dimension(118, 25)); checkboxRework.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkboxReworkActionPerformed(evt); } }); } } pack(); this.setSize(783, 551); AppUtility.centerFrame(this); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { exit(); } }); ; } catch (Exception e) { e.printStackTrace(); } }
From source file:de.xplib.xdbm.ui.dialog.FirstStartSetup.java
/** * /*ww w. ja v a 2 s .com*/ */ public FirstStartSetup() { this.config = Config.getInstance("ui"); Locale l = this.config.getLocale(); this.setModal(true); this.setTitle(MessageManager.getText("setup.dialog.title", "text", new Object[0], l)); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.initUI(); this.pack(); this.setResizable(false); }