home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
main.bin
/
vpojava.DLL
/
SOURCE
/
ATTENTION_DIALOG
< prev
next >
Wrap
Text File
|
1998-03-18
|
3KB
|
111 lines
import java.awt.*;
import java.awt.Button;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.Label;
import java.awt.FlowLayout;
import java.net.URL;
import symantec.itools.multimedia.ImageViewer;
import symantec.itools.awt.util.dialog.ModalDialog;
public class AttentionDialog extends ModalDialog
{
public AttentionDialog(Frame parent, String title, String message, URL iconURL)
{
super(parent, title);
if (iconURL != null)
{
ImageViewer img = new ImageViewer(iconURL);
add(img);
}
// 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 FlowLayout(FlowLayout.LEFT,5,5));
addNotify();
setSize(270,73);
label1 = new java.awt.Label("");
label1.setBounds(5,5,14,21);
add(label1);
okButton = new java.awt.Button("OK");
okButton.setBounds(24,5,26,21);
add(okButton);
//}}
label1.setText(message);
//{{REGISTER_LISTENERS
SymAction lSymAction = new SymAction();
okButton.addActionListener(lSymAction);
//}}
}
public AttentionDialog(Frame parent)
{
this(parent, "Attention", "Event", null);
}
// Add a constructor for Interactions (ignoring modal)
public AttentionDialog(Frame parent, boolean modal)
{
this(parent);
}
// Add a constructor for Interactions (ignoring modal)
public AttentionDialog(Frame parent, String message, boolean modal)
{
this(parent, "Attention", message, null);
}
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension d = getSize();
super.addNotify();
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.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;
}
// Used for addNotify check.
boolean fComponentsAdjusted = false;
//{{DECLARE_CONTROLS
java.awt.Label label1;
java.awt.Button okButton;
//}}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == okButton)
okButton_ActionPerformed(event);
}
}
void okButton_ActionPerformed(java.awt.event.ActionEvent event)
{
dispose();
}
}