This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

applet closing?  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi javaites!
please tell me
how to close a applet progamatically?/
[This message has been edited by aseem kapoor (edited June 26, 2000).]
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[applet is same as you do the normal program. I will give you a sample do the same and see . this would help you a lot
/**** code bigins here ****/
//<applet code = sampleproject width = 100 height = 200></applet>;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class sampleproject extends Applet {
TextField login,password;
Label log, pass, name, dob;
Button enter, regester;
public void init()
{
setLayout(new GridLayout(9,3));
Panel o = new Panel();
add(o);
Panel p = new Panel();
log = new Label("Login Name:");
p.add(log);
login = new TextField(10);
p.add(login);
add(p);
Panel p1 = new Panel();
pass = new Label("Password:");
p1.add(pass);
password = new TextField(10);
p1.add(password);
add(p1);
Panel p2 = new Panel();
regester = new Button("Sign me up");
p2.add(regester);
regester.addActionListener(this);
enter = new Button("please Login");
p2.add(enter);
add(p2);
}
}
/******** the program ends here**********/
I think it may help you


 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Put a button ( call it button1) on your applet and do the following:
1- make your applet implements ActionListener
2- put in your init method: button1.addActionListener(this);
3- add the method : public void actionPerformed(Actionevent e)
{
System.exit(0);
}
I hope that will help.
 
permaculture is giving a gift to your future self. After reading this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!