Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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());
}
}
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic