1 | // |
---|
2 | // Copyright (C) 2002 Cendio Systems. All Rights Reserved. |
---|
3 | // Copyright (C) 2002 Constantin Kaplinsky. All Rights Reserved. |
---|
4 | // |
---|
5 | // This is free software; you can redistribute it and/or modify |
---|
6 | // it under the terms of the GNU General Public License as published by |
---|
7 | // the Free Software Foundation; either version 2 of the License, or |
---|
8 | // (at your option) any later version. |
---|
9 | // |
---|
10 | // This software is distributed in the hope that it will be useful, |
---|
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | // GNU General Public License for more details. |
---|
14 | // |
---|
15 | // You should have received a copy of the GNU General Public License |
---|
16 | // along with this software; if not, write to the Free Software |
---|
17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
---|
18 | // USA. |
---|
19 | // |
---|
20 | |
---|
21 | // |
---|
22 | // ReloginPanel class implements panel with a button for logging in again, |
---|
23 | // after fatal errors or disconnect |
---|
24 | // |
---|
25 | |
---|
26 | |
---|
27 | import java.awt.*; |
---|
28 | import java.awt.event.*; |
---|
29 | import java.applet.*; |
---|
30 | |
---|
31 | // |
---|
32 | // The panel which implements the Relogin button |
---|
33 | // |
---|
34 | |
---|
35 | class ReloginPanel extends Panel implements ActionListener { |
---|
36 | Button reloginButton; |
---|
37 | Button closeButton; |
---|
38 | VncViewer viewer; |
---|
39 | |
---|
40 | // |
---|
41 | // Constructor. |
---|
42 | // |
---|
43 | public ReloginPanel(VncViewer v) { |
---|
44 | viewer = v; |
---|
45 | setLayout(new FlowLayout(FlowLayout.CENTER)); |
---|
46 | reloginButton = new Button("Login again"); |
---|
47 | add(reloginButton); |
---|
48 | reloginButton.addActionListener(this); |
---|
49 | if (viewer.inSeparateFrame) { |
---|
50 | closeButton = new Button("Close window"); |
---|
51 | add(closeButton); |
---|
52 | closeButton.addActionListener(this); |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | // |
---|
57 | // This method is called when a button is pressed. |
---|
58 | // |
---|
59 | public synchronized void actionPerformed(ActionEvent evt) { |
---|
60 | if (viewer.inSeparateFrame) |
---|
61 | viewer.vncFrame.dispose(); |
---|
62 | if (evt.getSource() == reloginButton) |
---|
63 | viewer.getAppletContext().showDocument(viewer.getDocumentBase()); |
---|
64 | } |
---|
65 | } |
---|