Raining outside the Applet Window ! HELP

I have set the coding for an applet 800 pixels by 800 pixels .
The Mozilla Firefox browser window cannot be modified to be that size and it is raining outside the applet !
How do I modify the RainCloud class so it only rains within
800 pixels in the x direction ?
Below is the RainCloud class and the rest
Thank you in advance
//@ applet is from "An Eventful Approach" by Murtagh and Bruce
import objectdraw.*;
import java.awt.*;
public class RainCloud2 extends ActiveObject
    private static final int MAX_DROPS = 1000000;
    private static final int DELAY_TIME = 10;
    private DrawingCanvas canvas;
    private RandomIntGenerator xGenerator;
    public RainCloud2(DrawingCanvas canvas)
        this.canvas = canvas;
        xGenerator = new RandomIntGenerator(0,canvas.getWidth());
        start();
    public void run()
        int dropCount = 0;
        while (dropCount < MAX_DROPS)
               new FallingBall(new Location(xGenerator.nextValue(), 0), canvas);
               pause(DELAY_TIME);
               dropCount++;
import objectdraw.*;
import java.awt.*;
public class FallingBall3 extends ActiveObject
        private static final int BALLSIZE = 4;
        private static final int TOP = 50;
        private static final int BOTTOM = 600;
        private static final int SCREENWIDTH = 400;
        private static final double Y_SPEED = 4;
        private static final int DELAY_TIME = 33;
        private DrawingCanvas canvas;
        private FilledOval ball;
        public FallingBall3(Location startPoint, DrawingCanvas aCanvas)
                canvas = aCanvas;
                ball = new FilledOval(startPoint ,
                                      BALLSIZE, BALLSIZE, canvas);
                start();
        public void run()
                while (ball.getY() < 240)
                        ball.move(0, Y_SPEED);
                        pause(DELAY_TIME);
                ball.hide();
import objectdraw.*;
import java.awt.*;
public class Sun2  extends ActiveObject
   private static final int BALLSIZE = 80;
   private static final double PAUSE_TIME = 190;
   private static final int TOP = 50;
   private static final int BOTTOM = 400;
   private static final int SCREENWIDTH = 400;
   private static final double Y_SPEED = -8;
   private DrawingCanvas canvas;
   private FilledOval sun;
    public Sun2(DrawingCanvas aCanvas)
      canvas = aCanvas;
      sun = new FilledOval(SCREENWIDTH/2,BOTTOM,BALLSIZE,BALLSIZE,canvas);
      sun.setColor(Color.yellow);
      start();
    public void run()
       while(sun.getY()  >  30 )
          sun.move(0, Y_SPEED);
          pause(PAUSE_TIME);
        //sun.hide();
import objectdraw.*;
import java.awt.*;
public class Grass extends WindowController{
        private static final int SCREENLEFT = 0;
        private static final int SCREENTOP = 0;
        private static final int SCREENHEIGHT = 400;
        private static final int SCREENWIDTH = 500;
        private static final int SUN_INSET = 50;
        private static final int SUN_SIZE = 70;
        private static final double GRASS_LINE = SCREENHEIGHT*0.63;
        private static final double GRASS_HEIGHT = SCREENHEIGHT*.04;
        private static final double SKY_LINE = GRASS_LINE + GRASS_HEIGHT;
        private static final double GRASS_WIDTH = 2;
        private static final Color SKYBLUE = new Color(100,100,200);
        private static final Color GRASSGREEN = new Color(0,200,0);
        public void begin()
            double bladePosition;  // where to draw next blade of grass
                        // draw solid sky, grass and sun
                new FilledRect(0,0,SCREENWIDTH,SKY_LINE,
                                canvas).setColor(SKYBLUE);
                new FilledRect(0,SKY_LINE,
                                         SCREENWIDTH,SCREENHEIGHT-GRASS_LINE,
                             canvas).setColor(GRASSGREEN);
                bladePosition = 0;
                while ( bladePosition < SCREENWIDTH )
                        new FilledRect(bladePosition,GRASS_LINE,
                                                   GRASS_WIDTH,GRASS_HEIGHT,
                                      canvas).setColor(GRASSGREEN);
                        bladePosition = bladePosition+2*GRASS_WIDTH;
               new Text("Click to make a rain cloud....",240,290,canvas);
        public void onMouseClick(Location point)
           new RainCloud(canvas);
           new Sun(canvas);
<html>
<head>
<title> Grass.java
</title>
<body>
<applet
archive = "objectdraw.jar"
codeBase = "."
code = "Grass.class" width = 800 height = 800 >
</applet>
</body>
</html>

you could set clipping on the Graphics object

Similar Messages

  • How does the jvm handle drawing images outside an applet window?

    I have a question about an applet I want to optimize.
    Essentially the applet allows the user to scroll through a large map while viewing only a small portion of the map through the applet window.
    The map has a large array of circles with coordinates on the map that are drawn in their appropriate place in the applet window when the user scrolls the map.
    As it stands, the paint method loops through every circle in the array to draw them, but most of them are not visible in the window and end up getting drawn in a negative coordinate or a very large coordinate.
    My question is are these circles that are not seen in the applet window but are still calling drawCircle in the paint method putting a strain on the computer's graphics card?
    Would it be better if I looped through all circles and only called the drawCircle method on circles whose coordinates would be visible? Or would the extra step of checking each circle's coordinates before drawing be not worth as efficient?
    Any help would be appreciated.

    If the amount of stuff being rendered outside of the clip rectangle is small then it's usually not worth it to attempt to figure out what's being clipped and not draw it. If the clip rectangle represents only a small portion of the entire canvas that can be drawn, however, it's usually worthwhile to put in some logic to only draw what is necessary.
    Take JTextArea, for example. It could be displaying a text document thousands of lines long. Instead of rendering every line of text on every repaint operation, it contains the following logic:
    1. Get the current clip bounds (i.e. what part of the text area is "dirty" and must be repainted).
    2. Figure out what lines are displayed in the clip bounds. Some lines may be only partially visible (a line "halfway" scrolled down), but they need to be repainted too. If word wrap is disabled this is a very quick and cheap operation, but if word wrap is enabled, it's a little more complex.
    3. Only repaint those lines.
    This way, in the best-case scenario JTextArea only repaints a single line (the line the user is typing in). Worst case, it repaints the number of lines that can fit on the screen. But it never repaints too much.
    Anyway, I guess my advice would be: If it's cheap and easy to determine if something is out of the clip bounds, do it. If it's difficult to determine, do it only if you have a noticeable performance issue in your rendering code.

  • Using separate_frame=true and trying to close the applet window after...

    We are using separate_frame=true and trying to close the applet window (the one with the large gray box) after using the following post-form trigger:
    if :system.last_form = 0 then     
         message('Please wait while Forms closes - '||:system.last_form);     
         web.show_document('/forms/html/close.htm','_self');     
    end if;
    This works fine for the first form we open, but if that same form using Open_Form to open a child form we have a problem. When the child form is closed the user is returned to the parent calling form (which is expected), but then when the parent form is closed the separate applet window fails to close. Any suggestions?

    I guess you mis-interpreted the value of :SYSTEM.LAST_FORM. From the online-help:
    SYSTEM.LAST_FORM represents the form document ID of the previous form in a multi-form application, where multiple forms have been invoked using OPEN_FORM.So LAST_FORM shows always the ID of the last activated form, and this will never be 0 if you issued one OPEN_FORM in your application.

  • Closing the applet window

    how to close the applet window using a button on the applet

    ravindra.alld wrote:
    how to close the applet window using a button on the appletIs your applet in a web browser? If so the only way to hide visibility of the applet would be through javascript and css. So you would need an html button outside the applet to do this.

  • Maximizing the Applet window

    I am deploying a forms 5 application over the web. How can I
    have the applet window automatically maximized?
    I know how to do it in the forms runtime with FORMS_MDI_WINDOW
    but that doesn't work in the java deployment.
    any help would be greatly appreciated..
    thanks in advance,
    Dennis Hancock
    null

    Can you not use the same win api to bring up the browser application, since the applet is running within the browser?

  • How to add a scroll bar within a view window ?I want to display x and y axis outside the scoll window and keep those axis static and move the graph within scroll area

    how to add a scroll bar within a view window ?I want to display x and y axis outside the scoll window and keep those axis static and move the graph within scroll area
    ananya

    Hey Ananya,
    I believe what you want to do is possible, but it will not be
    easy.  If you want to add a scroll bar that will scroll the graph
    back and forth but keep the axis set, you would want to add a
    horizontal or vertical scrollbar.  Then you would create an event
    handler for the scroll event.  You would have to manually plot
    different data within this scroll event.  Unfortunately, there is
    not really a built in way to do this with the Measurement Studio plot
    control.
    Thanks,
    Pat P.
    Software Engineer
    National Instruments

  • Maximize the applet window

    Hi all. I'm on devsuite 10g. I'm running my form with separateframe=true. I would know if there is something that I can do to maximize the applet window, in which there is my form.
    In the formweb.cfg file I have modified the parameters as follow:
    width=100%
    height=100%
    but the window in which there is the form (probably the applet window) is not maximized.
    Here is the code of my when-window-activated trigger:
    Set_Window_Property(FORMS_MDI_WINDOW, WINDOW_STATE, MAXIMIZE);
    Set_Window_Property('WINDOW1', WINDOW_STATE, MAXIMIZE);
    Set_Window_Property('WINDOW2', WINDOW_STATE, MAXIMIZE);
    Set_Window_Property('WINDOW3', WINDOW_STATE, MAXIMIZE);
    So what can I do???
    Thanks all for the collaboration,
    Fabrizio

    try making width=100%
    height=100% in formsweb.cfg
    also search this forum for some answers

  • Final Cut pro crashes when any effect is click in the effect window HELP!!!

    Final Cut pro crashes when any effect is click in the effect window HELP!!!
    I have video placed in a sequence and when I go to the effect browser to click on a effect to drop on it the program thinks for a few seconds and then quits. I tried dumping the pref files in the pref folder and it did not work. is there a different method I should try?

    #44: FCP acting weird - Trash Prefs
    Shane's Stock Answer #44: FCP acting weird or unusual. Just not like is normally should
    If the program was working fine, and now isn't, or just isn't working the way it should, the first things to do are:
    1) Trash your FCP preferences. Download the appropriate version of FCP Rescue at http://www.fcprescue.com and run it.
    http://www.kenstone.net/fcphomepage/trashing_fcpprefs.html
    2) Open the Disk Utility and Repair Permissions.
    3) Shut down for 10 min. Go for a quick walk around the block and get SOME exercise today. Come back, turn on the computer and see how things are.
    4) (optional) Do the Hokey Pokey and turn your self about. Results may vary.
    Shane

  • Disabling the F1 Windows Help and Support key

    Hello! I see there's lots of people that have been having this problem, but I felt I was in a unique (HA) position in that I have a Windows 8 OS, so the problem can't be solved following the steps to a Windows 7 solution. I've tried several things.
    First off, background; I have an HP 2000 laptop running Windows 8. I have wanted to use the function keys in a video game, but they were set as macromedia function priority. I went into BIOS and switched the action keys to DISABLED so that I could use FN+F
    Key in order to use the macromedia, and instead they revert to normal function. This is fine. BUT: It only worked for F2-F12. The F1 key is still mapped to open Windows Help and Support. I've tried to rename the helppane.exe (I am admin but only "Trusted
    Installer" can modify the file), and ran into problems. SO I tried to follow the steps to use regedit to block the helppane.exe, but the .exe isn't located where it is on a Windows 7 machine. 
    I have been working to try to find a solution to this problem for going on hours now, with no recourse. ANY solutions would be very welcome. Thank you. 

    You sure you already save after changing setting in BIOS
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02035108&cc=id&dlc=en&lc=en
    If yes, find your model in HP site and find the update BIOS, update your BIOS, and try again
    since this PC OEM. HP will provide better answer for you, and if you keyboard also comes with extra software I suggest to uninstall it first to check

  • Forms Server - Unable to  load *.FMX  into the applet window

    We have compilled the following html from JDeveloper :
    <HTML>
    <!-- FILE: main.html -->
    <!-- Oracle Static (Non-Cartridge) HTML File Template -->
    <!-- Rename, and modify tags and parameter values as needed -->
    <HEAD><TITLE>The Developer/2000 Server</TITLE></HEAD>
    <BODY><BR>Please wait while the Forms Client class files download and run.
    <BR>This will take a second or two...
    <P>
    <!-- applet definition (start) -->
    <APPLET CODEBASE="."
    CODE="oracle.forms.engine.Main"
    ARCHIVE="f60web.jar"
    HEIGHT=400
    WIDTH=400>
    <PARAM NAME="serverHost" VALUE="192.168.1.99">
    <PARAM NAME="serverPort" VALUE="80">
    <PARAM NAME="serverArgs"
    VALUE="module=test.fmx userid=tasos/1234@gportal">
    <PARAM NAME="serverApp" VALUE="default">
    </APPLET>
    <!-- applet definition (end) -->
    </BODY>
    </HTML>
    Runtime retunrs the following:
    java.lang.NoClassDefFoundError: java/awt/peer/ActiveEvent      
    void oracle.forms.engine.Main.dispatchEvents(java.awt.EventQueue)      
    void oracle.forms.engine.Main.tryDispatching()      
    void oracle.forms.engine.Main.componentResized(java.awt.event.ComponentEvent)      
    void java.awt.Component.processComponentEvent(java.awt.event.ComponentEvent)      
    void java.awt.Component.processEvent(java.awt.AWTEvent)      
    void java.awt.Container.processEvent(java.awt.AWTEvent)      
    void java.awt.Window.processEvent(java.awt.AWTEvent)      
    void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)      
    void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)      
    void java.awt.Window.dispatchEventImpl(java.awt.AWTEvent)      
    void java.awt.Component.dispatchEvent(java.awt.AWTEvent)      
    void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)      
    boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)      
    void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)      
    void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)      
    void java.awt.EventDispatchThread.run()
    Finally , the applet main.class initializes but the specified
    FMX file could not be displayed.
    Is it possible to explain us what is going wrong ;

    If your fmx cannot be found try first to have a hard coded path to the fmx in your HTML something like module=c:\temp\a.fmx
    If it works this way then you probably didn't set the FORMS60_PATH entry in the regedit correctly to include the path to the form.
    set it and remove the path from your html.
    Also I would suspect that your jar is not loaded since your codebase is not pointing to it's directory.
    Open the java console to see if it gets downloaded to the client.

  • Bookmark drop downs that go outside the Firefox window are left on the desktop when bookmarks closed requiring a refresh to clean up

    If I open Bookmarks and select a folder that is longer than the Firefox window is high, the part of the bookmarks list that falls outside the window remains on the desktop when I leave bookmarks or close the window. I must then do a refresh of the desktop to get rid of the junk. Does not happen with MS IE9. I am using Windows 7 Home Premium on a SONY VAIO laptop. It started when I went to the VAIO last November. A "Show Desktop" or a refresh of the desktop cleans it up.

    Could you try disabling graphics hardware acceleration? Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches with some graphic cards/drivers.
    You usually need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    orange Firefox button ''or'' classic Tools menu > Options > Advanced
    On the "General" mini-tab, uncheck the box for "Use hardware acceleration when available"
    If you restart Firefox, is the issue resolved?

  • New I Mac- safari does not show the URL window- help!

    My safari does not show the website address window, but everyone else in the family shows it. How do I fix this so that I can view the address window. Thanks.

    HI John,
    From the Safari Menu Bar click View/Customize Toolbar.
    Drag the default Toolbar up or individual items.
    Carolyn

  • Maximizing the applet window makes the scrollbar visible how do i solve it

    Hi
    I have scrollpane which consists of panel which has gridlayout ..I drag and drop the labels from one panel to this panel but the scrollbar does not appear ..but as soon as i maximize the window scroll bar appears for the panel..How do i solve this problem.?? can anybody help me asap

    the tabs were move to above the navigation bar, where the menu bar was. They hardly look like tabs there, but you may have turned off the tabs bars. View (Alt>V) > Toolbars > Tabs Bar
    I think the solutions would really prefer though would be
    You can make '''Firefox 8.0''' look like Firefox 3.6.*, see numbered '''items 1-10''' in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 8.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface
    <p>There is a lot more beyond those first 10 steps listed, if you want to make Firefox more functional.</p>
    <p><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small></p>

  • !!! cannot launch Acrobat XI Pro, it stops at the EULA window HELP !!!

    Hello,
    I ve just installed a trial version but I cannot launch the soft, I accept the EULA again and again and again and nothing more.... Help ....
    My OS is Windows 8.1
    Thanks
    Ann

    http://www.ehow.com/info_12217860_adobe-acrobat-pro-doesnt-remember-eula.html

  • Error when trying to sign the Applet, please Help

    Hello,
    I have this Error when I am trying to sign my applet, after execut this command :
    jarsigner -verify -verbose -certs test.jar
    jarsigner: java.lang.SecurityException: invalid SHA1 signature file digest for classe/JDBC_SQL.class
    And for your information, that I had add the JDBC_SQL.class to the jar file (test.jar) because I made some change to the file JDBC_SQL.java
    so please if you know what can I do to resolve my problem
    Thank you to reponse !
    rania +

    ahh, here is a problem. u made changes to the JDBC_SQL.java and packed the jar file. u have to sign the jar file again.
    let me know if u need futher assistance

Maybe you are looking for

  • Playing album downloaded from limeware in itunes

    Have downloaded via Limeware( a file sharing facility) a complete album but cannot play it in itunes. track plays but there is no sound. ! appears next to details of the download. Haven't had any problems up to now. Anyone any ideas?

  • Adding the G/L description field in the report FAGLL03

    Dear all I would like to add the G/L description field in the report FAGLL03. Can you tell me how this can be done. Many thanks PG

  • Customize the look of the interface?

    Is there anyway to customize the look of the interface in FCP? In other words- change the color of the timeline background, video tracks, audio tracks, etc. I recall Avid gave me that option and it seems like it would be something Apple would allow-

  • Need assistance please_Indesign CS_update

    I have indesign cs...that all of a sudden after a reboot it is causing dr.watson errors and will not start. I had to re-activate photoshop for it to restart, but that is now fine. any ideas as to what can be done? besides re-installing. //===========

  • Powermac G4 shuts down when attempting to intall retail version of OSXTiger

    Hello everyone! I just bought a retail version of Max OS 10.4 Tiger/Family Pack and am having difficulty installing it on a PowerMac G4/PCI graphic model currently running OS10.1. Every time I try to install, it prompts me to restart. I proceed to so