Applet not appearing full

Here’s another variation on your layout. Using @Andrew’s tag-in-source method, it’s easy to test from the command line: $ /usr/bin/appletviewer HomeApplet.java // <applet code=”HomeApplet” width=”400″ height=”200″></applet> import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class HomeApplet extends JApplet { @Override … Read more

JApplet creates a ball that bounces and gets progressively less high in Java

This is a basic example of the idea Basically, when you press the spacebar, it generates a vertical movement which slows over time till it runs out of energy, it will then fall and rebound until it has run out of “bounce” import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import … Read more

Embed a 3rd-party JApplet in a Swing GUI & pass it parameters

Implement an AppletStub & set it as the stub of the applet instance. E.G. /* <applet code=”ParamApplet” width=”200″ height=”200″> <param name=”param” value=”foo”> </applet> */ import java.applet.*; import javax.swing.*; import java.net.URL; import java.util.HashMap; public class ParamApplet extends JApplet { public void init() { String param = getParameter(“param”); System.out.println(“parameter: ” + param); add(new JLabel(param)); } public static … Read more