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:edu.ku.brc.specify.plugins.ipadexporter.VerifyCollectionDlg.java

@SuppressWarnings({ "unchecked" })
@Override//w ww. j  a  v  a 2s . c  o  m
public void createUI() {
    loadAndPushResourceBundle(iPadDBExporterPlugin.RESOURCE_NAME);
    setTitle(getResourceString("VERIFY_TITLE"));
    try {
        htmlPane = new JEditorPane("text/html", ""); //$NON-NLS-1$
        final JScrollPane scrollPane = UIHelper.createScrollPane(htmlPane);
        //this.add(scrollPane, BorderLayout.CENTER);
        htmlPane.setEditable(false);

        CellConstraints cc = new CellConstraints();
        PanelBuilder pb = new PanelBuilder(new FormLayout("f:700px:g", "f:500px:g"));
        contentPanel = pb.getPanel();

        pb.add(scrollPane, cc.xy(1, 1));
        pb.setDefaultDialogBorder();

        setOkLabel("Continue");
        setCancelLabel("Close");
        setHelpLabel("To Browser");

        worker = new SwingWorker<Integer, Integer>() {
            @Override
            protected Integer doInBackground() throws Exception {
                processResults();
                return 0;
            }

            @Override
            protected void done() {
                super.done();

                popResourceBundle();
            }
        };
        //addProgressListener(worker);
        worker.execute();

    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        popResourceBundle();
    }

    setSize(800, 650);
    setBounds(0, 0, 650, 650);
    super.createUI();
    okBtn.setEnabled(false);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // Must be called at the end 'createUI'
}

From source file:org.hsh.bfr.db.gui.dbtable.editoren.MyChartDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    splitPane1 = new JSplitPane();
    scrollPane1 = new JScrollPane();
    table1 = new JTable();
    panel1 = new JPanel();
    button1 = new JButton();
    panel2 = new JPanel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("default:grow", "2*(default, $lgap), default"));

    //======== splitPane1 ========
    {/*  www.  j  a  v  a  2  s .  c  o m*/
        splitPane1.setDividerLocation(200);

        //======== scrollPane1 ========
        {
            scrollPane1.setPreferredSize(new Dimension(200, 423));

            //---- table1 ----
            table1.setModel(
                    new DefaultTableModel(
                            new Object[][] { { "3.0", "5" }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null }, },
                            new String[] { "Zeit (h)", "Temperatur" }) {
                        /**
                         * 
                         */
                        private static final long serialVersionUID = 1L;
                        Class<?>[] columnTypes = new Class<?>[] { String.class, String.class };

                        @Override
                        public Class<?> getColumnClass(int columnIndex) {
                            return columnTypes[columnIndex];
                        }
                    });
            {
                TableColumnModel cm = table1.getColumnModel();
                cm.getColumn(0).setPreferredWidth(100);
            }
            scrollPane1.setViewportView(table1);
        }
        splitPane1.setLeftComponent(scrollPane1);

        //======== panel1 ========
        {
            panel1.setLayout(new FormLayout("default:grow", "fill:default:grow"));

            //---- button1 ----
            button1.setText("text");
            panel1.add(button1, cc.xy(1, 1));
        }
        splitPane1.setRightComponent(panel1);
    }
    contentPane.add(splitPane1, cc.xy(1, 1));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("3*(default:grow, $lcgap), default:grow", "default"));
        ((FormLayout) panel2.getLayout()).setColumnGroups(new int[][] { { 1, 3, 5, 7 } });

        //---- button2 ----
        button2.setText("OK");
        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button2ActionPerformed(e);
            }
        });
        panel2.add(button2, cc.xy(3, 1));

        //---- button3 ----
        button3.setText("Abbrechen");
        button3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button3ActionPerformed(e);
            }
        });
        panel2.add(button3, cc.xy(5, 1));

        //---- button4 ----
        button4.setText("Hilfe");
        button4.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button4ActionPerformed(e);
            }
        });
        panel2.add(button4, cc.xy(7, 1));
    }
    contentPane.add(panel2, cc.xy(1, 5));
    setSize(555, 390);
    setLocationRelativeTo(null);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:fll.scheduler.SchedulerUI.java

public SchedulerUI() {
    super(BASE_TITLE);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    _progressDialog = new ProgressDialog(SchedulerUI.this, "Please Wait");
    _progressDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    setJMenuBar(createMenubar());//from ww  w . jav  a  2s . com

    final Container cpane = getContentPane();
    cpane.setLayout(new BorderLayout());

    mTabbedPane = new JTabbedPane();
    cpane.add(mTabbedPane, BorderLayout.CENTER);

    final JPanel scheduleDescriptionPanel = new JPanel(new BorderLayout());
    mTabbedPane.addTab("Description", scheduleDescriptionPanel);

    mDescriptionFilename = new JLabel("");
    scheduleDescriptionPanel.add(createDescriptionToolbar(), BorderLayout.PAGE_START);

    mScheduleDescriptionEditor = new SolverParamsEditor();
    final JScrollPane editorScroller = new JScrollPane(mScheduleDescriptionEditor);
    scheduleDescriptionPanel.add(editorScroller, BorderLayout.CENTER);

    // start out with default values
    mScheduleDescriptionEditor.setParams(new SolverParams());

    final JPanel schedulePanel = new JPanel(new BorderLayout());
    mTabbedPane.addTab("Schedule", schedulePanel);

    mScheduleFilename = new JLabel("");
    schedulePanel.add(createScheduleToolbar(), BorderLayout.PAGE_START);

    mScheduleTable = new JTable();
    mScheduleTable.setAutoCreateRowSorter(true);
    mScheduleTable.setDefaultRenderer(Date.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(String.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(Integer.class, schedTableRenderer);
    mScheduleTable.setDefaultRenderer(Object.class, schedTableRenderer);
    final JScrollPane dataScroller = new JScrollPane(mScheduleTable);

    violationTable = new JTable();
    violationTable.setDefaultRenderer(String.class, violationTableRenderer);
    violationTable.getSelectionModel().addListSelectionListener(violationSelectionListener);
    final JScrollPane violationScroller = new JScrollPane(violationTable);

    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dataScroller, violationScroller);
    schedulePanel.add(splitPane, BorderLayout.CENTER);

    // initial state
    mWriteSchedulesAction.setEnabled(false);
    mDisplayGeneralScheduleAction.setEnabled(false);
    mRunOptimizerAction.setEnabled(false);
    mReloadFileAction.setEnabled(false);

    pack();
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java

/**
 * Constructor. //from   w w w  .  j a  va 2 s  . c om
 */
public ImageFrame(final int mapSize, final WorkbenchPaneSS wbPane, final Workbench workbench,
        final Taskable task, final boolean isReadOnly) {
    this.wbPane = wbPane;
    this.workbench = workbench;

    try {
        this.workbenchTask = (WorkbenchTask) task;
    } catch (ClassCastException e) {
        this.workbenchTask = null;
    }

    this.allowCloseWindow = true;
    this.defaultThumbIcon = IconManager.getIcon("image", IconSize.Std32);

    setIconImage(IconManager.getImage("AppIcon").getImage());

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            if (allowCloseWindow) {
                wbPane.toggleImageFrameVisible();
            }
        }
    });

    Dimension minSize = new Dimension(mapSize, mapSize);
    cardImageLabel.setHorizontalTextPosition(SwingConstants.CENTER);

    PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,p,5px,p,f:p:g"));
    CellConstraints cc = new CellConstraints();

    loadImgBtn = createButton(getResourceString("WB_LOAD_NEW_IMAGE"));

    builder.add(createLabel(getResourceString("WB_NO_IMAGE_ROW"), SwingConstants.CENTER), cc.xy(2, 2));
    builder.add(loadImgBtn, cc.xy(2, 4));
    loadImgBtn.setVisible(!isReadOnly);

    noCardImageMessagePanel = builder.getPanel();
    noCardImageMessagePanel.setPreferredSize(minSize);
    noCardImageMessagePanel.setSize(minSize);

    builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,c:p,f:p:g"));
    builder.add(createLabel(getResourceString("WB_NO_ROW_SELECTED"), SwingConstants.CENTER), cc.xy(2, 2));

    noRowSelectedMessagePanel = builder.getPanel();
    noRowSelectedMessagePanel.setPreferredSize(minSize);
    noRowSelectedMessagePanel.setSize(minSize);

    mainPane = new JPanel(new BorderLayout());
    mainPane.setSize(minSize);
    mainPane.setPreferredSize(minSize);
    mainPane.setMinimumSize(minSize);

    mainPane.add(cardImageLabel, BorderLayout.CENTER);
    scrollPane = new JScrollPane(mainPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    statusBar = new JStatusBar();

    thumbnailer = new ImageThumbnailGenerator();
    thumbnailer.setMaxSize(256, 256);
    thumbnailer.setQuality(1);

    tray = new ThumbnailTray();
    tray.getModel().removeAllElements();
    tray.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }

            setImageIndex(tray.getSelectedIndex());
        }
    });

    JPanel southPanel = new JPanel();
    southPanel.setLayout(new BorderLayout());

    //southPanel.add(indexSlider,BorderLayout.NORTH);
    southPanel.add(tray, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);

    JPanel basePanel = new JPanel();
    basePanel.setLayout(new BorderLayout());
    basePanel.add(scrollPane, BorderLayout.CENTER);
    basePanel.add(southPanel, BorderLayout.SOUTH);

    setContentPane(basePanel);

    JMenuBar menuBar = new JMenuBar();

    String title = "FileMenu";
    String mneu = "FileMneu";
    JMenu fileMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);
    title = "WB_IMPORT_CARDS_TO_DATASET";
    mneu = "WB_IMPORT_CARDS_MNEU";

    if (!isReadOnly) {
        JMenuItem importImagesMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, null);
        importImagesMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {

                importImages();
            }
        });
    }

    /*        title = "ImageFrame.CLOSE";
            mneu = "ImageFrame.CloseMneu";
            closeMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu,  "", true, null);
            closeMI.addActionListener(new ActionListener()
            {
    public void actionPerformed(ActionEvent ae)
    {
        ImageFrame.this.setVisible(false);
    }
            });*/

    title = "ImageFrame.View";
    mneu = "ImageFrame.ViewMneu";
    viewMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);
    reduceMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_REDUCED_SIZE", "ImageFrame.ReducedSizeMneu", "",
            true, null);
    reduceMI.setSelected(true);
    reduceMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (row == null) {
                return;
            }

            // simply 'remember' that we want to show reduced images for this row
            rowToImageSizeHash.put(row.hashCode(), REDUCED_SIZE);
            // then 'reshow' the current image
            showImage();
        }
    });

    origMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_ORIG_SIZE", "ImageFrame.OrigMneu", "", true,
            null);
    origMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (row == null) {
                return;
            }

            // simply 'remember' that we want to show fill size images for this row
            rowToImageSizeHash.put(row.hashCode(), FULL_SIZE);
            // then 'reshow' the current image
            showImage();
        }
    });

    ButtonGroup btnGrp = new ButtonGroup();
    btnGrp.add(reduceMI);
    btnGrp.add(origMI);

    viewMenu.addSeparator();

    alwaysOnTopMI = UIHelper.createCheckBoxMenuItem(viewMenu, "WB_ALWAYS_ON_TOP", null, "", true, null);
    alwaysOnTopMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            ImageFrame.this.setAlwaysOnTop(alwaysOnTopMI.isSelected());
        }
    });

    addPropertyChangeListener("alwaysOnTop", this);

    if (!isReadOnly) {
        ActionListener deleteImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                deleteImage();
            }
        };

        ActionListener replaceImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                replaceImage();
            }
        };

        ActionListener addImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                addImages();
            }
        };

        title = "ImageFrame.Image";
        mneu = "ImageFrame.ImageMneu";
        imageMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);

        title = "WB_ADD_IMG";
        mneu = "WB_ADD_IMG_MNEM";
        addMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, addImg);

        title = "WB_REPLACE_IMG";
        mneu = "WB_REPLACE_IMG_MNEU";
        replaceMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, replaceImg);

        title = "WB_DEL_IMG_LINK";
        mneu = "WB_DEL_IMG_LINK_MNEU";
        deleteMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, deleteImg);

        loadImgBtn.addActionListener(addImg);
    }

    JMenu helpMenu = new JMenu(getResourceString("HELP"));
    menuBar.add(HelpMgr.createHelpMenuItem(helpMenu, getResourceString("WB_IMAGE_WINDOW")));

    enableMenus(false);

    setJMenuBar(menuBar);

    pack();

    HelpMgr.setHelpID(this, "WorkbenchWorkingWithImages");
}

From source file:com.aw.swing.mvp.JDialogView.java

private void initializeDlg() {
    if (pst.isEmbeddedView()) {
        return;/*from w  w w  .  j a va2 s  . com*/
    }
    JDialog dlg = (JDialog) parentContainer;

    dlg.add(viewLayout.mainPanel, BorderLayout.CENTER);

    //        SwingUtils.locateOnScreenCenter(dlg);
    SwingUtils.locateRelativeToMenu(dlg);
    dlg.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    dlg.addWindowListener(new java.awt.event.WindowAdapter() {
        // todo ver cmo se va a hacer esto en la versin Filthy
        public void windowOpened(WindowEvent e) {
            if (pst != null) {
                pst.onWindowsOpened(e);
                pst.onWindowsOpenedInternalOnlyForAWFW(e);
                if (!pst.isReadOnly()) {
                    //                        pst.setFocusToCmpOnWindowOpen();
                    //                        ActionManager.instance().getVisualMgrForActions().repaintMainDisabledActions(pst.getActionRsr());
                } else {
                    pst.configureAsReanOnly();
                    JButton btnCancel = (JButton) pst.getIpView().getComponent("btnCancel");
                    if (btnCancel != null) {
                        btnCancel.requestFocusInWindow();
                    }
                }
            }
        }

        public void windowClosing(WindowEvent e) {
            MsgDisplayer.showMessage("sw.common.closeWindowDisabled");
        }

        public void windowActivated(WindowEvent e) {
            Object oppositeWindow = e.getOppositeWindow();

            if (oppositeWindow instanceof DlgMensaje) {
                logger.debug("Ignoring Windows activated for DlgMensaje");
                return;
            }
            if (oppositeWindow instanceof JDialog) {
                JDialog dlg = (JDialog) oppositeWindow;
                if (MessageDisplayer.GENERIC_MESSAGE_TITLE.equals(dlg.getTitle())) {
                    logger.debug("Ignoring Windows activated for System Msg");
                    return;
                }
            }
            logger.debug("Windows Activated:" + pst);
            AWWindowsManager.instance().setPresenterActivated(pst);
        }
    });
}

From source file:edu.ku.brc.specify.dbsupport.SpecifyDeleteHelper.java

/**
 * @param workerArg//from   ww  w  .j  a va  2s  .  c  o m
 * @param title (already localized)
 * @return a modal dialog showing the progress
 */
public JDialog initProgress(final SwingWorker<?, ?> workerArg, final String title) {
    this.worker = workerArg;

    if (workerArg != null) {
        JDialog dialog = new JDialog((Dialog) null, true);

        titleLbl = new JLabel(title);
        progressBar = new JProgressBar(0, 100);

        CellConstraints cc = new CellConstraints();
        PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "f:p:g,p,4px,p,f:p:g"));

        pb.add(titleLbl, cc.xy(1, 2));
        pb.add(progressBar, cc.xy(1, 4));
        pb.setDefaultDialogBorder();
        dialog.setContentPane(pb.getPanel());

        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        dialog.pack();
        dialog.setSize(500, 150);
        workerArg.addPropertyChangeListener(new SwingWorkerCompletionWaiter(dialog));
        return dialog;
    }
    return null;
}

From source file:de.ailis.xadrian.frames.MainFrame.java

/**
 * Constructor/*from  w  w w .  j a v a 2 s . c  o  m*/
 */
public MainFrame() {
    setTitle(I18N.getString("title"));
    setName("mainFrame");
    setIconImages(Images.LOGOS);

    setPreferredSize(new Dimension(960, 700));
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(final WindowEvent e) {
            exit();
        }
    });

    createStatusBar();
    createMenuBar();
    createToolBar();
    createContent();

    setTransferHandler(this.transferHandler);

    pack();

    Config.restoreWindowState(this);

    this.tabs.requestFocus();
}

From source file:com.freedomotic.jfrontend.MainWindow.java

private void setWindowedMode() {
    this.setVisible(false);
    this.dispose();
    this.setUndecorated(false);
    this.setResizable(true);

    try {/*from   w  w  w  .j a v  a2 s . co  m*/
        this.getContentPane().removeAll();
    } catch (Exception e) {
        LOG.error("Set window mode exception {}", e.getMessage());
    }

    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException ex) {
        LOG.error("Cannot find system look&feel\n", ex.toString());
    } catch (InstantiationException ex) {
        LOG.error("Cannot instantiate system look&feel\n", ex.toString());
    } catch (IllegalAccessException ex) {
        LOG.error("Illegal access to system look&feel\n", ex.toString());
    } catch (UnsupportedLookAndFeelException ex) {
        LOG.error("Unsupported system look&feel\n", ex.toString());
    }

    setDefaultLookAndFeelDecorated(true);
    initComponents();
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    setLayout(new BorderLayout());
    desktopPane = new JDesktopPane();
    lstClients = new PluginJList(this);
    frameClient = new JInternalFrame();
    frameClient.setLayout(new BorderLayout());

    JScrollPane clientScroll = new JScrollPane(lstClients);
    frameClient.add(clientScroll, BorderLayout.CENTER);
    frameClient.setTitle(i18n.msg("loaded_plugins"));
    frameClient.setResizable(true);
    frameClient.setMaximizable(true);
    frameMap = new JInternalFrame();
    setMapTitle("");
    frameMap.setMaximizable(true);
    frameMap.setResizable(true);
    desktopPane.add(frameMap);
    desktopPane.add(frameClient);
    frameClient.moveToFront();
    frameClient.setVisible(auth.isPermitted("plugins:read"));
    desktopPane.moveToFront(this);
    this.getContentPane().add(desktopPane);

    try {
        frameClient.setSelected(true);
    } catch (PropertyVetoException ex) {
        LOG.error(Freedomotic.getStackTraceInfo(ex));
    }

    EnvironmentLogic previousEnv = api.environments().findAll().get(0);

    if (drawer != null) {
        previousEnv = drawer.getCurrEnv();
    }

    initializeRenderer(previousEnv);
    drawer = master.createRenderer(previousEnv);

    if (drawer != null) {
        setDrawer(drawer);
        ResourcesManager.clear();
    } else {
        LOG.error("Unable to create a drawer to render the environment on the desktop frontend");
    }

    this.setTitle("Freedomotic " + Info.getLicense() + " - www.freedomotic.com");
    this.setSize(1100, 700);
    centerFrame(this);
    frameClient.moveToFront();
    frameMap.moveToFront();
    optimizeFramesDimension();
    drawer.repaint();
    lstClients.update();
    frameClient.setVisible(auth.isPermitted("plugins:read"));
    frameMap.setVisible(auth.isPermitted("environments:read"));
    setEditMode(false);
    this.setVisible(true);
    isFullscreen = false;

}

From source file:it.ventuland.ytd.ui.GUIClient.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event dispatch thread.
 *//*from   w ww  .  ja  v  a  2 s  . com*/
private void initializeUI() {
    String lAppName = mAppContext.getString("youtube-downloader.name");
    String lAppVersion = mAppContext.getString("youtube-downloader.version");
    String lAppUrl = mAppContext.getString("youtube-downloader.url");
    String sv = lAppName.concat(" ").concat(lAppVersion).concat(" ").concat(lAppUrl);

    setDefaultLookAndFeelDecorated(false);

    this.setTitle(sv);
    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.addComponentsToPane(this.getContentPane());
    this.pack();
    this.setVisible(true);

    sv = "version: ".concat(lAppVersion).concat(mIsDebug ? " DEBUG " : "");

    sproxy = System.getenv("http_proxy");
    if (sproxy == null) {
        sproxy = "";
    }
    mSaveDirPath = directorytextfield.getText();
}

From source file:jpad.MainEditor.java

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jScrollPane1 = new javax.swing.JScrollPane();
    mainTextArea = new javax.swing.JTextArea();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    openMenuItem = new javax.swing.JMenuItem();
    saveMenuItem = new javax.swing.JMenuItem();
    saveAsMenuItem = new javax.swing.JMenuItem();
    seperator_OpenAndExit = new javax.swing.JPopupMenu.Separator();
    exitMenuItem = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    textWrapMenuItem = new javax.swing.JCheckBoxMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    setTitle("JPad");
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);/*  www.  j a  v a2 s . c o m*/
        }
    });

    mainTextArea.setColumns(20);
    mainTextArea.setLineWrap(true);
    mainTextArea.setRows(5);
    jScrollPane1.setViewportView(mainTextArea);
    textChanged();

    jMenu1.setText("File");

    openMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    openMenuItem.setText("Open...");
    openMenuItem.setToolTipText("Open a file");
    openMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            openMenuItemActionPerformed(evt);
        }
    });
    jMenu1.add(openMenuItem);

    saveMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    saveMenuItem.setText("Save...");
    saveMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveMenuItemActionPerformed(evt);
        }
    });
    jMenu1.add(saveMenuItem);

    saveAsMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
            (java.awt.event.InputEvent.SHIFT_MASK | (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()))));
    saveAsMenuItem.setText("Save As...");
    saveAsMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
        }
    });
    jMenu1.add(saveAsMenuItem);
    jMenu1.add(seperator_OpenAndExit);

    exitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q,
            java.awt.event.InputEvent.CTRL_MASK));
    exitMenuItem.setText("Exit");
    exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitMenuItemActionPerformed(evt);
        }
    });
    jMenu1.add(exitMenuItem);
    if (_isOSX) {
        exitMenuItem.getParent().remove(exitMenuItem);
    }

    jMenuBar1.add(jMenu1);

    jMenu2.setText("Edit");

    textWrapMenuItem.setText("Text Wrap");
    textWrapMenuItem.setToolTipText("Enables or disables text wrap");
    textWrapMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            textWrapMenuItemActionPerformed(evt);
        }
    });
    jMenu2.add(textWrapMenuItem);
    if (mainTextArea.getLineWrap() == true) {
        textWrapMenuItem.setSelected(true);
    } else {
        textWrapMenuItem.setSelected(false);
    }

    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 581, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
            jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 543,
            Short.MAX_VALUE));

    pack();
}