Results 1 to 2 of 2
  1. #1
    abrium is offline Member
    Join Date
    Jul 2010
    Rep Power

    Default embed a frame in webpage

    Ladies and Gentlemen,

    Is it possible to embed a frame in a webpage? So pretty much make a frame mimic an applet?

    I am using the init(); to pack, validate, and display the frame but when I run as an applet the init(); has a JOptionPane that gathers input and once it closes a frame acts like a pop up instead of staying inside the applet. Any help?

    The code:

    Java Code:
    package appletPackage;
    import java.awt.Graphics;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JOptionPane;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import java.awt.BorderLayout;
    import java.awt.Point;
    import java.awt.Color;
    import java.awt.Stroke;
    import java.awt.Graphics2D;
    import java.awt.BasicStroke;
    public class runFrame extends JApplet {
    			static double cirRadius = 0;
    			static Point cirCenter = new Point(0,0);
    	public runFrame(){
    	public void init(){
    		String cirInput;
    		cirInput = JOptionPane.showInputDialog("Please provide a double as the radius of the circle:");
    		double cirVar = Double.parseDouble(cirInput);
    		cirRadius = cirVar;
    					JFrame frame = new JFrame("Pig Latin Project 3");
    			JButton btnGo = new JButton("Enter");
    			JPanel panel = new JPanel();
    			frame.add(btnGo, BorderLayout.SOUTH);
    			frame.add(panel, BorderLayout.CENTER);

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    a frame acts like a pop up instead of staying inside the applet.
    Can you explain what "acts like a pop up" means?
    A JFrame creates a window that can be moved around like any other window.
    What does "staying inside the applet" mean? The applet is displayed on the browser's window.

Similar Threads

  1. embed videos in the jsp
    By javastuden in forum Java Servlet
    Replies: 3
    Last Post: 06-16-2010, 10:17 AM
  2. how to embed .jar in web page?
    By clydedoris in forum New To Java
    Replies: 0
    Last Post: 03-10-2010, 12:54 AM
  3. Replies: 7
    Last Post: 11-02-2009, 06:31 PM
  4. [SOLVED] App embed in webpage - netbeans 6.5
    By dbashby in forum New To Java
    Replies: 8
    Last Post: 03-20-2009, 01:31 AM
  5. How to embed Swing and AWT in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts