From 69f0e6b0bf0dc0a6c6fe8ccf17c74960697ca10c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 8 Feb 2009 01:37:25 +0000 Subject: 1.0 released --- client/SubWindow.java | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 client/SubWindow.java (limited to 'client/SubWindow.java') diff --git a/client/SubWindow.java b/client/SubWindow.java new file mode 100644 index 0000000..6ec4872 --- /dev/null +++ b/client/SubWindow.java @@ -0,0 +1,101 @@ +package client; + +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +import javax.swing.*; + + +/** + * This is the base class for all subwindows of a main session window of + * the calendar client. + * @author buetow + * + */ +public abstract class SubWindow extends JFrame { + protected final static long serialVersionUID = 1L; + protected NetCalendarClient netCalendarClient; + private SubWindow subWindow; + + /** + * Creates the window and shows it. + * @param sTitleText Specifies the title text of this JFrame. + * @param netCalendarClient Specifies the calendar client session object to use. + */ + public SubWindow(String sTitleText, NetCalendarClient netCalendarClient) { + super(netCalendarClient.getSessionString() + sTitleText); + netCalendarClient.addFrame(this); + this.netCalendarClient = netCalendarClient; + this.subWindow = this; + this.addWindowListener(new MyWindowListener()); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setLocationRelativeTo(netCalendarClient); + } + + /** + * Creates the window and shows it. + * @param sTitleText Specifies the title text of this JFrame. + * @param netCalendarClient Specifies the calendar client session object to use. + */ + public void init(String sTitleText, NetCalendarClient netCalendarClient) { + initComponents(); + pack(); + setVisible(true); + } + + /** + * The implemented method should initialize all the GUI components. + */ + protected abstract void initComponents(); + + /** + * This private class is only needed for removing the current JFrame of the outer class + * from the NetCalendarClient object's frame Vector. + * @author buetow + */ + private class MyWindowListener implements WindowListener { + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent) + */ + public void windowClosed(WindowEvent e) { + netCalendarClient.removeFrame(subWindow); + } + + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowActivated(java.awt.event.WindowEvent) + */ + public void windowActivated(WindowEvent e) { } + + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent) + */ + public void windowClosing(WindowEvent e) {} + + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowDeactivated(java.awt.event.WindowEvent) + */ + public void windowDeactivated(WindowEvent e) {} + + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowDeiconified(java.awt.event.WindowEvent) + */ + public void windowDeiconified(WindowEvent e) {} + + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowIconified(java.awt.event.WindowEvent) + */ + public void windowIconified(WindowEvent e) { } + + /* + * (non-Javadoc) + * @see java.awt.event.WindowListener#windowOpened(java.awt.event.WindowEvent) + */ + public void windowOpened(WindowEvent e) {} + } +} -- cgit v1.2.3