blob: 36e952979cb17d6e92cc4a1a61368795744c2e95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/* NetCalendar 2006, 2009 (c) Dipl.-Inform. (FH) Paul C. Buetow
* http://netcalendar.buetow.org - netcalendar@dev.buetow.org
*/
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) {}
}
}
|