Please tell why I always getting the same size of the applet?
In my Netbeans 8.1, <applet? Tag is not changing the size of the applet , just showing in the same standard size? What should I do?
This is my code:
package online.book.store;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="Home_Page" width=300 height=800> </applet>
*/
class SampleFrame extends Frame { SampleFrame(String title) {
super(title);
MyWindowAdapter adapter = new MyWindowAdapter(this);
addWindowListener(adapter);
}
public void paint(Graphics g) {
g.drawString("This is in frame window", 50, 90);
}
}
class MyWindowAdapter extends WindowAdapter { SampleFrame sampleFrame;
public MyWindowAdapter(SampleFrame sampleFrame) { this.sampleFrame = sampleFrame;
define the
getPreferredSize()in the frameBecause
Appletis deprecated I would not spend too much time on the subject.An
Appletcan't change the size of the frame in which it is executed, regardless of whether it is executed in a browser,Framewindow or applet-viewer. You have to set the size of theFrame(see above). The<applet>tags are meanwhile unsupported in nearly every browser.