Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

applets opening a browser of a particular size

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has to be obvious to people that do alot of AWT.
I have an AWT application that:
1)when a particular event occurs in the applet(such as a button being pressed).
2)the applet must lauch a new browser window to a particular URl and the new window must be of a particular size.

I can open a new window, but I cannot figure out how to control the dimensions of the browser.

import java.applet.Applet;
import java.applet.AppletContext;
import java.net.MalformedURLException;
import java.net.URL;
/*
* Created on Apr 6, 2004
*/
/**
* @author pmcooke
*
*/
public class AwtComponents extends Applet {
private java.awt.Button ivjButton1 = null;
public AwtComponents() {
super();
initialize();
}
/**
* Return the Button1 property value.
* @return java.awt.Button
*/
private java.awt.Button getButton1() {
if (ivjButton1 == null) {
ivjButton1 = new java.awt.Button();
ivjButton1.setName("Button1");
ivjButton1.setLabel("Button");
ivjButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("hello world");
AppletContext appletContext = getAppletContext();
try {
URL url = new URL("http://localhost:9080/foo/bar.html";);
appletContext.showDocument(url, "_blank");

}
catch (MalformedURLException e1) {
e1.printStackTrace();
}
}
});
}
return ivjButton1;
}
/**
* Initialize the class.
*/
private void initialize() {
this.setName("Frame1");
this.setLayout(new java.awt.FlowLayout());
this.setBounds(45, 25, 270, 227);
this.add(getButton1(), getButton1().getName());
}
}
    Bookmark Topic Watch Topic
  • New Topic