Java Code Examples for java.awt.FileDialog#dispose()
The following examples show how to use
java.awt.FileDialog#dispose() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolicyTool.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 2
Source File: PolicyTool.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 3
Source File: PolicyTool.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 4
Source File: PolicyTool.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 5
Source File: PolicyTool.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 6
Source File: PolicyTool.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 7
Source File: PolicyTool.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 8
Source File: PolicyTool.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 9
Source File: PolicyTool.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 10
Source File: PolicyTool.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 11
Source File: PolicyTool.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 12
Source File: PolicyTool.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }
Example 13
Source File: PolicyTool.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * perform SAVE AS */ void displaySaveAsDialog(int nextEvent) { // pop up a dialog box for the user to enter a filename. FileDialog fd = new FileDialog (tw, PolicyTool.getMessage("Save.As"), FileDialog.SAVE); fd.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().setVisible(false); } }); fd.setVisible(true); // see if the user hit cancel if (fd.getFile() == null || fd.getFile().equals("")) return; // get the entered filename File saveAsFile = new File(fd.getDirectory(), fd.getFile()); String filename = saveAsFile.getPath(); fd.dispose(); try { // save the policy entries to a file tool.savePolicy(filename); // display status MessageFormat form = new MessageFormat(PolicyTool.getMessage ("Policy.successfully.written.to.filename")); Object[] source = {filename}; tw.displayStatusDialog(null, form.format(source)); // display the new policy filename JTextField newFilename = (JTextField)tw.getComponent (ToolWindow.MW_FILENAME_TEXTFIELD); newFilename.setText(filename); tw.setVisible(true); // now continue with the originally requested command // (QUIT, NEW, or OPEN) userSaveContinue(tool, tw, this, nextEvent); } catch (FileNotFoundException fnfe) { if (filename == null || filename.equals("")) { tw.displayErrorDialog(null, new FileNotFoundException (PolicyTool.getMessage("null.filename"))); } else { tw.displayErrorDialog(null, fnfe); } } catch (Exception ee) { tw.displayErrorDialog(null, ee); } }