Article View: be.comp.programming
Article #12700Re: java-script (java en geen javascript)
From: An Ony
Date: Mon, 15 Oct 2001 08:36
Date: Mon, 15 Oct 2001 08:36
90 lines
2798 bytes
2798 bytes
import java.awt.*;
import java.awt.event.*;
class todo extends
me{
TextField Invoer;
List Lijst;
// hier zat uw fout: moesten globaal gedeclareerd worden
public todo(){
setTitle("To-do list");
Button BToe;
Button BEinde;
Invoer = new TextField();
Lijst = new List(7);
BToe = new Button("Toevoegen");
BEinde = new Button("Einde");
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
//Invoer, Textfield
c.gridx = 0;
c.gridy = 0;
c.gridheight = 1;
c.gridwidth = 5;
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(5,5,5,5);
add(Invoer , c);
//Toevoegen, Button
c.gridx = 3;
c.gridy = 1;
c.gridheight = 1;
c.gridwidth = 2;
add(BToe , c);
//Einde, Button
c.gridx = 3;
c.gridy = 7;
c.gridheight = 1;
c.gridwidth = 2;
add(BEinde , c);
//Lijst, List
c.gridx = 0;
c.gridy = 1;
c.gridheight = 7;
c.gridwidth = 3;
c.fill = GridBagConstraints.BOTH;
add(Lijst , c);
// _________________________________________________________
// HANDELINGEN
//__________________________________________________________
//WindowListener
addWindowListener (new WindowAdapter() {
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
//Einde
BEinde.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
//Toevoegen
BToe.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
Lijst.add(Invoer.getText() );
}
});
pack();
setVisible(true);
}
public static void main (String[] args) {
new todo();
}
}
--
Dietmar Hertsen
dhertsen@mailandnews.com
www.sphosting.com/dietmar
Technical Details
Message-ID:
<9qe770$h1f$1@inf6serv.rug.ac.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.wirehub.nl!newsfeeds.belnet.be!naxos.belnet.be!news.belnet.be!inf6serv.rug.ac.be!not-for-mailReferences:
<3BC9CA59.975EE69E@mailandnews.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,21ee1e79b35d7ae7 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2001-10-15 01:45:13 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.wirehub.nl!newsfeeds.belnet.be!naxos.belnet.be!news.belnet.be!inf6serv.rug.ac.be!not-for-mail From: "An Ony" <Dontknow@thatserver.com> Newsgroups: be.comp.programming Subject: Re: java-script (java en geen javascript) Date: Mon, 15 Oct 2001 10:36:04 +0200 Organization: University of Ghent, Belgium Lines: 93 Message-ID: <9qe770$h1f$1@inf6serv.rug.ac.be> References: <3BC9CA59.975EE69E@mailandnews.com> NNTP-Posting-Host: astr0323.rug.ac.be X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200