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.yccheok.jstock.gui.JStock.java

/** This method is called from within the constructor to
 * initialize the form.//from w ww . j  a v  a  2 s  . c om
 * 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() {

    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    buttonGroup3 = new javax.swing.ButtonGroup();
    buttonGroup4 = new javax.swing.ButtonGroup();
    jComboBox1 = new AutoCompleteJComboBox();
    jPanel6 = new javax.swing.JPanel();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel8 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel10 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jMenuBar2 = new javax.swing.JMenuBar();
    jMenu3 = new javax.swing.JMenu();
    jMenuItem2 = new javax.swing.JMenuItem();
    jMenuItem9 = new javax.swing.JMenuItem();
    jSeparator7 = new javax.swing.JPopupMenu.Separator();
    jMenuItem11 = new javax.swing.JMenuItem();
    jMenuItem10 = new javax.swing.JMenuItem();
    jSeparator8 = new javax.swing.JPopupMenu.Separator();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu5 = new javax.swing.JMenu();
    jMenuItem4 = new javax.swing.JMenuItem();
    jMenuItem7 = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    jMenuItem15 = new javax.swing.JMenuItem();
    jMenu6 = new javax.swing.JMenu();
    jMenu10 = new javax.swing.JMenu();
    jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem2 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem4 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem6 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem3 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem5 = new javax.swing.JRadioButtonMenuItem();
    jMenu7 = new javax.swing.JMenu();
    jMenuItem8 = new javax.swing.JMenuItem();
    jMenu9 = new javax.swing.JMenu();
    jMenu8 = new javax.swing.JMenu();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem6 = new javax.swing.JMenuItem();
    jMenu4 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jMenuItem16 = new javax.swing.JMenuItem();
    jMenuItem12 = new javax.swing.JMenuItem();
    jSeparator6 = new javax.swing.JPopupMenu.Separator();
    jMenuItem13 = new javax.swing.JMenuItem();
    jMenuItem14 = new javax.swing.JMenuItem();
    jSeparator5 = new javax.swing.JPopupMenu.Separator();
    jMenuItem5 = new javax.swing.JMenuItem();
    jMenu11 = new javax.swing.JMenu();
    jMenuItem17 = new javax.swing.JMenuItem();

    jComboBox1.setEditable(true);
    jComboBox1.setPreferredSize(new java.awt.Dimension(150, 24));
    ((AutoCompleteJComboBox) this.jComboBox1).attachStockInfoObserver(getStockInfoObserver());
    ((AutoCompleteJComboBox) this.jComboBox1).attachDispObserver(getDispObserver());

    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N
    setTitle(bundle.getString("MainFrame_Application_Title")); // NOI18N
    setIconImage(getMyIconImage());
    addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            formMouseClicked(evt);
        }
    });
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
        }

        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }

        public void windowDeiconified(java.awt.event.WindowEvent evt) {
            formWindowDeiconified(evt);
        }

        public void windowIconified(java.awt.event.WindowEvent evt) {
            formWindowIconified(evt);
        }
    });
    getContentPane().setLayout(new java.awt.BorderLayout(5, 5));

    jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jPanel6.setLayout(new java.awt.BorderLayout(5, 5));
    this.jPanel6.add(statusBar, java.awt.BorderLayout.SOUTH);
    getContentPane().add(jPanel6, java.awt.BorderLayout.SOUTH);

    jTabbedPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jTabbedPane1StateChanged(evt);
        }
    });

    jPanel8.setLayout(new java.awt.BorderLayout(5, 5));

    jTable1.setAutoCreateRowSorter(true);
    jTable1.setFont(jTable1.getFont().deriveFont(jTable1.getFont().getStyle() | java.awt.Font.BOLD,
            jTable1.getFont().getSize() + 1));
    jTable1.setModel(new StockTableModel());
    jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
    this.jTable1.setDefaultRenderer(Number.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Double.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Object.class, new StockTableCellRenderer(SwingConstants.LEFT));

    this.jTable1.setDefaultEditor(Double.class, new NonNegativeDoubleEditor());

    this.jTable1.getModel().addTableModelListener(this.getTableModelListener());

    this.jTable1.getTableHeader().addMouseListener(new TableColumnSelectionPopupListener(1));
    this.jTable1.addMouseListener(new TableMouseAdapter());
    this.jTable1.addKeyListener(new TableKeyEventListener());

    if (jStockOptions.useLargeFont()) {
        this.jTable1.setRowHeight((int) (this.jTable1.getRowHeight() * Constants.FONT_ENLARGE_FACTOR));
    }
    jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            jTable1KeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(jTable1);

    jPanel8.add(jScrollPane1, java.awt.BorderLayout.CENTER);

    jLabel1.setText(bundle.getString("MainFrame_Stock")); // NOI18N
    jPanel1.add(jLabel1);

    jPanel8.add(jPanel1, java.awt.BorderLayout.NORTH);

    jPanel10.setPreferredSize(new java.awt.Dimension(328, 170));
    jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 10, 5));

    jPanel3.setBackground(new java.awt.Color(255, 255, 255));
    jPanel3.setPreferredSize(new java.awt.Dimension(170, 160));
    jPanel3.setBorder(new org.jdesktop.swingx.border.DropShadowBorder(true));
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel10.add(jPanel3);
    EMPTY_DYNAMIC_CHART.getChartPanel().addMouseListener(dynamicChartMouseAdapter);
    jPanel3.add(EMPTY_DYNAMIC_CHART.getChartPanel(), java.awt.BorderLayout.CENTER);

    jPanel8.add(jPanel10, java.awt.BorderLayout.SOUTH);

    jTabbedPane1.addTab(bundle.getString("MainFrame_Title"), jPanel8); // NOI18N

    getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER);

    jPanel2.setLayout(new java.awt.GridLayout(2, 1));
    getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);

    jMenu3.setText(bundle.getString("MainFrame_File")); // NOI18N

    jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/project_open.png"))); // NOI18N
    jMenuItem2.setText(bundle.getString("MainFrame_Open...")); // NOI18N
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem2ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem2);

    jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filesave.png"))); // NOI18N
    jMenuItem9.setText(bundle.getString("MainFrame_SaveAs...")); // NOI18N
    jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem9ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem9);
    jMenu3.add(jSeparator7);

    jMenuItem11.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/images/16x16/download_from_cloud.png"))); // NOI18N
    jMenuItem11.setText(bundle.getString("MainFrame_OpenFromCloud...")); // NOI18N
    jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem11ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem11);

    jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/upload_to_cloud.png"))); // NOI18N
    jMenuItem10.setText(bundle.getString("MainFrame_SaveToCloud...")); // NOI18N
    jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem10ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem10);
    jMenu3.add(jSeparator8);

    jMenuItem1.setText(bundle.getString("MainFrame_Exit")); // NOI18N
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem1);

    jMenuBar2.add(jMenu3);

    jMenu5.setText(bundle.getString("MainFrame_Edit")); // NOI18N

    jMenuItem4.setText(bundle.getString("MainFrame_AddStocks...")); // NOI18N
    jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem4ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem4);

    jMenuItem7.setText(bundle.getString("MainFrame_ClearAllStocks")); // NOI18N
    jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem7ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem7);
    jMenu5.add(jSeparator4);

    jMenuItem15.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem15.setText(bundle.getString("MainFrame_RefreshStockPrices")); // NOI18N
    jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem15ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem15);

    jMenuBar2.add(jMenu5);

    jMenu6.setText(bundle.getString("MainFrame_Country")); // NOI18N
    jMenu6.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu6MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu6);

    jMenu10.setText(bundle.getString("MainFrame_Language")); // NOI18N

    buttonGroup3.add(jRadioButtonMenuItem1);
    jRadioButtonMenuItem1.setSelected(true);
    jRadioButtonMenuItem1.setText(Locale.ENGLISH.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem1ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem1);

    buttonGroup3.add(jRadioButtonMenuItem2);
    jRadioButtonMenuItem2.setText(Locale.SIMPLIFIED_CHINESE.getDisplayName(Locale.getDefault()));
    jRadioButtonMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem2ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem2);

    buttonGroup3.add(jRadioButtonMenuItem4);
    jRadioButtonMenuItem4.setText(Locale.TRADITIONAL_CHINESE.getDisplayName(Locale.getDefault()));
    jRadioButtonMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem4ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem4);

    buttonGroup3.add(jRadioButtonMenuItem6);
    jRadioButtonMenuItem6.setText(Locale.FRENCH.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem6ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem6);

    buttonGroup3.add(jRadioButtonMenuItem3);
    jRadioButtonMenuItem3.setText(Locale.GERMAN.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem3ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem3);

    buttonGroup3.add(jRadioButtonMenuItem5);
    jRadioButtonMenuItem5.setText(Locale.ITALIAN.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem5ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem5);

    jMenuBar2.add(jMenu10);

    jMenu7.setText(bundle.getString("MainFrame_Database")); // NOI18N

    jMenuItem8.setText(bundle.getString("MainFrame_StockDatabase...")); // NOI18N
    jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem8ActionPerformed(evt);
        }
    });
    jMenu7.add(jMenuItem8);

    jMenuBar2.add(jMenu7);

    jMenu9.setText(bundle.getString("MainFrame_Watchlist")); // NOI18N
    jMenu9.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu9MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu9);

    jMenu8.setText(bundle.getString("MainFrame_Portfolio")); // NOI18N
    jMenu8.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu8MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu8);

    jMenu1.setText(bundle.getString("MainFrame_Options")); // NOI18N

    jMenuItem6.setText(bundle.getString("MainFrame_Options...")); // NOI18N
    jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem6ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem6);

    jMenuBar2.add(jMenu1);

    jMenu4.setText(bundle.getString("MainFrame_LooknFeel")); // NOI18N
    jMenuBar2.add(jMenu4);

    jMenu2.setText(bundle.getString("MainFrame_Help")); // NOI18N

    jMenuItem3.setText(bundle.getString("MainFrame_OnlineHelp")); // NOI18N
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem3ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem3);

    jMenuItem16.setText(bundle.getString("MainFrame_KeyboardShortcuts")); // NOI18N
    jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem16ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem16);

    jMenuItem12.setText(bundle.getString("MainFrame_Calculator")); // NOI18N
    jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem12ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem12);
    jMenu2.add(jSeparator6);

    jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/smile2.png"))); // NOI18N
    jMenuItem13.setText(bundle.getString("MainFrame_DonateToJStock")); // NOI18N
    jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem13ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem13);

    jMenuItem14.setText(bundle.getString("MainFrame_ContributeToJStock")); // NOI18N
    jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem14ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem14);
    jMenu2.add(jSeparator5);

    jMenuItem5.setText(bundle.getString("MainFrame_About...")); // NOI18N
    jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem5ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem5);

    jMenuBar2.add(jMenu2);

    jMenu11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/android-small.png"))); // NOI18N
    jMenu11.setText(bundle.getString("MainFrame_Android")); // NOI18N
    jMenu11.setFont(jMenu11.getFont().deriveFont(jMenu11.getFont().getStyle() | java.awt.Font.BOLD));

    jMenuItem17.setText(bundle.getString("MainFrame_DownloadJStockAndroid")); // NOI18N
    jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem17ActionPerformed(evt);
        }
    });
    jMenu11.add(jMenuItem17);

    jMenuBar2.add(jMenu11);

    setJMenuBar(jMenuBar2);

    setSize(new java.awt.Dimension(952, 478));
    setLocationRelativeTo(null);
}

From source file:org.yccheok.jstock.gui.MainFrame.java

/** This method is called from within the constructor to
 * initialize the form./* ww w .  jav a 2  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() {

    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    buttonGroup3 = new javax.swing.ButtonGroup();
    jComboBox1 = new AutoCompleteJComboBox();
    jPanel6 = new javax.swing.JPanel();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel8 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel10 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jMenuBar2 = new javax.swing.JMenuBar();
    jMenu3 = new javax.swing.JMenu();
    jMenuItem2 = new javax.swing.JMenuItem();
    jMenuItem9 = new javax.swing.JMenuItem();
    jSeparator7 = new javax.swing.JPopupMenu.Separator();
    jMenuItem11 = new javax.swing.JMenuItem();
    jMenuItem10 = new javax.swing.JMenuItem();
    jSeparator8 = new javax.swing.JPopupMenu.Separator();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu5 = new javax.swing.JMenu();
    jMenuItem4 = new javax.swing.JMenuItem();
    jMenuItem7 = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    jMenuItem15 = new javax.swing.JMenuItem();
    jMenu6 = new javax.swing.JMenu();
    jMenu10 = new javax.swing.JMenu();
    jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem2 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem4 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem6 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem3 = new javax.swing.JRadioButtonMenuItem();
    jRadioButtonMenuItem5 = new javax.swing.JRadioButtonMenuItem();
    jMenu7 = new javax.swing.JMenu();
    jMenuItem8 = new javax.swing.JMenuItem();
    jMenu9 = new javax.swing.JMenu();
    jMenu8 = new javax.swing.JMenu();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem6 = new javax.swing.JMenuItem();
    jMenu4 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jMenuItem16 = new javax.swing.JMenuItem();
    jMenuItem12 = new javax.swing.JMenuItem();
    jSeparator6 = new javax.swing.JPopupMenu.Separator();
    jMenuItem13 = new javax.swing.JMenuItem();
    jMenuItem14 = new javax.swing.JMenuItem();
    jSeparator5 = new javax.swing.JPopupMenu.Separator();
    jMenuItem5 = new javax.swing.JMenuItem();
    jMenu11 = new javax.swing.JMenu();
    jMenuItem17 = new javax.swing.JMenuItem();

    jComboBox1.setEditable(true);
    jComboBox1.setPreferredSize(new java.awt.Dimension(150, 24));
    ((AutoCompleteJComboBox) this.jComboBox1).attachStockInfoObserver(getStockInfoObserver());
    ((AutoCompleteJComboBox) this.jComboBox1).attachResultObserver(getResultObserver());
    ((AutoCompleteJComboBox) this.jComboBox1).attachMatchObserver(getMatchObserver());

    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N
    setTitle(bundle.getString("MainFrame_Application_Title")); // NOI18N
    setIconImage(getMyIconImage());
    addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            formMouseClicked(evt);
        }
    });
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
        }

        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }

        public void windowDeiconified(java.awt.event.WindowEvent evt) {
            formWindowDeiconified(evt);
        }

        public void windowIconified(java.awt.event.WindowEvent evt) {
            formWindowIconified(evt);
        }
    });
    getContentPane().setLayout(new java.awt.BorderLayout(5, 5));

    jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jPanel6.setLayout(new java.awt.BorderLayout(5, 5));
    this.jPanel6.add(statusBar, java.awt.BorderLayout.SOUTH);
    getContentPane().add(jPanel6, java.awt.BorderLayout.SOUTH);

    jTabbedPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jTabbedPane1StateChanged(evt);
        }
    });

    jPanel8.setLayout(new java.awt.BorderLayout(5, 5));

    jTable1.setAutoCreateRowSorter(true);
    jTable1.setFont(jTable1.getFont().deriveFont(jTable1.getFont().getStyle() | java.awt.Font.BOLD,
            jTable1.getFont().getSize() + 1));
    jTable1.setModel(new StockTableModel());
    jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
    this.jTable1.setDefaultRenderer(Number.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Double.class, new StockTableCellRenderer(SwingConstants.RIGHT));
    this.jTable1.setDefaultRenderer(Object.class, new StockTableCellRenderer(SwingConstants.LEFT));

    this.jTable1.setDefaultEditor(Double.class, new NonNegativeDoubleEditor());

    this.jTable1.getModel().addTableModelListener(this.getTableModelListener());

    this.jTable1.getTableHeader().addMouseListener(new TableColumnSelectionPopupListener(1));
    this.jTable1.addMouseListener(new TableRowPopupListener());
    this.jTable1.addKeyListener(new TableKeyEventListener());
    jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            jTable1KeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(jTable1);

    jPanel8.add(jScrollPane1, java.awt.BorderLayout.CENTER);

    jLabel1.setText(bundle.getString("MainFrame_Stock")); // NOI18N
    jPanel1.add(jLabel1);

    jPanel8.add(jPanel1, java.awt.BorderLayout.NORTH);

    jPanel10.setPreferredSize(new java.awt.Dimension(328, 170));
    jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 10, 5));

    jPanel3.setBackground(new java.awt.Color(255, 255, 255));
    jPanel3.setPreferredSize(new java.awt.Dimension(170, 160));
    jPanel3.setBorder(new org.jdesktop.swingx.border.DropShadowBorder(true));
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel10.add(jPanel3);
    EMPTY_DYNAMIC_CHART.getChartPanel().addMouseListener(dynamicChartMouseAdapter);
    jPanel3.add(EMPTY_DYNAMIC_CHART.getChartPanel(), java.awt.BorderLayout.CENTER);

    jPanel8.add(jPanel10, java.awt.BorderLayout.SOUTH);

    jTabbedPane1.addTab(bundle.getString("MainFrame_Title"), jPanel8); // NOI18N

    getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER);

    jPanel2.setLayout(new java.awt.GridLayout(2, 1));
    getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);

    jMenu3.setText(bundle.getString("MainFrame_File")); // NOI18N

    jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/project_open.png"))); // NOI18N
    jMenuItem2.setText(bundle.getString("MainFrame_Open...")); // NOI18N
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem2ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem2);

    jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/filesave.png"))); // NOI18N
    jMenuItem9.setText(bundle.getString("MainFrame_SaveAs...")); // NOI18N
    jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem9ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem9);
    jMenu3.add(jSeparator7);

    jMenuItem11.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/images/16x16/download_from_cloud.png"))); // NOI18N
    jMenuItem11.setText(bundle.getString("MainFrame_OpenFromCloud...")); // NOI18N
    jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem11ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem11);

    jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/upload_to_cloud.png"))); // NOI18N
    jMenuItem10.setText(bundle.getString("MainFrame_SaveToCloud...")); // NOI18N
    jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem10ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem10);
    jMenu3.add(jSeparator8);

    jMenuItem1.setText(bundle.getString("MainFrame_Exit")); // NOI18N
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem1);

    jMenuBar2.add(jMenu3);

    jMenu5.setText(bundle.getString("MainFrame_Edit")); // NOI18N

    jMenuItem4.setText(bundle.getString("MainFrame_AddStocks...")); // NOI18N
    jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem4ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem4);

    jMenuItem7.setText(bundle.getString("MainFrame_ClearAllStocks")); // NOI18N
    jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem7ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem7);
    jMenu5.add(jSeparator4);

    jMenuItem15.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem15.setText(bundle.getString("MainFrame_RefreshStockPrices")); // NOI18N
    jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem15ActionPerformed(evt);
        }
    });
    jMenu5.add(jMenuItem15);

    jMenuBar2.add(jMenu5);

    jMenu6.setText(bundle.getString("MainFrame_Country")); // NOI18N
    jMenuBar2.add(jMenu6);

    jMenu10.setText(bundle.getString("MainFrame_Language")); // NOI18N

    buttonGroup3.add(jRadioButtonMenuItem1);
    jRadioButtonMenuItem1.setSelected(true);
    jRadioButtonMenuItem1.setText(Locale.ENGLISH.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem1ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem1);

    buttonGroup3.add(jRadioButtonMenuItem2);
    jRadioButtonMenuItem2.setText(Locale.SIMPLIFIED_CHINESE.getDisplayName(Locale.getDefault()));
    jRadioButtonMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem2ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem2);

    buttonGroup3.add(jRadioButtonMenuItem4);
    jRadioButtonMenuItem4.setText(Locale.TRADITIONAL_CHINESE.getDisplayName(Locale.getDefault()));
    jRadioButtonMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem4ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem4);

    buttonGroup3.add(jRadioButtonMenuItem6);
    jRadioButtonMenuItem6.setText(Locale.FRENCH.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem6ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem6);

    buttonGroup3.add(jRadioButtonMenuItem3);
    jRadioButtonMenuItem3.setText(Locale.GERMAN.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem3ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem3);

    buttonGroup3.add(jRadioButtonMenuItem5);
    jRadioButtonMenuItem5.setText(Locale.ITALIAN.getDisplayLanguage(Locale.getDefault()));
    jRadioButtonMenuItem5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButtonMenuItem5ActionPerformed(evt);
        }
    });
    jMenu10.add(jRadioButtonMenuItem5);

    jMenuBar2.add(jMenu10);

    jMenu7.setText(bundle.getString("MainFrame_Database")); // NOI18N

    jMenuItem8.setText(bundle.getString("MainFrame_StockDatabase...")); // NOI18N
    jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem8ActionPerformed(evt);
        }
    });
    jMenu7.add(jMenuItem8);

    jMenuBar2.add(jMenu7);

    jMenu9.setText(bundle.getString("MainFrame_Watchlist")); // NOI18N
    jMenu9.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu9MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu9);

    jMenu8.setText(bundle.getString("MainFrame_Portfolio")); // NOI18N
    jMenu8.addMenuListener(new javax.swing.event.MenuListener() {
        public void menuCanceled(javax.swing.event.MenuEvent evt) {
        }

        public void menuDeselected(javax.swing.event.MenuEvent evt) {
        }

        public void menuSelected(javax.swing.event.MenuEvent evt) {
            jMenu8MenuSelected(evt);
        }
    });
    jMenuBar2.add(jMenu8);

    jMenu1.setText(bundle.getString("MainFrame_Options")); // NOI18N

    jMenuItem6.setText(bundle.getString("MainFrame_Options...")); // NOI18N
    jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem6ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem6);

    jMenuBar2.add(jMenu1);

    jMenu4.setText(bundle.getString("MainFrame_LooknFeel")); // NOI18N
    jMenuBar2.add(jMenu4);

    jMenu2.setText(bundle.getString("MainFrame_Help")); // NOI18N

    jMenuItem3.setText(bundle.getString("MainFrame_OnlineHelp")); // NOI18N
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem3ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem3);

    jMenuItem16.setText(bundle.getString("MainFrame_KeyboardShortcuts")); // NOI18N
    jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem16ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem16);

    jMenuItem12.setText(bundle.getString("MainFrame_Calculator")); // NOI18N
    jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem12ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem12);
    jMenu2.add(jSeparator6);

    jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/smile2.png"))); // NOI18N
    jMenuItem13.setText(bundle.getString("MainFrame_DonateToJStock")); // NOI18N
    jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem13ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem13);

    jMenuItem14.setText(bundle.getString("MainFrame_ContributeToJStock")); // NOI18N
    jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem14ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem14);
    jMenu2.add(jSeparator5);

    jMenuItem5.setText(bundle.getString("MainFrame_About...")); // NOI18N
    jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem5ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem5);

    jMenuBar2.add(jMenu2);

    jMenu11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/16x16/android-small.png"))); // NOI18N
    jMenu11.setText(bundle.getString("MainFrame_Android")); // NOI18N
    jMenu11.setFont(jMenu11.getFont().deriveFont(jMenu11.getFont().getStyle() | java.awt.Font.BOLD));

    jMenuItem17.setText(bundle.getString("MainFrame_DownloadJStockAndroid")); // NOI18N
    jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem17ActionPerformed(evt);
        }
    });
    jMenu11.add(jMenuItem17);

    jMenuBar2.add(jMenu11);

    setJMenuBar(jMenuBar2);

    setSize(new java.awt.Dimension(952, 478));
    setLocationRelativeTo(null);
}

From source file:org.yccheok.jstock.gui.news.StockNewsJFrame.java

private void initComponents() {
    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    setAlwaysOnTop(true);// w  ww .jav a2s  .  c  o m
    setAutoRequestFocus(false);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
        }

        public void windowClosing(java.awt.event.WindowEvent evt) {
            NewsTask task = StockNewsJFrame.this.newsTask;
            if (task != null) {
                task.cancel(true);
            }
        }

        public void windowDeiconified(java.awt.event.WindowEvent evt) {
        }

        public void windowIconified(java.awt.event.WindowEvent evt) {
        }
    });

    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            // JFXPanel => Scene => SplitPane:
            //      Left  (news List)       => StackPane => ListView / ProgressIndicator
            //      Right (HTML content)    => TabPane => Tab => StackPane => WebView / ProgressBar

            splitPane = new SplitPane();
            scene = new Scene(splitPane);

            scene.getStylesheets()
                    .add(StockNewsJFrame.class.getResource("StockNewsJFrame.css").toExternalForm());
            jfxPanel.setScene(scene);

            // Left component: News List
            messages_o = FXCollections.observableArrayList();
            newsListView = new ListView<>(messages_o);
            newsListView.setId("news-listview");

            stackPane.setId("parent-stackPane");
            stackPane.getChildren().addAll(newsListView, progressIn);

            splitPane.getItems().add(stackPane);
            SplitPane.setResizableWithParent(stackPane, Boolean.FALSE);

            // show progress indicator when loading
            progressIn.setMaxWidth(100);
            progressIn.setMaxHeight(100);
            progressIn.setVisible(true);
            newsListView.setVisible(true);

            newsListView.setCellFactory(new Callback<ListView<FeedItem>, ListCell<FeedItem>>() {
                @Override
                public ListCell<FeedItem> call(ListView<FeedItem> list) {
                    return new DisplayNewsCard();
                }
            });

            // register event listener: add tab for news HTML content
            newsListView.setOnMouseClicked(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    if (event.getClickCount() >= 1) {
                        final FeedItem msg = newsListView.getSelectionModel().getSelectedItem();
                        if (msg == null) {
                            return;
                        }

                        final URL link = msg.getLink();
                        if (link == null || link.getHost() == null) {
                            return;
                        }

                        if (stockNewsContent == null) {
                            stackPane.setPrefWidth(stackPane.getWidth());
                            stackPane.setMaxWidth(stackPane.getWidth());
                            stackPane.setMinWidth(stackPane.getWidth() / 5);

                            try {
                                SwingUtilities.invokeAndWait(new Runnable() {
                                    @Override
                                    public void run() {
                                        // resize JFrame first
                                        StockNewsJFrame.this.setSize(fullSize.width, fullSize.height);

                                        java.awt.Insets in = StockNewsJFrame.this.getInsets();
                                        jfxPanel.setSize(StockNewsJFrame.this.getWidth() - in.left - in.right,
                                                jfxPanel.getHeight());

                                        java.awt.Insets in2 = jfxPanel.getInsets();

                                        // calculate width & height, but not resize in AWT event dispatching thread
                                        // javafx.scene.control.SplitPane should only be accessed from JavaFX Application Thread
                                        splitPaneWidth = jfxPanel.getWidth() - in2.left - in2.right;
                                        splitPaneHeight = jfxPanel.getHeight() - in2.top - in2.bottom;
                                    }
                                });
                            } catch (InterruptedException | InvocationTargetException ex) {
                                log.error(null, ex);
                            }

                            // resize to full screen size of jfxPanel
                            splitPane.resize(splitPaneWidth, splitPaneHeight);

                            stockNewsContent = new StockNewsContent();
                            splitPane.getItems().add(stockNewsContent.tabPane);
                            splitPane.setDividerPositions(0.5f);

                            stockNewsContent.tabPane.getSelectionModel().selectedItemProperty()
                                    .addListener(new ChangeListener<Tab>() {
                                        @Override
                                        public void changed(ObservableValue<? extends Tab> observable,
                                                Tab oldTab, Tab newTab) {
                                            int i = stockNewsContent.tabPane.getSelectionModel()
                                                    .getSelectedIndex();
                                            if (i < 0) {
                                                return;
                                            }

                                            jFrameTitle = stockNewsContent.tabsInfo.get(i).second;

                                            SwingUtilities.invokeLater(new Runnable() {
                                                @Override
                                                public void run() {
                                                    StockNewsJFrame.this.setTitle(jFrameTitle);
                                                }
                                            });
                                        }
                                    });
                        }
                        stockNewsContent.addNewsTab(link, StringEscapeUtils.unescapeHtml(msg.getTitle()));
                    }
                }
            });

            retrieveNewsInBackground();
        }
    });

    this.add(jfxPanel, BorderLayout.CENTER);
    this.setVisible(true);
}

From source file:pcgen.gui2.converter.PCGenDataConvert.java

private static PCGenDataConvert getConverter() {
    PCGenDataConvert frame = new PCGenDataConvert();
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    List<ConvertSubPanel> panels = new ArrayList<>();
    GameModeFileLoader gameModeFileLoader = new GameModeFileLoader();
    CampaignFileLoader campaignFileLoader = new CampaignFileLoader();
    panels.add(new StartupPanel(gameModeFileLoader, campaignFileLoader));

    final ConvertPanel installPanel = new ConvertPanel(panels);
    frame.addWindowListener(new WindowAdapter() {
        @Override//ww w .  java2  s. c  o  m
        public void windowClosing(WindowEvent wEvent) {
            installPanel.checkExit();
        }
    });

    panels.add(new SourceSelectionPanel());
    panels.add(new GameModePanel(campaignFileLoader));
    panels.add(new CampaignPanel());

    panels.add(new WriteDirectoryPanel());

    panels.add(new SummaryPanel());

    panels.add(new RunConvertPanel(installPanel.getStatusField()));

    frame.getContentPane().add(installPanel);
    frame.pack();
    Utility.centerComponent(frame, false);
    return frame;
}

From source file:pcgen.gui2.dialog.OptionsPathDialog.java

private void initComponents() {
    setResizable(false);/*  w ww . ja va 2  s .  c o m*/
    setTitle("Directory for options.ini location");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    getContentPane().setLayout(new GridBagLayout());
    GridBagConstraints gridBagConstraints = new GridBagConstraints();

    JLabel label = new JLabel("Select a directory to store PCGen options in:");
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(4, 4, 0, 4);
    getContentPane().add(label, gridBagConstraints);

    gridBagConstraints.insets = new Insets(2, 0, 2, 0);
    getContentPane().add(new JSeparator(), gridBagConstraints);

    label = new JLabel(
            "If you have an existing options.ini file," + "then select the directory containing that file");
    gridBagConstraints.insets = new Insets(4, 4, 4, 4);
    getContentPane().add(label, gridBagConstraints);

    ActionListener handler = new ActionHandler();
    ButtonGroup group = new ButtonGroup();

    gridBagConstraints.insets = new Insets(0, 4, 0, 4);
    addRadioButton("<html><b>PCGen Dir</b>: This is the directory that PCGen is installed into",
            SettingsFilesPath.pcgen.name(), group, handler, gridBagConstraints);
    // Remark: do mac user really need to be able to put the file either in a specific mac dir or home?
    if (SystemUtils.IS_OS_MAC_OSX) {
        addRadioButton("<html><b>Mac User Dir</b>", SettingsFilesPath.mac_user.name(), group, handler,
                gridBagConstraints);
    } else if (SystemUtils.IS_OS_UNIX) {
        // putting it the same way as mac. merging all and using a system config dir instead would be better IMHO.
        addRadioButton("<html><b>Freedesktop configuration sub-directory</b> Use for most Linux/BSD",
                SettingsFilesPath.FD_USER.name(), group, handler, gridBagConstraints);
    }
    addRadioButton("<html><b>Home Dir</b>: This is your home directory", SettingsFilesPath.user.name(), group,
            handler, gridBagConstraints);
    addRadioButton("Select a directory to use", "select", group, handler, gridBagConstraints);

    dirField.setText(ConfigurationSettings.getSettingsDirFromFilePath(selectedDir));
    dirField.setEditable(false);

    gridBagConstraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagConstraints.weightx = 1;
    gridBagConstraints.insets = new Insets(0, 4, 0, 0);
    getContentPane().add(dirField, gridBagConstraints);

    dirButton.setText("...");
    dirButton.setEnabled(false);
    dirButton.addActionListener(handler);
    dirButton.setActionCommand("custom");
    dirButton.setMargin(new Insets(2, 2, 2, 2));

    GridBagConstraints bagConstraints = new GridBagConstraints();
    bagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    bagConstraints.insets = new Insets(0, 0, 0, 4);
    getContentPane().add(dirButton, bagConstraints);

    JButton okButton = new JButton("OK");
    okButton.setPreferredSize(new Dimension(75, 23));
    okButton.setActionCommand("ok");
    okButton.addActionListener(handler);

    bagConstraints.insets = new Insets(4, 0, 4, 0);
    getContentPane().add(okButton, bagConstraints);
    getRootPane().setDefaultButton(okButton);

    pack();
    setLocationRelativeTo(null);
}

From source file:pcgen.gui2.PCGenFrame.java

private void initSettings() {
    final UIPropertyContext frameContext = UIPropertyContext.createContext("PCGenFrame");

    Rectangle screenBounds = getGraphicsConfiguration().getBounds();

    setSize(1060, 725); //this is the default frame dimensions
    setLocationRelativeTo(null); //center the frame
    if (!screenBounds.contains(getBounds())) {
        setSize((5 * screenBounds.width) / 6, (5 * screenBounds.height) / 6);
        setLocationRelativeTo(null); //center the frame
    }/*ww w. j a  v a 2s  . c om*/
    Rectangle frameBounds = getBounds();
    frameBounds.x = frameContext.initInt("bounds.x", frameBounds.x);
    frameBounds.y = frameContext.initInt("bounds.y", frameBounds.x);
    frameBounds.width = frameContext.initInt("bounds.width", frameBounds.width);
    frameBounds.height = frameContext.initInt("bounds.height", frameBounds.height);

    int extendedState = frameContext.initInt("extendedState", NORMAL);
    if (extendedState == ICONIFIED) {
        extendedState = NORMAL;
        frameContext.setInt("extendedState", NORMAL);
    }
    setExtendedState(extendedState);
    if (checkBounds(frameBounds)) {
        setBounds(frameBounds);
    }
    addPropertyChangeListener("extendedState", frameContext);
    addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            updateBounds();
        }

        @Override
        public void componentMoved(ComponentEvent e) {
            updateBounds();
        }

        private void updateBounds() {
            Rectangle bounds = getBounds();
            frameContext.setInt("bounds.x", bounds.x);
            frameContext.setInt("bounds.y", bounds.y);
            frameContext.setInt("bounds.width", bounds.width);
            frameContext.setInt("bounds.height", bounds.height);
        }

    });
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            PCGenUIManager.closePCGen();
        }

    });
}

From source file:plugins.tprovoost.Microscopy.MicroManagerForIcy.MMMainFrame.java

public void customClose() {
    if (getInternalFrame().getDefaultCloseOperation() == WindowConstants.DO_NOTHING_ON_CLOSE) {
        if (!_list_plugin.isEmpty()) {
            if (!ConfirmDialog.confirm("Some plugins are still running. Are you sure you want to close this ?"))
                return;
        }//  w  ww. j a  v a  2s .c o m
        if (painterPreferences != null)
            painterPreferences.saveColors();
        _pluginListEmpty = true;
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        close();
        Icy.getMainInterface().removeCanExitListener(acceptListener);
    }
}

From source file:ro.nextreports.designer.NextReports.java

public static MainFrame createMainFrame() {
    // create the main frame
    final MainFrame mainFrame = new MainFrame(
            "NextReports " + ReleaseInfoAdapter.getVersion() + LicenseUtil.getEdition());

    // load preferences
    final ReporterPreferencesManager preferencesManager = ReporterPreferencesManager.getInstance();
    Rectangle bounds = preferencesManager.loadBoundsForWindow(MainFrame.class);

    if (bounds == null) {
        mainFrame.pack();//from w ww . j a va  2s . c o  m
    } else {
        mainFrame.setBounds(bounds);
    }

    // centrate the main frame
    mainFrame.setLocationRelativeTo(null);

    // store (on close) and load (on start) the docking manager workspace.
    // store preferences and stop log
    mainFrame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent event) {
            try {
                new ExitAction().actionPerformed(null);
            } catch (Exception e) {
                e.printStackTrace();
                LOG.error(e.getMessage(), e);
            }
        }

    });

    try {
        WorkspaceManager.getInstance().restoreWorkspaces();
    } catch (Exception e) {
        e.printStackTrace();
        LOG.error(e.getMessage(), e);
    }

    mainFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    return mainFrame;
}

From source file:savant.view.swing.Savant.java

/**
 * Set up frame/* w  w w .  j a va  2s .  c o m*/
 */
void initGUIFrame() {
    // ask before quitting

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

        }
    });

    // other
    this.setIconImage(SavantIconFactory.getInstance().getIcon(SavantIconFactory.StandardIcon.LOGO).getImage());
    this.setTitle("Savant Genome Browser");
    this.setName("Savant Genome Browser");
}

From source file:tvbrowser.ui.mainframe.MainFrame.java

private MainFrame() {
    super(TVBrowser.MAINWINDOW_TITLE);
    mIsVisible = false;//  www. j  ava  2s  .c  o m
    mSettingsWillBeOpened = false;

    mAutoDownloadTimer = -1;
    mLastTimerMinutesAfterMidnight = -1;
    mLastAutoUpdateRun = System.currentTimeMillis();

    mChannelDateArr = null;
    mOnAirRowProgramsArr = null;
    mStatusBar = new StatusBar();

    if (OperatingSystem.isMacOs()) {
        /* create the menu bar for MacOS X */
        try {
            Class<?> impl = Class.forName("tvbrowser.ui.mainframe.macosx.MacOSXMenuBar");
            Class<? extends MainFrame> mainFrameClass = this.getClass();
            Class<?> jlabelClass = Class.forName("javax.swing.JLabel");
            Constructor<?> cons = impl.getConstructor(new Class[] { mainFrameClass, jlabelClass });
            mMenuBar = (MenuBar) cons.newInstance(new Object[] { this, mStatusBar.getLabel() });
        } catch (Exception e) {
            if (TVBrowser.isTransportable()) {
                mLog.info("Using default menu bar (instead of MacOSXMenuBar) for transportable version.");
            }
            mLog.warning("Could not instantiate MacOSXMenuBar\n" + e.toString());
            if (e.getCause() != null) {
                StringWriter sw = new StringWriter();
                e.getCause().printStackTrace(new PrintWriter(sw));
                mLog.warning(sw.toString());
            }
            mMenuBar = new DefaultMenuBar(this, mStatusBar.getLabel());
            mLog.info("Using default menu bar");
        }

    } else {
        mMenuBar = new DefaultMenuBar(this, mStatusBar.getLabel());
    }

    // create content
    jcontentPane = (JPanel) getContentPane();
    jcontentPane.setLayout(new BorderLayout());

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

    JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.setOpaque(false);
    centerPanel.setBorder(BorderFactory.createEmptyBorder());

    mFilterPanel = new FilterPanel();
    mFilterPanel.setVisible(false);

    mTimeChooserPanel = new TimeChooserPanel(this);

    centerPanel.add(mFilterPanel, BorderLayout.NORTH);

    Channel[] channelArr = ChannelList.getSubscribedChannels();
    int startOfDay = Settings.propProgramTableStartOfDay.getInt();
    int endOfDay = Settings.propProgramTableEndOfDay.getInt();
    mProgramTableModel = new DefaultProgramTableModel(channelArr, startOfDay, endOfDay);
    mProgramTableScrollPane = new ProgramTableScrollPane(mProgramTableModel);
    centerPanel.add(mProgramTableScrollPane);

    createDateSelector();

    skinPanel.add(centerPanel, BorderLayout.CENTER);

    mChannelChooser = new ChannelChooserPanel(this);

    /* create structure */
    mRootNode = new Node(null);

    if (Settings.propPluginViewIsLeft.getBoolean()) {
        mPluginsNode = new Node(mRootNode);
    } else {
        mNavigationNode = new Node(mRootNode);
    }

    mMainframeNode = new Node(mRootNode);
    Node programtableNode = new Node(mMainframeNode);

    if (Settings.propPluginViewIsLeft.getBoolean()) {
        mNavigationNode = new Node(mMainframeNode);
    } else {
        mPluginsNode = new Node(mMainframeNode);
    }

    mTimebuttonsNode = new Node(mNavigationNode);
    mDateChannelNode = new Node(mNavigationNode);
    mDateNode = new Node(mDateChannelNode);
    mChannelNode = new Node(mDateChannelNode);

    mRootNode.setProperty(Settings.propViewRoot);
    mMainframeNode.setProperty(Settings.propViewMainframe);
    mNavigationNode.setProperty(Settings.propViewNavigation);
    mDateChannelNode.setProperty(Settings.propViewDateChannel);

    /* create views */
    programtableNode.setLeaf(skinPanel);
    this.setShowPluginOverview(Settings.propShowPluginView.getBoolean());
    this.setShowTimeButtons(Settings.propShowTimeButtons.getBoolean());
    this.setShowDatelist(Settings.propShowDatelist.getBoolean());
    this.setShowChannellist(Settings.propShowChannels.getBoolean());

    updateToolbar();
    dateChanged(new devplugin.Date(), null, null);

    mCenterComponent = mRootNode.getComponent();
    if (mCenterComponent != null) {
        jcontentPane.add(mCenterComponent, BorderLayout.CENTER);
    }

    if (Settings.propIsStatusbarVisible.getBoolean()) {
        jcontentPane.add(mStatusBar, BorderLayout.SOUTH);
    }

    setJMenuBar(mMenuBar);
    addContextMenuMouseListener(mMenuBar);

    // set program filter
    FilterList filterList = FilterList.getInstance();

    ProgramFilter filter = filterList.getFilterByName(Settings.propLastUsedFilter.getString());

    if (filter == null) {
        filter = FilterManagerImpl.getInstance().getDefaultFilter();
    }

    setProgramFilter(filter);

    // set channel group filter
    String channelGroupName = Settings.propLastUsedChannelGroup.getString();
    if (channelGroupName != null) {
        FilterComponent component = FilterComponentList.getInstance()
                .getFilterComponentByName(channelGroupName);
        if (component != null && component instanceof ChannelFilterComponent) {
            setChannelGroup((ChannelFilterComponent) component);
        }
    }

    addKeyboardAction();

    mTimer = new Timer(10000, new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            handleTimerEvent();
        }
    });
    mTimer.start();

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    //create the drop target for installation of Plugins with Drag'N'Drop on MainFrame
    DropTarget target = new DropTarget();
    try {
        target.addDropTargetListener(this);
    } catch (TooManyListenersException e1) {
        //ignore
    }

    this.setDropTarget(target);
}