• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

compiletimerror

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!