• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compiletimerror

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
when i compile this code which is given below.
it shows an error.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class TextFieldDemo1 extends Applet implements ActionListener {
TextField name, pass;
public void init() {
Label namep = new Label("Name:", Label.RIGHT);
Label passp = new Label("Password:", Label.RIGHT);
name = new TextField(12);
pass = new TextField(8);
pass.setEchoChar('?');
add(namep);
add(name);
add(passp);
add(pass);
name.addActionListener(this);
pass.addActionListener(this);
}
public void actionPerformed(ActionEvent ae) {
repaint();
}
public void paint (Graphics g)
{
g.drawString("Name: " + name.getText(),6, 60);
g.drawString("Selected text in name" + name.getSelectedText(),6, 80);
g.drawString("Password " + pass.getText(),6, 100);

}
}
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ali,
I don't know what I did wrong, but when I compiled your class on my Windows XP machine with J2SE SDK 1.4.2, I didn't get an error. I also managed to execute the applet using the "appletviewer". I hope that's all right?
Perhaps you could give me a clue about what sort of error I am meant to get (so I can try again).
Good Luck,
Avi.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic