Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Spawing an applet in a window of a certain size.

Posted on 2004-08-17
12
Medium Priority
?
335 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 600 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 600 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 800 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 This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

721 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