How to Fullscreen an Applet

104 1
    • 1). Click “Start,” “All Programs” and “NetBeans” to open the NetBeans Integrated Development Environment. Click “File” and “New” to enter the “New File” window. Select “Java” from the categories and select “Java File” from the “File Types.”

    • 2). Enter a class name for the new file “MyApplet.” Click “OK” to close the new file creation window.

    • 3). Click “MyApplet.java” tab to enter the code interface. Include Applet class using the following code:
      import java.awt.*;
      import java.applet.*;
      import java.awt.GraphicsEnvironment;

    • 4). Create a public class MyApplet, define a JFrame variable and create a public function paint:
      Public class MyApplet extends Applet
      {
      JFrame jframe;
      fFrame = new ParticleFrame (this);
      fFrame.setVisible (true);
      public void paint(Graphics g)
      {
      g.drawString("Hi",20,20);
      g.drawString("This is my first Applet",20,40);
      }
      }

    • 5). Make the jframe full screen via code:
      GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(jframe);

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.