dcsimg
ActionEvent not working
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andrew_Nisbet
Posted On:   Tuesday, December 18, 2001 01:04 PM

I am trying to get an action event to load a new web page when a button is pushed within an applet. unfortunatly I can't get the action event to fire. Here is the code: // contained in a try block in //public Applet Start() test = new Button("testing buttons"); test.setBackground(Color.blue); act = new Signal(this); test.addActionListener(act); add(test); class Signal implements ActionListener { private Tickerapplet applet; private URL link; public Signal (Tickerapplet ap) { applet = ap; try { link = new URL("http","www.mtconnect.com/prosignal/admin", "testing.html"   More>>

I am trying to get an action event to load a new web page when a button is pushed within an applet. unfortunatly I can't get the action event to fire.

Here is the code:
// contained in a try block in
//public Applet Start()
test = new Button("testing buttons");
test.setBackground(Color.blue);
act = new Signal(this);
test.addActionListener(act);
add(test);


class Signal implements ActionListener
{
private Tickerapplet applet;
private URL link;

public Signal (Tickerapplet ap)
{
applet = ap;
try
{
link = new URL("http","www.mtconnect.com/prosignal/admin", "testing.html");
}
catch (MalformedURLException e)
{}


}

public void actionPerformed(ActionEvent evt)
{

applet.test.setVisible(false);

if (evt.getSource() == applet.test)
{

try
{
JEditorPane pane = new JEditorPane();
pane.setPage(link);

}
catch (IOException e)
{}


}


}
}




there is a thread which refreshes the applet every second.

Any ideas on what I am doing wrong????

Thanks

   <<Less
About | Sitemap | Contact