[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

how to open a new window with specialized attributes(width,Height,etc)?

i have tried getAppletContext().showDocument(url),but it just to go a new URL,not a new window.

and i want to open a new window with specialized attributes:position,width,height,etc.

anyone can help me? thank you.
  • 2
1 Solution
Hi Mike2000,

 It's very simple.

 Add one another String as parameter to showdocument.

Sample code

import java.awt.*;
import java.net.*;
import java.applet.*;

public class NewWin extends Applet {

  public void init() {
  try {
      AppletContext ac = getAppletContext();
      ac.showDocument(new               URL("http://yourserver/yourfile.html"),"Junk" );
       } catch ( Exception ee ) { ee.printStackTrace();}

With onlu URL parameter, it will open same window.

If you give second parameter in the method, it will opne in different window.

Best of luck
Mike2000Author Commented:
but i can't find any method to initialize the new window's width and height and position.

Hi Mike2000,

 Actually the above method is for redirecting htnl page to frames. Since we have given junk string, it opened a new window
The secnod parameter is  "Target" . If you have already a frame, it will come in that frame.

I din n't find method to fix height and width of window. This
metho i found in

AppletContext class

Best of luck

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now