Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent ae)
if (ae.getSource()==b1)
{
work = (String)intext.getText();
intext.setText("");
addToVector();
}
if (ae.getSource()==b2)
{
work = (String)outext.getText();
if (findString())
outext.setText("Job removed");
else
outext.setText("Job not found");
}
if (ae.getSource()==b3)
listJobs();
if (ae.getSource()==b4)
{
v1.clear();
//space.setText("");
}
|
public void | addToVector()
v1.addElement(work);
|
public boolean | findString()
boolean b=false;
if (!(v1.isEmpty()))
{
for (int i=0; i<v1.size(); i++)
{
if (work.equals((String)v1.elementAt(i)))
{
b = true;
v1.remove(i);
} // endif
} // end for
} //endif
return b;
|
public void | getFromVector()
if (!(v1.isEmpty()))
{
work=(String) v1.firstElement();
v1.remove(0);
}
else
work="No Jobs";
|
public void | init()
b1 = new Button ("Enter Job");
b2 = new Button ("Completed Job");
b3 = new Button("List Jobs");
b4 = new Button("Clear All Jobs");
intext = new TextField(10);
outext = new TextField(10);
space = new TextArea(10,40);
v1 = new Vector ();
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
intext.addActionListener(this);
add(b1); add (intext); add(b2); add (outext); add(b3); add (b4);
add(space);
|
public void | listJobs()
space.setText(" ");
if (v1.size()>0)
{
for (int i=0; i<v1.size(); i++)
{
work=(String) v1.elementAt(i);
space.append(work + "\n");
}
}
else
{
space.append("No Jobs in List");
}
|
public void | paint(java.awt.Graphics g)
|