home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
WDESAMPL.BIN
/
NervousTextClass.java
< prev
next >
Wrap
Text File
|
1998-02-26
|
5KB
|
203 lines
/*
A basic extension of the java.awt.Frame class
*/
import java.awt.*;
import symantec.itools.multimedia.*;
import symantec.itools.multimedia.NervousText;
public class NervousTextClass extends Frame
{
public NervousTextClass()
{
// 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(null);
setVisible(false);
setSize(492,270);
setBackground(new Color(65535));
nervousText1 = new symantec.itools.multimedia.NervousText();
try {
nervousText1.setText(" Nervous Text");
}
catch(java.beans.PropertyVetoException e) { }
nervousText1.setBounds(2,28,487,57);
add(nervousText1);
button1 = new java.awt.Button();
button1.setActionCommand("button");
button1.setLabel("Change");
button1.setBounds(256,200,60,40);
add(button1);
button2 = new java.awt.Button();
button2.setActionCommand("button");
button2.setLabel("Close");
button2.setBounds(337,200,60,40);
add(button2);
button3 = new java.awt.Button();
button3.setActionCommand("button");
button3.setLabel("Pause");
button3.setBounds(175,200,60,40);
add(button3);
button4 = new java.awt.Button();
button4.setActionCommand("button");
button4.setLabel("Start");
button4.setBounds(94,200,60,40);
add(button4);
setTitle("Untitled");
//}}
//{{INIT_MENUS
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
button1.addActionListener(lSymAction);
button2.addActionListener(lSymAction);
button3.addActionListener(lSymAction);
button4.addActionListener(lSymAction);
//}}
}
public NervousTextClass(String title)
{
this();
setTitle(title);
}
public synchronized void show()
{
move(50, 50);
super.show();
}
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
symantec.itools.multimedia.NervousText nervousText1;
java.awt.Button button1;
java.awt.Button button2;
java.awt.Button button3;
java.awt.Button button4;
//}}
//{{DECLARE_MENUS
//}}
class SymWindow extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == NervousTextClass.this)
Frame1_WindowClosing(event);
}
}
void Frame1_WindowClosing(java.awt.event.WindowEvent event)
{
hide(); // hide the Frame
dispose();
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == button1)
button1_Action(event);
else if (object == button2)
button2_Action(event);
else if (object == button3)
button3_Action(event);
else if (object == button4)
button4_Action(event);
}
}
void button1_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
//{{CONNECTION
// Set the text for NervousText...
{
try {
nervousText1.setText("You just Changed the text");
}
catch(java.beans.PropertyVetoException e) { }
}
//}}
}
void button2_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
//{{CONNECTION
// Hide the Frame
setVisible(false);
dispose();
//}}
}
void button3_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
//{{CONNECTION
// Pause the NervousText
{
try {
nervousText1.setPaused(true);
}
catch(java.beans.PropertyVetoException e) { }
}
//}}
}
void button4_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
//{{CONNECTION
// Resume the NervousText
{
try {
nervousText1.setPaused(false);
}
catch(java.beans.PropertyVetoException e) { }
}
//}}
}
}