K
Kevin Holmes
I can't seem to get this darn frame to resize (or setsize) when the applet
is launched. All I get is a little frame window which I can then maximize
and see my applet. I think I have tried ever possible combination of the
Frame methods. Could someone please lend a helping hand.
Here is my watered down code.
import java.awt.*;
public class test extends java.applet.Applet implements Runnable {
static volatile Image currentimg;
static volatile Graphics currentGraphics;
Thread runner;
Frame myframe;
static Dimension d;
public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
runner.stop();
runner = null;
}
}
public void init() {
myframe = new Frame("Test Applet");
d = Toolkit.getDefaultToolkit().getScreenSize();
myframe.setSize(d.width, d.height);
myframe.add(this);
myframe.setVisible(true);
myframe.pack();
myframe.show();
currentGraphics = getGraphics();
paint(currentGraphics);
}
public void run() {
}
public void update(Graphics g) {
paint(g);
}
public void paint(Graphics g) {
g.drawString("hello world",10,20);
}
}
is launched. All I get is a little frame window which I can then maximize
and see my applet. I think I have tried ever possible combination of the
Frame methods. Could someone please lend a helping hand.
Here is my watered down code.
import java.awt.*;
public class test extends java.applet.Applet implements Runnable {
static volatile Image currentimg;
static volatile Graphics currentGraphics;
Thread runner;
Frame myframe;
static Dimension d;
public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
runner.stop();
runner = null;
}
}
public void init() {
myframe = new Frame("Test Applet");
d = Toolkit.getDefaultToolkit().getScreenSize();
myframe.setSize(d.width, d.height);
myframe.add(this);
myframe.setVisible(true);
myframe.pack();
myframe.show();
currentGraphics = getGraphics();
paint(currentGraphics);
}
public void run() {
}
public void update(Graphics g) {
paint(g);
}
public void paint(Graphics g) {
g.drawString("hello world",10,20);
}
}