home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
VCSAMPL.BIN
/
AboutDialog.java
< prev
next >
Wrap
Text File
|
1997-09-09
|
4KB
|
134 lines
/*
A basic extension of the java.awt.Dialog class
*/
import java.awt.*;
import java.io.*;
import symantec.itools.awt.WrappingLabel;
public class AboutDialog extends Dialog {
private final String aboutTxtFile = "EmployeeDataManager.txt";
void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) {
dispose();
}
void okButton_Clicked(java.awt.event.ActionEvent event) {
//{{CONNECTION
// Clicked from okButton dispose the Dialog
dispose();
//}}
}
public AboutDialog(Frame parent, boolean modal) {
super(parent, modal);
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(new BorderLayout(0,0));
setVisible(false);
setSize(insets().left + insets().right + 1079,insets().top + insets().bottom + 320);
setBackground(new Color(12632256));
panel1 = new java.awt.Panel();
panel1.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
panel1.setBounds(insets().left + 0,insets().top + 287,1079,33);
add("South", panel1);
okButton = new java.awt.Button();
okButton.setLabel("OK");
okButton.setBounds(109,5,31,23);
panel1.add(okButton);
textArea1 = new java.awt.TextArea();
textArea1.setEditable(false);
textArea1.setBounds(insets().left + 0,insets().top + 0,1079,287);
textArea1.setBackground(new Color(12632256));
add("Center", textArea1);
setTitle("About");
//}}
//{{REGISTER_LISTENERS
Window lWindow = new Window();
addWindowListener(lWindow);
Action lAction = new Action();
okButton.addActionListener(lAction);
//}}
try {
BufferedReader b = new BufferedReader(new InputStreamReader(new FileInputStream(aboutTxtFile)));
String s = b.readLine();
while(s!=null) {
textArea1.appendText(s+"\n");
s = b.readLine();
}
} catch (IOException e) {}
}
public AboutDialog(Frame parent, String title, boolean modal) {
this(parent, modal);
setTitle(title);
}
public void addNotify()
{
super.addNotify();
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
setSize(insets().left + insets().right + getSize().width, insets().top + insets().bottom + getSize().height);
Component components[] = getComponents();
for (int i = 0; i < components.length; i++)
{
Point p = components[i].getLocation();
p.translate(insets().left, insets().top);
components[i].setLocation(p);
}
fComponentsAdjusted = true;
}
boolean fComponentsAdjusted = false;
public synchronized void show()
{
Rectangle bounds = getParent().bounds();
Rectangle abounds = bounds();
move(bounds.x + (bounds.width - abounds.width)/ 2,
bounds.y + (bounds.height - abounds.height)/2);
super.show();
}
//{{DECLARE_CONTROLS
java.awt.Panel panel1;
java.awt.Button okButton;
java.awt.TextArea textArea1;
//}}
class Window extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == AboutDialog.this)
AboutDialog_WindowClosing(event);
}
}
class Action implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == okButton)
okButton_Clicked(event);
}
}
}