3 package org.bitstorm.util;
5 import java.awt.AWTEvent;
6 import java.awt.Button;
7 import java.awt.Dialog;
9 import java.awt.FlowLayout;
10 import java.awt.Frame;
11 import java.awt.GridBagConstraints;
12 import java.awt.GridBagLayout;
13 import java.awt.GridLayout;
14 import java.awt.Image;
15 import java.awt.Label;
16 import java.awt.Panel;
17 import java.awt.Toolkit;
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ActionListener;
39 public AboutDialog( Frame parent, String title, String[] lines, String imageName,
int posX,
int posY ) {
40 super( parent, title,
false );
42 Image image = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource(imageName));
44 okButton =
new Button(
" OK ");
45 okButton.addActionListener(
46 new ActionListener() {
47 public void actionPerformed(ActionEvent e) {
53 GridBagLayout gridbag =
new GridBagLayout();
54 GridBagConstraints contraints =
new GridBagConstraints();
57 Panel buttonPanel =
new Panel();
58 buttonPanel.setLayout(
new FlowLayout( FlowLayout.CENTER ) );
59 buttonPanel.add( okButton );
61 Panel textPanel =
new Panel();
62 textPanel.setLayout(
new GridLayout( lines.length, 1 ) );
63 for (
int i=0; i<lines.length; i++) {
64 textPanel.add(
new Label(lines[i]));
66 contraints.fill = GridBagConstraints.BOTH;
67 contraints.weightx = 1;
68 contraints.weighty = 1;
69 contraints.gridx = GridBagConstraints.REMAINDER;
71 contraints.anchor = GridBagConstraints.CENTER;
72 gridbag.setConstraints(ic, contraints);
74 contraints.fill = GridBagConstraints.NONE;
75 contraints.weightx = 0;
76 contraints.weighty = 0;
78 gridbag.setConstraints(textPanel, contraints);
81 gridbag.setConstraints(buttonPanel, contraints);
84 enableEvents(Event.WINDOW_DESTROY);
85 setResizable(
false );
88 setLocation( posX, posY );
104 if ( e.getID() == Event.WINDOW_DESTROY )
AboutDialog(Frame parent, String title, String[] lines, String imageName, int posX, int posY)
void processEvent(AWTEvent e)