Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Java Programming, java.applet.awt help?
For some reason the applet is not showing up when I run the program. If anyone has any idea why please share that with me. Thanks!
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class App extends Frame {
App(){
setSize(300,300);
setTitle("Health Tip Generator");
setVisible(true);
}
public static void main(String[] args){
Frame f = new Frame();
Button b = new Button("Click me for a Health tip");
TextField tf = new TextField ("Eat lots of fruits and vegetables!");
b.setBounds(100,200,100,15);
tf.setBounds(100,250,150,20);
f.add(b);
f.add(tf);
}
}
3 Answers
- Anonymous9 years agoFavorite Answer
what exactly are you trying to do? If you want an applet you should be using javax.swing.JApplet except there is an older version which is awt java.awt.Applet. I did a quick search on google and this: http://profs.etsmtl.ca/mmcguffin/learn/java/ may be able to help you.
- 9 years ago
just place public before App() constructor. it should be like this:
.....
public App(){
setSize(300,300);
setTitle("Health Tip Generator");
set......