Solved

Spawing an applet in a window of a certain size.

Posted on 2004-08-17
12
332 Views
Last Modified: 2008-03-10
Hi there experts, well I am trying to popup a new Java applet that is in a webpage, but I would like to limit the browser window to be a specific size with no File menu, explorer bars, address bars or anything.  Just a generic browser window with my applet in it?  Is that possible from Java?  Right now I can call

         try
         {
            getAppletContext().showDocument(new URL(URL_ac),"HTML frame ID");
         }
         catch (MalformedURLException ex)
         {
         }

but that displays a full sized window with all the toolbars.  Thanks in advance.
0
Comment
Question by:kesea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 92

Expert Comment

by:objects
ID: 11827657
you need to use javascript
0
 
LVL 92

Expert Comment

by:objects
ID: 11827712
eg.

window.open('page.html','popupPage','width=500,height=500,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no')
0
 
LVL 7

Expert Comment

by:JugglerW
ID: 11827934
Change your page with the applet in:

<html>
...
<body onLoad="window.resizeTo(640,480)" >
    <applet width="100%" height="100%">
    ...
   </applet>
</body>

This resizes the window to 640 x 480
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 35

Expert Comment

by:girionis
ID: 11827953
I do not think you can do it from inside your applet. What you could do would be to follow objects' suggestion and add a few more code that it will make it look like your are only creating one window.

 try
         {
            getAppletContext().showDocument(new URL("myfile.html"),"HTML frame ID");
         }
         catch (MalformedURLException ex)
         {
         }

myfile.html

<html>
   <head>
   <script language="JavaScript">
   function showApplet()
   {
       appletWindow = window.open('page.html','popupPage','width=500,height=500,resizable=no,scrollbars=no,
                                  menubar=no,toolbar=no,directories=no,location=no,status=no');
       window.close();
   }
   </script>
   </head>
   <body onLoad="showApplet();">
   </body>
</html>

page.html

<html>
   <body>
      <applet.....>
   </body>
</html>

So you basically you load up an HTML file, from inside this file you popup another window with the properties you want and which have the applet and then you close the parent window.
0
 
LVL 92

Expert Comment

by:objects
ID: 11827974
try using showDocument to display:

URL_ac = "javascript:window.open('page.html','popupPage','width=500,height=500,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no'";
0
 
LVL 35

Accepted Solution

by:
girionis earned 150 total points
ID: 11827993
0
 

Author Comment

by:kesea
ID: 11833569
Ok, I tried using the
URL_ac = "javascript:window.open('page.html','popupPage','width=500,height=500,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no'";

But it didn't work.  Do I have to do something to enable Javascript?
0
 
LVL 35

Expert Comment

by:girionis
ID: 11833789
Look at the link I posted above. It shows you how you can call javascript from within an applet.
0
 
LVL 1

Assisted Solution

by:vishalbhando
vishalbhando earned 150 total points
ID: 11835653
Another way is to create an applet .. make a width of 0 and height of 0 .. so that it is hidden from your actual screen.

and from within this Applet class you can create an instance of a Frame and make it with the size 500x500.. Program all functionality within this frame class.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 200 total points
ID: 11836424
> Do I have to do something to enable Javascript?

yes you need to add mayscript to your applet tag
0
 
LVL 92

Expert Comment

by:objects
ID: 11838013
0
 
LVL 35

Expert Comment

by:girionis
ID: 11838471
:)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question