Example usage for javax.swing WindowConstants DO_NOTHING_ON_CLOSE

List of usage examples for javax.swing WindowConstants DO_NOTHING_ON_CLOSE

Introduction

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

Prototype

int DO_NOTHING_ON_CLOSE

To view the source code for javax.swing WindowConstants DO_NOTHING_ON_CLOSE.

Click Source Link

Document

The do-nothing default window close operation.

Usage

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.pdf.PdfExportPlugin.java

/**
 * Creates the progress dialog that monitors the export process.
 *
 * @return the progress monitor dialog./*  w w  w . j av  a  2 s. c  o m*/
 */
protected ReportProgressDialog createProgressDialog() {
    final ReportProgressDialog progressDialog = super.createProgressDialog();
    progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    progressDialog.setMessage(resources.getString("pdf-export.progressdialog.message")); //$NON-NLS-1$
    progressDialog.pack();
    LibSwingUtil.positionFrameRandomly(progressDialog);
    return progressDialog;
}

From source file:org.piraso.ui.base.ConnectingDialog.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.// w  w  w .  ja v a 2 s .c om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    lblStatus = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    setTitle(org.openide.util.NbBundle.getMessage(ConnectingDialog.class, "ConnectingDialog.title")); // NOI18N
    setResizable(false);

    lblStatus.setForeground(new java.awt.Color(0, 102, 0));
    lblStatus.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/network.png"))); // NOI18N
    lblStatus.setText(
            org.openide.util.NbBundle.getMessage(ConnectingDialog.class, "ConnectingDialog.lblStatus.text")); // NOI18N

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout
            .createSequentialGroup().add(15, 15, 15).add(lblStatus).addContainerGap(126, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout
            .createSequentialGroup().add(14, 14, 14).add(lblStatus).addContainerGap(14, Short.MAX_VALUE)));

    pack();
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

public FindingsListFrame(boolean fullscreen) {
    super();//w  w  w. j a  v  a 2  s  . c  o  m

    this.fullscreen = fullscreen;
    this.nativeFullscrSupported = gd.isFullScreenSupported();

    /*
     * Because of some problems do not use the native fullscreen
     * functionality
     */
    if (UI.getInstance().getPlatform() == UI.Platform.WINDOWS
            || UI.getInstance().getPlatform() == UI.Platform.MAC) {
        nativeFullscrSupported = false;
    }

    UI.getInstance().getProtocolClockWorker().addPropertyChangeListener(evt -> {
        Object value = evt.getNewValue();
        if (value instanceof Integer) {
            updateClock((int) value);
            updateCurrentTime();
        }
    });

    setTitle(translate("List of Findings"));
    setStatusMessage(translate("List of findings successfully loaded."), false);

    getContentPane().setLayout(new BorderLayout());
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    /*
     * Format bottom panel in org tab
     */
    bottomOrgPanel.setBackground(UI.TABLE_ALT_COLOR);
    bottomOrgPanel.setBorder(new EmptyBorder(20, 0, 30, 0));

    GUITools.addComponent(tabPanelOrg, gbl, attPanel, 0, 0, 1, 1, 1.0, 1.0, 0, 0, 20, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelOrg, gbl, new JSeparator(), 0, 1, 1, 1, 1.0, 0.0, 0, 0, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(tabPanelOrg, gbl, bottomOrgPanel, 0, 2, 1, 1, 1.0, 0.0, 0, 0, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);

    createToolBar();

    setLocationToCenter();

    if (fullscreen) {
        setUndecorated(true);

        if (!nativeFullscrSupported) {
            setMinimumSize(Toolkit.getDefaultToolkit().getScreenSize());
            setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
            setSize(Toolkit.getDefaultToolkit().getScreenSize());

            setLocation(0, 0);

            setResizable(false);
            setAlwaysOnTop(true);
        }

        toFront();

        // Dimension screenSize =
        // Toolkit.getDefaultToolkit().getScreenSize();
        // setPreferredSize(screenSize);
    } else {
        setMinimumSize(new Dimension(900, 710));
        setPreferredSize(new Dimension(900, 710));

        pack();
    }

    setExtendedState(Frame.MAXIMIZED_BOTH);

    createHints();

    addWindowListener(new WindowListener() {
        @Override
        public void windowActivated(WindowEvent e) {
        }

        @Override
        public void windowClosed(WindowEvent e) {
        }

        @Override
        public void windowClosing(WindowEvent e) {
            if (StringUtils.isBlank(protCommTxtArea.getText())) {
                currentProt.setComments("");
            }
            GUITools.executeSwingWorker(new ImageEditorWriteWorker(currentProt));
            setVisible(false);
        }

        @Override
        public void windowDeactivated(WindowEvent e) {
        }

        @Override
        public void windowDeiconified(WindowEvent e) {
        }

        @Override
        public void windowIconified(WindowEvent e) {
            if (isFullscreen()) {
                setExtendedState(MAXIMIZED_BOTH);
            }
        }

        @Override
        public void windowOpened(WindowEvent e) {
        }
    });

    GUITools.executeSwingWorker(updateWorker);
}

From source file:org.rvsnoop.ui.RvSnoopApplication.java

@Override
protected void startup() {
    setMainFrame(injector.getInstance(Application.class).getFrame());

    final JFrame frame = getMainFrame();
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(new FrameClosingListener());
    addExitListener(new MaybeExit());

    ApplicationActionMap actionMap = getContext().getActionMap();
    JMenu fileMenu = frame.getJMenuBar().getMenu(0);
    fileMenu.addSeparator();//from  w w  w .ja  va  2  s  .  com
    fileMenu.add(actionMap.get("quit"));

    frame.getJMenuBar().add(createHelpMenu());
    getContext().getResourceMap().injectComponents(frame);

    if (AppHelper.getPlatform() == PlatformType.OS_X) {
        configureMacOsEventHandlers();
    }

    if (initialProjectFile == null) {
        final JFileChooser chooser = new JFileChooser();
        chooser.setFileFilter(new ProjectFileFilter());
        final int option = chooser.showDialog(null, "Open Project");
        initialProjectFile = chooser.getSelectedFile();
        if (JFileChooser.APPROVE_OPTION != option || initialProjectFile == null) {
            exit();
        }

    }
    show(frame);
    injector.getInstance(ProjectService.class).openProject(initialProjectFile);
}

From source file:org.sikuli.ide.SikuliIDE.java

private void initWindowListener() {
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override//  w  w  w .ja  va 2  s  . c  om
        public void windowClosing(WindowEvent e) {
            SikuliIDE.this.quit();
        }
    });
    addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            PreferencesUser.getInstance().setIdeSize(SikuliIDE.this.getSize());
        }

        @Override
        public void componentMoved(ComponentEvent e) {
            PreferencesUser.getInstance().setIdeLocation(SikuliIDE.this.getLocation());
        }
    });
}

From source file:org.spoutcraft.launcher.skin.ConsoleFrame.java

/**
 * Construct the frame.//from  w ww .j a  v a2s  .c o  m
 * 
 * @param numLines number of lines to show at a time
 * @param colorEnabled true to enable a colored console
 * @param trackProc process to track
 * @param killProcess true to kill the process on console close
 */
public ConsoleFrame(int numLines, boolean colorEnabled, final Process trackProc, final boolean killProcess) {
    super("Console");
    this.numLines = numLines;
    this.colorEnabled = colorEnabled;
    this.trackProc = trackProc;

    this.highlightedAttributes = new SimpleAttributeSet();
    StyleConstants.setForeground(highlightedAttributes, Color.BLACK);
    StyleConstants.setBackground(highlightedAttributes, Color.YELLOW);

    this.errorAttributes = new SimpleAttributeSet();
    StyleConstants.setForeground(errorAttributes, new Color(200, 0, 0));
    this.infoAttributes = new SimpleAttributeSet();
    StyleConstants.setForeground(infoAttributes, new Color(200, 0, 0));
    this.debugAttributes = new SimpleAttributeSet();
    StyleConstants.setForeground(debugAttributes, Color.DARK_GRAY);

    setSize(new Dimension(650, 400));
    buildUI();

    Compatibility.setIconImage(this, Toolkit.getDefaultToolkit().getImage(LoginFrame.spoutcraftIcon));

    if (trackProc != null) {
        track(trackProc);
    }

    addMouseListener(this);

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent event) {
            if (trackProc != null && killProcess) {
                trackProc.destroy();
                if (loggerHandler != null) {
                    rootLogger.removeHandler(loggerHandler);
                }
                event.getWindow().dispose();
            }
        }
    });
}

From source file:org.springframework.richclient.application.support.AbstractApplicationWindow.java

protected JFrame createNewWindowControl() {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    WindowAdapter windowCloseHandler = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            close();//from  www  .ja  va  2 s  .c  o  m
        }
    };
    frame.addWindowListener(windowCloseHandler);
    return frame;
}

From source file:org.springframework.richclient.dialog.ApplicationDialog.java

/**
 * Construct the visual dialog frame on which the content needs to be added.
 *//*from www  .j a  v a 2  s  .co m*/
private void constructDialog() {
    if (getParentWindow() instanceof Frame) {
        dialog = new JDialog((Frame) getParentWindow(), getTitle(), modal);
    } else {
        dialog = new JDialog((Dialog) getParentWindow(), getTitle(), modal);
    }

    dialog.getContentPane().setLayout(new BorderLayout());
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    dialog.setResizable(resizable);

    initStandardCommands();
    addCancelByEscapeKey();
}

From source file:org.ut.biolab.medsavant.client.variant.VariantWorker.java

/**
 * Initialise functionality shared by all UpdateWorkers and PublicationWorkers.
 *
 * @param activity "Importing", "Publishing", or "Removing"
 * @param wizard the wizard which is providing the user interface
 * @param progressLabel label which indicates progress activity
 * @param progressBar provides quantitative display of progress
 * @param workButton starts the process and cancels it
 *//*  w w w  .  j a  v a  2s.  c  om*/
VariantWorker(String activity, WizardDialog wizard, JLabel progressLabel, JProgressBar progressBar,
        JButton workButton) {
    super(activity + "Variants");
    this.activity = activity;
    this.wizard = wizard;
    this.progressLabel = progressLabel;
    this.progressBar = progressBar;
    this.workButton = workButton;

    progressLabel.setText(String.format("%s ...", activity));

    // Convert our start button into a cancel button.
    workButton.setText("Cancel");
    if (workButton.getActionListeners().length > 0) {
        workButton.removeActionListener(workButton.getActionListeners()[0]);
    }
    workButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            VariantWorker.this.progressBar.setIndeterminate(true);
            VariantWorker.this.workButton.setText("Cancelling...");
            VariantWorker.this.workButton.setEnabled(false);
            cancel(true);
        }
    });

    workButton.setEnabled(true);
    wizard.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}

From source file:org.ut.biolab.medsavant.client.view.MedSavantFrame.java

private MedSavantFrame() {
    super("");

    MacUtils.makeWindowLeopardStyle(this.getRootPane());
    UIManager.put("Panel.background", new Color(237, 237, 237)); // the above line makes the bg dark, setting back

    setIconImage(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.MENU_USER).getImage());

    setLayout(new BorderLayout());
    setMinimumSize(new Dimension(550, 550));

    view = new StackableJPanelContainer();
    view.setDoubleBuffered(true);/* w  w  w.  jav  a  2  s .  c om*/
    view.setBackground(new Color(217, 222, 229));

    UIManager.put("ToolTip.background", Color.black);
    UIManager.put("ToolTip.foreground", Color.white);
    UIManager.put("ToolTip.border", ViewUtil.getMediumBorder());
    UIManager.put("ToolTip.font", ViewUtil.detailFontBold);
    UIManager.put("Table.gridColor", new Color(250, 250, 250));

    add(view, BorderLayout.CENTER);

    LOG.info("Loading apps...");
    AppController pc = AppController.getInstance();
    pc.loadPlugins(DirectorySettings.getPluginsDirectory());

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            requestClose();
        }
    });
}