KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > naming > namemanager > InfoDlg


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.naming.namemanager;
22
23 import javax.swing.*;
24 import javax.swing.border.*;
25 import java.awt.*;
26 import java.awt.event.*;
27
28 public class InfoDlg
29 extends JDialog
30 implements ActionListener
31 {
32     public InfoDlg(Frame frame, String JavaDoc typeid, String JavaDoc objkey,
33         String JavaDoc version, String JavaDoc host, String JavaDoc port)
34     {
35         super(frame,"Info");
36         JPanel mainPanel=new JPanel();
37         getContentPane().add(mainPanel);
38         JPanel hiPanel=new JPanel(new GridLayout(3,1));
39         JPanel midPanel=new JPanel(new GridLayout(3,1));
40         JPanel loPanel=new JPanel();
41
42         JLabel label;
43         label=new JLabel(" TypeID: "+typeid+" "); hiPanel.add(label);
44         label=new JLabel(" Object Key: "+objkey+" "); hiPanel.add(label);
45         label=new JLabel(" "); hiPanel.add(label);
46
47         Border tmp=BorderFactory.createEtchedBorder();
48         TitledBorder border=
49             BorderFactory.createTitledBorder(tmp,"IIOP info");
50         midPanel.setBorder(border);
51         label=new JLabel(" Version: "+version); midPanel.add(label);
52         label=new JLabel(" Host: "+host); midPanel.add(label);
53         label=new JLabel(" Port: "+port); midPanel.add(label);
54
55         JButton ok=new JButton("Ok");
56         loPanel.add(ok);
57         ok.addActionListener(this);
58
59         // Jetzt die Panels richtig einfuegen
60
GridBagLayout gridbag=new GridBagLayout();
61         GridBagConstraints c=new GridBagConstraints();
62         mainPanel.setLayout(gridbag);
63
64         c.anchor=GridBagConstraints.EAST;
65         c.fill=GridBagConstraints.BOTH;
66         c.weightx=0.6; c.weighty=0.2;
67         c.gridx=0; c.gridy=0; c.gridheight=3; c.gridwidth=1;
68
69         gridbag.setConstraints(hiPanel,c);
70         mainPanel.add(hiPanel);
71
72         c.gridy=3; c.gridheight=3; c.gridwidth=2;
73         gridbag.setConstraints(midPanel,c);
74         mainPanel.add(midPanel);
75
76         c.gridy=6; c.gridheight=1; c.gridwidth=2;
77         gridbag.setConstraints(loPanel,c);
78         mainPanel.add(loPanel);
79     }
80     public void actionPerformed(ActionEvent e) { dispose(); }
81 }
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Popular Tags