123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- /*
- * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
- package org.ownage.dmdirc.ui;
-
- import org.ownage.dmdirc.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JInternalFrame;
-
- /**
- * The main application frame
- * @author chris
- */
- public class MainFrame extends javax.swing.JFrame {
-
- /**
- * Singleton instance of MainFrame
- */
- private static MainFrame me;
-
- /**
- * Returns the singleton instance of MainFrame
- * @return MainFrame instance
- */
- public static MainFrame getMainFrame() {
- if (me == null) {
- me = new MainFrame();
- }
- return me;
- }
-
- /** Creates new form MainFrame */
- public MainFrame() {
- initComponents();
- setVisible(true);
-
- miAddServer.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent actionEvent) {
- NewServerDialog.showNewServerDialog();
- }
- });
- }
-
- /**
- * Adds the specified InternalFrame as a child of the main frame
- * @param frame the frame to be added
- */
- public void addChild(JInternalFrame frame) {
- desktopPane.add(frame);
- }
-
- /** 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.
- */
- // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
- private void initComponents() {
- desktopPane = new javax.swing.JDesktopPane();
- pnSwitchbar = new javax.swing.JPanel();
- jMenuBar1 = new javax.swing.JMenuBar();
- jMenu1 = new javax.swing.JMenu();
- miAddServer = new javax.swing.JMenuItem();
-
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setTitle("DMDirc");
-
- pnSwitchbar.setMaximumSize(new java.awt.Dimension(150, 32767));
- org.jdesktop.layout.GroupLayout pnSwitchbarLayout = new org.jdesktop.layout.GroupLayout(pnSwitchbar);
- pnSwitchbar.setLayout(pnSwitchbarLayout);
- pnSwitchbarLayout.setHorizontalGroup(
- pnSwitchbarLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(0, 108, Short.MAX_VALUE)
- );
- pnSwitchbarLayout.setVerticalGroup(
- pnSwitchbarLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(0, 399, Short.MAX_VALUE)
- );
-
- jMenu1.setMnemonic('f');
- jMenu1.setText("File");
- miAddServer.setText("New Server...");
- jMenu1.add(miAddServer);
-
- jMenuBar1.add(jMenu1);
-
- setJMenuBar(jMenuBar1);
-
- 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(pnSwitchbar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(desktopPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
- .add(pnSwitchbar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .add(org.jdesktop.layout.GroupLayout.TRAILING, desktopPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE)
- );
- pack();
- }// </editor-fold>//GEN-END:initComponents
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JDesktopPane desktopPane;
- private javax.swing.JMenu jMenu1;
- private javax.swing.JMenuBar jMenuBar1;
- private javax.swing.JMenuItem miAddServer;
- private javax.swing.JPanel pnSwitchbar;
- // End of variables declaration//GEN-END:variables
-
- }
|