Clearing a Drawing? [Mask]

Hello,
So I have a project I am working on in which I would like to teach how to cash a scratch off card. I have made the scratch and made it so it will "scratch", however my masking technique seems to not be working how it should...
The idea is that the user would "scratch" the card and then hit "Next" after that it would load a new frame (Progress Bar would move) and then do what they need to on that frame, and so on.
However it would seem that Flash is keeping the users "drawing" and still allows them to draw after the first frame, which is not what I want.
Frame 1 (Before User Scratchs)                                                                                                         Frame 1 (After User Scratchs)                                                                                                   Frame 2 (After User Scratchs)
I am using this code to make the scratch effect and I am having it load extranally:
package {
    import flash.display.Sprite;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.ui.Mouse;
    public class ScratchTicket extends MovieClip{
        var scratcherIsActive:Boolean= false;
        var stuffUnderMask:Sprite = new Sprite();
        // init class
        public function ScratchTicket():void{
            stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseIsDown);
            stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseIsMoving);
            stage.addEventListener(MouseEvent.MOUSE_UP, mouseIsUp);
            // make mask           
            stuffUnderMaskClip.mask = stuffUnderMask;
            addChild(stuffUnderMask);
            makeCursor();
        // helper functions
        private function makeCursor():void{           
            trace();
        // hover effects
        private function mouseIsDown(e:MouseEvent):void{
            //Mouse.hide();
            Mouse.cursor="hand";
            scratcherIsActive = true;
        private function mouseIsUp(e:MouseEvent):void{
            //Mouse.show();
            Mouse.cursor="arrow";
            scratcherIsActive = false;
        private function mouseIsMoving(e:MouseEvent):void{
            if(scratcherIsActive){
                stuffUnderMask.graphics.beginFill(0x000000);
                stuffUnderMask.graphics.drawEllipse(mouseX, mouseY,60, 60);
                stuffUnderMask.graphics.endFill();
    }// class
}// package
I would load this script locally, however I am not sure were to place it, or if it would even help.
Thank you!

Are you handling the situation that the user may leave the flash area altogether? This is often a problem. Even if it doesn't solve your issue, I see no mention of MOUSE_LEAVE in your events.
I would change the event your mouseIsUp(e:MouseEvent):void function listens for to a generic event. So private function mouseIsUp(e:Event):void. Then you can do this:
stage.addEventListener(Event.MOUSE_LEAVE, mouseIsUp);
That will make sure that if the user leaves the flash area the mouse will have a chance to run mouseIsUp().
When your user is done scratching don't forget to dispose of the surface you're drawing on with the graphics.clear(); method (e.g. stuffUnderMask.graphics.clear();) as well as removing any objects made to draw on.

Similar Messages

  • Using the Titler to draw masks -- how put it together?

    For lack of a rotoscope function in PPro (16 point garbage matte being the limit), I tried using the Titler to draw a mask, but can't get the transparency to work.
    The base clip is a static skyline shot.  Using the Titler, I created another title clip, using the base clip, with a mask drawn around the sky.  The idea is to make the area enclosed by the mask transparent, so as to replace it with the sky from another shot -- and retain the rest of the base shot, which (on the Titler) is the area outside the mask.
    But, using these 3 clips on 3 tracks, and the track matte filter, I can't get it to work.  Any ideas?

    The main issue you're facing might be in the fact that Titler doesn't create a shape with alpha channel. Hence, your should set your Track Matte Key to 'Matte Luma' instead.
    Here is briefly how to create procedural matte in PrPro:
    1. Duplicate your footage in the sequence, place it above the previous one and apply Threshold effect onto it. Adjust Threshold Level to taste so as to get more or less acceptable edges with the sky keyed out. Apply Fast Blur to soften edges a bit.
    2. Open up Titler and draw a shape for garbage matte. Set Graphic Type to Filled Bezier and Color to Black.
    3. Drop your newly created garbage matte above your footage with Threshold effect and nest them.
    4. Apply Track Matte Key onto your lower clip and set Composite Using to Matte Lume.
    5. Enjoy.

  • Draw mask path at perfect angles

    Hey all,
    Simply question hopefully.
    Is there a way to draw a mask path at a perfect 0, 90, 180, 270 degree angle? The mask functions as a stroke effect with straight lines, but right now they are slightly crooked because there doesn't seem to be a "snap to" perfect degree that I know of.
    An alternative is to draw a rectangle mask, and delete some points, but the mask connected between the point that was deleted.
    Thanks!
    Dan

    You could also draw guides... Just make sure to view them at 100% since snapping is based on the comp resolution and at smaller res the points will be quantized to the wrong pixel...
    Mylenium

  • How do I clear the Code Mask in the WBS Code Definition box?

    Hi all, I made a boo-boo when trying to set up a WBS code definition, and I can't figure out how to delete the codes masks as shown below.  DEL does not work on the level rows and there is no "None" choice in the dropdown. Well, as always,
    thx for your help!
    Jigs
    Jiggy Gaton, Trainer and Media Consultant for Nepal and S. Asia

     Ismet, thx for helping, but that procedure does not work here. Trying to delete the last line in the code mask gives this error: 
    and results in this list and an enless loop of the same message until I just hit cancel. This has the feel of a bug. I am using the latest of everything (MS Project 2013 Std. 32-bit in Win 8.1 Pro with all the MS updates). Driving me bonkers :) 
    Jiggy Gaton, Trainer and Media Consultant for Nepal and S. Asia

  • Is this possible to access arbitrary frame and to modify the mask?..

    Sorry for a bit messy discussion title. Please, let me explain.
    I have some experience in implementing video processing algorithms, but as our own software and never under AE. Now there is an idea to implement something for AE and first of all, I'm curious, if this is possible at all.
    1) When processing the n-th frame, I need the full access to the data of (n-k)-th and (n+k)-th. Is this possible to do in general case? Or the only variant is to implement frames buffering during the first pass?
    2) Our algorithm uses the mask as one of the inputs. But in contrary to the usual case, mask does not define an area of interest. In any case the full frame is processed, but the processing differs for different regions, depending on mask. In our software, it works like this: user defines a mask (and some parameters). Then effect is slightly modifying (let say – refining) the mask during the render and renders final images. After this user can modify the mask somehow again if he/she is not satisfied with what algorithm has done. Can I produce the same workflow in AE? The only way is using a drawbot (this means CS 5.5 and higher)? And what if I want masks to be raster images?
    The second question in the framework of this one is how to do two video inputs for an effect (first – the video to be processed and second – the mask (grayscale sequence in general case))?
    The possible workflow is that user provides trivial mask – lets say, the black solid. But even during the first pass effect should produce the mask, according to its sight to the video – so, it should somehow substitute the black solid with the sequence on black'n'white images. Is this all possible in AE?
    3) Is this possible (should be, I guess) to implement multipass algorithms? How the preview works then, if I need, for example, to pass all the video length 3-4 times, to produce the final render?
    I can expect that all this is solvable in AE, but may be experienced users could be so kind to give me some basic recommendation on how to do this. Looking through the PDF, which accompanies the SDK has not allowed to come to a distinct answer for the question: is this possible or not. So, I rely on your consultation.

    hi Theofil Mulony, welcome to the forum!
    in short, yes, what you want to do is possible, but some parts may be tricky.
    and now the long version:
    1) When processing the n-th frame, I need the full access to the data of (n-k)-th and (n+k)-th. Is this possible to do in general case? Or the only variant is to implement frames buffering during the first pass?
    you can access the pixel data of any layer at times other than the currently processed time. this concept of getting that data is referred to as "layer checkout" in the AE SDK, and "wide time" is the name of getting pixel data at times other than the current.
    the following thread discusses the difference between two methods of getting such data:
    http://forums.adobe.com/message/4033930#4033930
    you can also look at the "checkout" sample project to see how both concepts are implemented.
    2) Our algorithm uses the mask as one of the inputs. But in contrary to the usual case, mask does not define an area of interest. In any case the full frame is processed, but the processing differs for different regions, depending on mask. In our software, it works like this: user defines a mask (and some parameters). Then effect is slightly modifying (let say – refining) the mask during the render and renders final images. After this user can modify the mask somehow again if he/she is not satisfied with what algorithm has done. Can I produce the same workflow in AE?
    masks in AE generate a matte by default. the user can turn that mask off, so that the shape remains, but the mask does not... mask. (you can also set the mask mode to "none" via API commands).
    you can then read the "off" mask attributes and either render using an API command (see "pathmaster" sample to see how), or write your own algorithm if the API constraints on that operation are a problem for you. (and there are a few constraints on rendering masks in the API)
    now. when you say "modifying the mask" do you mean you modify it's generated matte, or do you mean change it's defining vector?
    both are possible, but completely different.
    if you turned the mask off, and rendered it's alpha yourself, then you can modify that alpha as you wish.
    if you want to use AE's generated matte of the mask and change the mask's outline shape, then you need to look into "streams" and the "mask outline suite".
    the user can modify a mask's shape as he/she pleases, unless you lock that mask or otherwise sabotage the user's operation.
    The only way is using a drawbot (this means CS 5.5 and higher)?
    drawbot is the API for drawing over AE's interface in CS5 and up.
    it's only a drawing tool. previous versions used OS drawing tools. that's all the difference.
    what i think you're asking is weather you need to create the mask drawing/handling capabilities or not.
    the answer is: you can, but you don't have to.
    unless you need control over the mask drawing that AE's existing masks don't have, i would have used AE's masks and not create a brand new mechanism (that the user need to learn as well).
    if you insist at creating a custom UI for drawing masks, the "CCU" sample project would be a good place to start the research.
    (just don't come crying to me when you get a splitting head ache)
    And what if I want masks to be raster images?
    The second question in the framework of this one is how to do two video inputs for an effect (first – the video to be processed and second – the mask (grayscale sequence in general case))?
    The possible workflow is that user provides trivial mask – lets say, the black solid. But even during the first pass effect should produce the mask, according to its sight to the video – so, it should somehow substitute the black solid with the sequence on black'n'white images. Is this all possible in AE?
    by default, "effect" plugins (as opposed to AEGPs) get only one input - the image of the layer, post masks and previous effects (but before transformations).
    you can put as many "layer param"s in your effect and let the user select any number of other layers, which you can the "checkout" and use as second inputs.
    you can also checkout other layers without the user selecting them manually.
    however, checked out layer results are pre-masks and effects. so if the user draws a mask over a black solid, you will not be able to read the "post mask" image unless the user pre-composes the layer with the mask inside the pre-comp. it's a common practice for users to do so, as many effects rely on a second input, and that's the only way to make the input pos-masks and effects. (so it's no biggie from the user's point of view)
    in the same manner, you can read any layer's image and use it as a mask.
    you get the image buffer, so it's up to you to decide whether to use the alpha channel of that image or the rgb (or any other method you see fit).
    3) Is this possible (should be, I guess) to implement multipass algorithms? How the preview works then, if I need, for example, to pass all the video length 3-4 times, to produce the final render?
    AE doesn't do multi pass rendering.
    it actually can render arbitrary frames, in no particular order.
    but as you already saw, you can access the image data from any time - of any time, so you can emulate passes.
    if you need to fly through the whole sequence for every frame, that would of course be very time consuming and wasteful.
    in such a case, you can try to do these passes only once, when effect is implemented, and cache the results.
    look up "sequence data", to see how to manage memory specific to a single instance fo you effect.
    but i must say that if you have to do full length scans of the footage, a couple of times over, and cache EVERYTHING, then you're in a bit of a problem in AE.
    it's just not set up for such rendering logic.
    not impossible, but highly inefficient in the AE rendering pipeline.
    there is a lot more to al of the above, but i hope this gave you a clearer picture of how things are in AE.

  • Subtract multiple channel blur masks in Premiere CC?

    I'm making a portrait of a person, more or less a talking head and I want to smoothen everything in the picture except for the eyes and the mouth. I add the channel blur effect to the clip and draw masks around the eyes and the mouth. This makes the eyes and the mouth blurry, so I would want to inverse the effect keeping these parts sharp. But I can only inverse one mask? Is there a way to subtract the masks?

    In premiere you can only inverse one mask.
    For subtracting multiple masks you will have to go into AE.

  • How do i clear the entire content of JPanel?

    when a certain event happens, how do i clear anything that is currently displayed in the JPanel?

    What do you mean by displayed? Something drawn on the JPanel? Or Components added to the JPanel?
    If the latter:
    myPanel.removeAll();
    myPanel.validate();Something like that. You may have to validate the content pane also/instead.
    If you want to clear the drawing, that would be slightly harder...
    Graphics g = myPanel.getGraphics();
    g.clearRect(0,0,myPanel.width(), myPanel.height());(I have no idea if that would work, but it sounds good).
    Cheers,
    Radish21

  • AE cs6 crash during render preview

    AE is crashing during a render preview.
    Version: cs6 11.0.4 (recently updated).
    System: iMac mid 2011 running os X 10.7.5
    Processor: 2.7 GHz Intel Core i5
    Memory: 16 gb 1333 MHz RAM
    Error message: "Last log message was: <4453353824> <ae.blitpipe> <2> Making New Context."
    In my comp I am using four masked solid layers with keyframes, no 3D or 3rd party plugins. The crash occurred after adding an adjustment layer and applying Turbulent Displace with an expression and Simple Choker. Crash occurs at the same point in the timeline every time I do a render preview. I've tried purging the cache, rebooting everything. I tried clearing the preferences with the command "command option shift" at startup, but that didn't seem to work (got no pop up window with yes/no option, maybe not doing it right?). Please let me know if you have any advice or need more information to clarify the issue. Thanks.

    The problem is in Mask 1 on the Head layer. Delete and redraw/re-animate that mask.
    Or, better...
    Why are you drawing masks on solid layers for animation? That stopped being the right way to create graphics in After Effects seven years ago, when we introduced shape layers. I strongly recommend using shape layers for the kind of work that you're doing here. Also, I just checked, and copying and pasting your mask paths into shape layers path makes the problem go away, so whatever bug there is there is just with masks on solids.
    To learn shape layers, go through Andrew Devis's materials in this series:
    After Effects basics tutorials by Andrew Devis

  • Please help me merge two images

    I've been reading tutorials for hours, and trying everything I can think of, but I just can't figure this out.
    I have two BufferedImages (TYPE_INT_RGB), and I want to be able to create an alpha channel "mask" that lets me punch "holes" (antialiased) in the top one to have the bottom one show through. I can draw white circles (Ellipse2D.Double) to my heart's content on the top or bottom image, but I can't figure out how to use this as a alpha channel mask or how to use AlphaComposite to put it all together. Can someone please offer help?

    I merged the top 2 responses together to get an antialiased version. Then I saw the post below. Can anyone comment on which version is more efficient? Thanks for all your help.
    import java.awt.AlphaComposite;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GraphicsConfiguration;
    import java.awt.GraphicsDevice;
    import java.awt.GraphicsEnvironment;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.Transparency;
    import java.awt.geom.Area;
    import java.awt.geom.Ellipse2D;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    public class ImageHoles extends JPanel {
        BufferedImage[] images;
        Area mask;
        ImageHoles(BufferedImage[] images) {
            this.images = images;
            // Set the mask = null and call repaint
            // inside componentResized method of a
            // ComponentListener added to this.
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            int w = getWidth();
            int h = getHeight();
            int x = (w - images[0].getWidth())/2;
            int y = (h - images[0].getHeight())/2;
            // draw bottom image
            g.drawImage(images[0], x, y, this);
            x = (w - images[1].getWidth())/2;
            y = (h - images[1].getHeight())/2;
            if(mask == null) {
                createMask(x, y);
            // from Chris Campbell's Blog (see above)
    //      Create a translucent intermediate image in which we can perform
    //      the soft clipping
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice gs = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gs.getDefaultConfiguration();
            BufferedImage img = gc.createCompatibleImage(w, h, Transparency.TRANSLUCENT);
            Graphics2D g2 = img.createGraphics();
    //      Clear the image so all pixels have zero alpha
            g2.setComposite(AlphaComposite.Clear);
            g2.fillRect(0, 0, w, h);
            g2.setComposite(AlphaComposite.Src);
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setClip(mask);
            g2.setColor(Color.WHITE);
            g2.fill(mask);
            BufferedImage hi = images[1];
            g2.setComposite(AlphaComposite.SrcAtop);
            g2.drawImage(hi, 0,0,hi.getWidth(), hi.getHeight(), this);
            g2.dispose();
            // from Chris Campbell's Blog (see above)
            // draw masked antialias layer
            g.drawImage(img, x, y, this);
        private void createMask(int x, int y) {
            int w = images[1].getWidth();
            int h = images[1].getHeight();
            Rectangle r = new Rectangle(x, y, w, h);
            Ellipse2D e1 = new Ellipse2D.Double(x+20, y+75, 25, 25);
            int cx = x + w/2;
            int cy = y + h/2;
            Ellipse2D e2 = new Ellipse2D.Double(cx-30, cy-30, 60, 60);
            Ellipse2D e3 = new Ellipse2D.Double(x+w-60, y+h-60, 40, 40);
            mask = new Area(r);
            mask.subtract(new Area(e1));
            mask.subtract(new Area(e2));
            mask.subtract(new Area(e3));
        public static void main(String[] args) throws IOException {
            String[] ids = { "polarBear", "hawk" };
            BufferedImage[] images = new BufferedImage[ids.length];
            for(int j = 0; j < images.length; j++) {
                String path = "images/" + ids[j] + ".jpg";
                images[j] = ImageIO.read(new File(path));
            ImageHoles test = new ImageHoles(images);
            test.setPreferredSize(new Dimension(images[0].getWidth(),images[0].getHeight()));
            JOptionPane.showMessageDialog(null, test, "", -1);
    }

  • Workflow and Compositional Question

    I have footage from 22 GoPro cameras, mp4, which I have imported natively into AE (11.02, OS 10.8.3 Mac 2.66mhz Quad Tower 16g of RAM) into 1 composition.  I plan to achieve the effect desired and then output a production codec, 422 prores for inclusion in my Premier project timeline.  Is this a valid workflow?
    Next the compositional question:
    Most of the 22 cameras (in an array) recorded two or more files of the 16 mintes of run-time, (there are 6 separate takes in that time period).  I pre-composed those footage files (after aligning a slate and for the seamless play of each layer) to neaten up and make more compact my AE timeline.
    The effect I'm trying to achieve is a Time-Slice/Bullet Time where I can "cut" from one camera to the next all along the array, thereby freezing the action, but having the "camera" move around the subject - and then have the last layer/camera keep playing.  At the precise frame I want to freeze I put the opacity of each layer to 0 successively at the desired "freeze point" however in my ram preview only the first footage layer plays.  Without the opacity transformation on each layer I can achieve a rough version of what I'm trying to do by Solo'ing each individual layer and I cannot figure out why making each layer 0 opacity successively isn't working. 
    Also once I completed all the Opacity transformations, the bottom layer should be visible 1 frame after the layer above it goes to O opacity, but it is in fact BLACK!  What the heck?
    Do I need to slip each layer 1 frame forward in time so only 1 frame of each layer plays?  Again "turning on and off" each layer with Opacity?  I've found the answer to this question, at least for now.  Each successive clip gets trimmed to the desired frame, then slipped one frame in front of the layer above (save the top layer, which is trimmed to the frame).  This way the same frame is played over and over from each camera along the array.
    Have I made a mistake by using the Pre-comps mixed with the 1-take footage?  In other words, my main comp now includes Pre-comps of the 2 files produced by most of the cameras, along with the original mp4 footage of those cameras which only recorded one file for the action.
    And further; once I have the frames visible in the correct order would I Pre-compose again and apply a sfx like pixel motion to interpolate between the difference in angle/frame due to the difference in each camera's position?  Please suggest an alternative workflow or compositional layout!
    I hope I've been clear, I'm here and willing to clarify if I've omitted any details.
    I still would appreciate answers to the remaining issues if anyone has input for me.  The question now is: to time remap, or timewarp (which one?) before Pixel Motion - and is Pixel Motion best for frame interpolation to smooth it all out?
    http://i1218.photobucket.com/albums/dd402/jessedavidharris/ScreenShot2013-03-30at31603PM.p ng
    Thank you very much,
    Jesse

    Ok believe it or not I'm still having problems with this process.  And please excuse my ignorance about Alpha Channels.  Your instructions should be easy to follow, but I think I'm getting confused with some language.  Please allow me to let you follow my workflow - point out where I'm in error.
    This is the Bullet Time Comp - referring to your 1. Comp.  I render this comp to a 422PR .mov and call it Bullet_Time_v3_DI_422
    I then take the above DI and import it to the Project and place it in a separate comp called BulletTime v3 DI 422, and then add an Adjustment Layer with Timewarp to Speed Up the bullet time.  This refers to your 2.
    Next, from this comp I render out another 422PR DI, WITHOUT precomping the Adjustment Layer and Footage, is that ok?  Giving me a "Speed Up" DI.  And this is where I get shaky...  This is the part I don't understand:
    You draw your masks not on the lower layer in the master comp. When you duplicated the 'Speeding Up' composition layer inside of the master comp, you precompose the lower layer, open up the newly created precomp ('Matte') and draw your masks there.
    It looks to me like BOTH items are precomped here in your Master Comp - The Movie.  I know you've spelled out the steps very clearly, but I'm missing something here...
    Below what I've done is to drag that last 422 DI referred to above and is the "Speed Up" footage resulting from the 400 Speed Timewarp Adj. Layer and Bullet Time DIn rendered out to "Speed_Up_DI_422.  Into my Master comp, duplicate it and draw masks on the lower one.... but evidently this is incorrect.  And I haven't added the overall Adj. Layer with 50 Speed Timewarp yet.  But as per your comp I should be drawing masks completely separately.
    Where is this "Matte" comp coming from?!  From your instructions it is a duplicate of the Bullet Time + 400 Speed DI's  How did it get in a separate comp by itself?  Then I must import it to the Main comp so it's paired with the Bullet Time precomp (footage)?
    I'm so befuddled I'm not even sure how to forumulate my questions properly.  My apologies.  What am I missing here?  It seems like you're spelling it out so clearly.

  • Peculiar annotator behavior, please help.

    I am writting a tool similar to AI selection tool.
    User clicks and drags a path, I use the annotator to draw the shape of the path new path to be, user releases the mouse, I stop the annotator and update the path to its new shape.
    So, I open AI, start dragging an anchor of a path, I see the annotator draws then clear then draw etc.so you can see it flickers on and off very fast.
    So, I switch to a different application, then switch back to AI and start again, thereafer it works, no more flickering.
    Why switching back to AI makes it work? I hope I don't have to ask user to switch back to AI for it to work, that would be silly!
    Has anybody experience the same thing? Is there a solution?
    Thank you

    I just want to get my final comment in and give this thread a rest.
    No doubt in my mind the issue is with thread synchronization between the clearing and the drawing threads.
    I hope someone from Adobe would be kind enough to admit this problem, so we don't implement tricks and patches
    that would only mask the problem in some operating environments and not others. Synchronization issue need to be
    fixed inside AI core, not try to mask it in the plugin, because it does not guarantee to mask the problem for all users.
    Another thing is to give the plugin the ability to request a draw and a clear, and do not generate a draw automatically based on some
    fixed conditions. The plugin knows when it wants to draw and when to clear. The drawing and clearing engines only need to synchonize
    themselves and execute the plugin requests in the order recieved.

  • How do I convert this Applet to launch from a JFrame instead??

       A simple program where the user can sketch curves and shapes in a
       variety of colors on a variety of background colors.  The user selects
       a drawing color form a pop-up menu at the top of the
       applet.  If the user clicks "Set Background", the background
       color is set to the current drawing color and the drawing
       area is filled with that color.  If the user clicks "Clear",
       the drawing area is just filled with the current background color.
       The user selects the shape to draw from another pop-up menu at the
       top of the applet.  The user can draw free-hand curves, straight
       lines, and one of six different types of shapes.
       The user's drawing is saved in an off-screen image, which is
       used to refresh the screen when repainting.  The picture is
       lost if the applet changes size, however.
       This file defines two classes, SimplePaint3,class, and
       class, SimplePaint3$Display.class.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SimplePaint3 extends JApplet {
            // The main applet class simply sets up the applet.  Most of the
            // work is done in the Display class.
       JComboBox colorChoice, figureChoice;  // Pop-up menus, defined as instance
                                             // variables so that the Display
                                             // class can see them.
       public void init() {
          setBackground(Color.gray);
          getContentPane().setBackground(Color.gray);
          Display canvas = new Display();  // The drawing area.
          getContentPane().add(canvas,BorderLayout.CENTER);
          JPanel buttonBar = new JPanel();       // A panel to hold the buttons.
          buttonBar.setBackground(Color.gray);
          getContentPane().add(buttonBar, BorderLayout.SOUTH);
          JPanel choiceBar = new JPanel();       // A panel to hole the pop-up menus
          choiceBar.setBackground(Color.gray);
          getContentPane().add(choiceBar, BorderLayout.NORTH);
          JButton fill = new JButton("Set Background");  // The first button.
          fill.addActionListener(canvas);
          buttonBar.add(fill);
          JButton clear = new JButton("Clear");   // The second button.
          clear.addActionListener(canvas);
          buttonBar.add(clear);
          colorChoice = new JComboBox();  // The pop-up menu of colors.
          colorChoice.addItem("Black");
          colorChoice.addItem("Red");
          colorChoice.addItem("Green");
          colorChoice.addItem("Blue");
          colorChoice.addItem("Cyan");
          colorChoice.addItem("Magenta");
          colorChoice.addItem("Yellow");
          colorChoice.addItem("White");
          colorChoice.setBackground(Color.white);
          choiceBar.add(colorChoice);
          figureChoice = new JComboBox();  // The pop-up menu of shapes.
          figureChoice.addItem("Curve");
          figureChoice.addItem("Straight Line");
          figureChoice.addItem("Rectangle");
          figureChoice.addItem("Oval");
          figureChoice.addItem("RoundRect");
          figureChoice.addItem("Filled Rectangle");
          figureChoice.addItem("Filled Oval");
          figureChoice.addItem("Filled RoundRect");
          figureChoice.setBackground(Color.white);
          choiceBar.add(figureChoice);
       }  // end init()
       public Insets getInsets() {
              // Specify how wide a border to leave around the edges of the applet.
          return new Insets(3,3,3,3);
       private class Display extends JPanel
                  implements MouseListener, MouseMotionListener, ActionListener {
               // Nested class Display represents the drawing surface of the
               // applet.  It lets the user use the mouse to draw colored curves
               // and shapes.  The current color is specified by the pop-up menu
               // colorChoice.  The current shape is specified by another pop-up menu,
               // figureChoice.  (These are instance variables in the main class.)
               // The panel also listens for action events from buttons
               // named "Clear" and "Set Background".  The "Clear" button fills
               // the panel with the current background color.  The "Set Background"
               // button sets the background color to the current drawing color and
               // then clears.  These buttons are set up in the main class.
          private final static int
                      BLACK = 0,
                      RED = 1,            // Some constants to make
                      GREEN = 2,          // the code more readable.
                      BLUE = 3,           // These numbers code for
                      CYAN = 4,           // the different drawing colors.
                      MAGENTA = 5,
                      YELLOW = 6,
                      WHITE = 7;
          private final static int
                     CURVE = 0,
                     LINE = 1,
                     RECT = 2,               // Some constants that code
                     OVAL = 3,               // for the different types of
                     ROUNDRECT = 4,          // figure the program can draw.
                     FILLED_RECT = 5,
                     FILLED_OVAL = 6,
                     FILLED_ROUNDRECT = 7;
          /* Some variables used for backing up the contents of the panel. */
          Image OSI;  // The off-screen image (created in checkOSI()).
          int widthOfOSI, heightOfOSI;  // Current width and height of OSI.  These
                                        // are checked against the size of the applet,
                                        // to detect any change in the panel's size.
                                        // If the size has changed, a new OSI is created.
                                        // The picture in the off-screen image is lost
                                        // when that happens.
          /* The following variables are used when the user is sketching a
             curve while dragging a mouse. */
          private int mouseX, mouseY;   // The location of the mouse.
          private int prevX, prevY;     // The previous location of the mouse.
          private int startX, startY;   // The starting position of the mouse.
                                        // (Not used for drawing curves.)
          private boolean dragging;     // This is set to true when the user is drawing.
          private int figure;    // What type of figure is being drawn.  This is
                                 //    specified by the figureChoice menu.
          private Graphics dragGraphics;  // A graphics context for the off-screen image,
                                          // to be used while a drag is in progress.
          private Color dragColor;  // The color that is used for the figure that is
                                    // being drawn.
          Display() {
                 // Constructor.  When this component is first created, it is set to
                 // listen for mouse events and mouse motion events from
                 // itself.  The initial background color is white.
             addMouseListener(this);
             addMouseMotionListener(this);
             setBackground(Color.white);
          private void drawFigure(Graphics g, int shape, int x1, int y1, int x2, int y2) {
                // This method is called to do ALL drawing in this applet!
                // Draws a shape in the graphics context g.
                // The shape paramter tells what kind of shape to draw.  This
                // can be LINE, RECT, OVAL, ROUNTRECT, FILLED_RECT,
                // FILLED_OVAL, or FILLED_ROUNDRECT.  (Note that a CURVE is
                // drawn by drawing multiple LINES, so the shape parameter is
                // never equal to CURVE.)  For a LINE, a line is drawn from
                // the point (x1,y1) to (x2,y2).  For other shapes,  the
                // points (x1,y1) and (x2,y2) give two corners of the shape
                // (or of a rectangle that contains the shape).
             if (shape == LINE) {
                   // For a line, just draw the line between the two points.
                g.drawLine(x1,y1,x2,y2);
                return;
             int x, y;  // Top left corner of rectangle that contains the figure.
             int w, h;  // Width and height of rectangle that contains the figure.
             if (x1 >= x2) {  // x2 is left edge
                x = x2;
                w = x1 - x2;
             else {          // x1 is left edge
                x = x1;
                w = x2 - x1;
             if (y1 >= y2) {  // y2 is top edge
                y = y2;
                h = y1 - y2;
             else {          // y1 is top edge.
                y = y1;
                h = y2 - y1;
             switch (shape) {   // Draw the appropriate figure.
                case RECT:
                   g.drawRect(x, y, w, h);
                   break;
                case OVAL:
                   g.drawOval(x, y, w, h);
                   break;
                case ROUNDRECT:
                   g.drawRoundRect(x, y, w, h, 20, 20);
                   break;
                case FILLED_RECT:
                   g.fillRect(x, y, w, h);
                   break;
                case FILLED_OVAL:
                   g.fillOval(x, y, w, h);
                   break;
                case FILLED_ROUNDRECT:
                   g.fillRoundRect(x, y, w, h, 20, 20);
                   break;
          private void repaintRect(int x1, int y1, int x2, int y2) {
                // Call repaint on a rectangle that contains the points (x1,y1)
                // and (x2,y2).  (Add a 1-pixel border along right and bottom
                // edges to allow for the pen overhang when drawing a line.)
             int x, y;  // top left corner of rectangle that contains the figure
             int w, h;  // width and height of rectangle that contains the figure
             if (x2 >= x1) {  // x1 is left edge
                x = x1;
                w = x2 - x1;
             else {          // x2 is left edge
                x = x2;
                w = x1 - x2;
             if (y2 >= y1) {  // y1 is top edge
                y = y1;
                h = y2 - y1;
             else {          // y2 is top edge.
                y = y2;
                h = y1 - y2;
             repaint(x,y,w+1,h+1);
          private void checkOSI() {
               // This method is responsible for creating the off-screen image.
               // It should be called before using the OSI.  It will make a new OSI if
               // the size of the panel changes.
             if (OSI == null || widthOfOSI != getSize().width || heightOfOSI != getSize().height) {
                    // Create the OSI, or make a new one if panel size has changed.
                OSI = null;  // (If OSI already exists, this frees up the memory.)
                OSI = createImage(getSize().width, getSize().height);
                widthOfOSI = getSize().width;
                heightOfOSI = getSize().height;
                Graphics OSG = OSI.getGraphics();  // Graphics context for drawing to OSI.
                OSG.setColor(getBackground());
                OSG.fillRect(0, 0, widthOfOSI, heightOfOSI);
                OSG.dispose();
          public void paintComponent(Graphics g) {
               // Copy the off-screen image to the screen,
               // after checking to make sure it exists.  Then,
               // if a shape other than CURVE is being drawn,
               // draw it on top of the image from the OSI.
             checkOSI();
             g.drawImage(OSI, 0, 0, this);
             if (dragging && figure != CURVE) {
                g.setColor(dragColor);
                drawFigure(g,figure,startX,startY,mouseX,mouseY);
          public void actionPerformed(ActionEvent evt) {
                  // Respond when the user clicks on a button.  The
                  // command must be either "Clear" or "Set Background".
             String command = evt.getActionCommand();
             checkOSI();
             if (command.equals("Set Background")) {
                    // Set background color before clearing.
                    // Change the selected color so it is different
                    // from the background color.
                setBackground(getCurrentColor());
                if (colorChoice.getSelectedIndex() == BLACK)
                   colorChoice.setSelectedIndex(WHITE);
                else
                   colorChoice.setSelectedIndex(BLACK);
             Graphics g = OSI.getGraphics();
             g.setColor(getBackground());
             g.fillRect(0,0,getSize().width,getSize().height);
             g.dispose();
             repaint();
          private Color getCurrentColor() {
                   // Check the colorChoice menu to find the currently
                   // selected color, and return the appropriate color
                   // object.
             int currentColor = colorChoice.getSelectedIndex();
             switch (currentColor) {
                case BLACK:
                   return Color.black;
                case RED:
                   return Color.red;
                case GREEN:
                   return Color.green;
                case BLUE:
                   return Color.blue;
                case CYAN:
                   return Color.cyan;
                case MAGENTA:
                   return Color.magenta;
                case YELLOW:
                   return Color.yellow;
                default:
                   return Color.white;
          public void mousePressed(MouseEvent evt) {
                  // This is called when the user presses the mouse on the
                  // panel.  This begins a draw operation in which the user
                  // sketches a curve or draws a shape.  (Note that curves
                  // are handled differently from other shapes.  For CURVE,
                  // a new segment of the curve is drawn each time the user
                  // moves the mouse.  For the other shapes, a "rubber band
                  // cursor" is used.  That is, the figure is drawn between
                  // the starting point and the current mouse location.)
             if (dragging == true)  // Ignore mouse presses that occur
                 return;            //    when user is already drawing a curve.
                                    //    (This can happen if the user presses
                                    //    two mouse buttons at the same time.)
             prevX = startX = evt.getX();  // Save mouse coordinates.
             prevY = startY = evt.getY();
             figure = figureChoice.getSelectedIndex();
             dragColor = getCurrentColor();        
             dragGraphics = OSI.getGraphics();
             dragGraphics.setColor(dragColor);
             dragging = true;  // Start drawing.
          } // end mousePressed()
          public void mouseReleased(MouseEvent evt) {
                  // Called whenever the user releases the mouse button.
                  // If the user was drawing a shape, we make the shape
                  // permanent by drawing it to the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              dragging = false;
              mouseX = evt.getX();
              mouseY = evt.getY();
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs
                  drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                  repaintRect(prevX,prevY,mouseX,mouseY);
              else if (figure == LINE) {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX || mouseY != startY) {
                       // Draw the line only if it has non-zero length.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              else {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX && mouseY != startY) {
                       // Draw the shape only if both its height
                       // and width are both non-zero.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              dragGraphics.dispose();
              dragGraphics = null;
          public void mouseDragged(MouseEvent evt) {
                   // Called whenever the user moves the mouse while a mouse button
                   // is down.  If the user is drawing a curve, draw a segment of
                   // the curve on the off-screen image, and repaint the part
                   // of the panel that contains the new line segment.  Otherwise,
                   // just call repaint and let paintComponent() draw the shape on
                   // top of the picture in the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              mouseX = evt.getX();   // x-coordinate of mouse.
              mouseY = evt.getY();   // y=coordinate of mouse.
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs.
                 drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                 repaintRect(prevX,prevY,mouseX,mouseY);
              else {
                    // Repaint two rectangles:  The one that contains the previous
                    // version of the figure, and the one that will contain the
                    // new version.  The first repaint is necessary to restore
                    // the picture from the off-screen image in that rectangle.
                 repaintRect(startX,startY,prevX,prevY);
                 repaintRect(startX,startY,mouseX,mouseY);
              prevX = mouseX;  // Save coords for the next call to mouseDragged or mouseReleased.
              prevY = mouseY;
          } // end mouseDragged.
          public void mouseEntered(MouseEvent evt) { }   // Some empty routines.
          public void mouseExited(MouseEvent evt) { }    //    (Required by the MouseListener
          public void mouseClicked(MouseEvent evt) { }   //    and MouseMotionListener
          public void mouseMoved(MouseEvent evt) { }     //    interfaces).
       } // end nested class Display
    } // end class SimplePaint3

    Im quite the novice, how exactly do I go about doing that. What I did was to put both in diff files but I got errors saying that they cant find colorChoice, figureChoice in the Display class.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Simple extends JFrame implements Display{
            // The main applet class simply sets up the applet.  Most of the
            // work is done in the Display class.
       JComboBox colorChoice, figureChoice;  // Pop-up menus, defined as instance
                                             // variables so that the Display
                                             // class can see them.
       public void init() {
          setBackground(Color.gray);
          getContentPane().setBackground(Color.gray);
          Display canvas = new Display();  // The drawing area.
          getContentPane().add(canvas,BorderLayout.CENTER);
          JPanel buttonBar = new JPanel();       // A panel to hold the buttons.
          buttonBar.setBackground(Color.gray);
          getContentPane().add(buttonBar, BorderLayout.SOUTH);
          JPanel choiceBar = new JPanel();       // A panel to hole the pop-up menus
          choiceBar.setBackground(Color.gray);
          getContentPane().add(choiceBar, BorderLayout.NORTH);
          JButton fill = new JButton("Set Background");  // The first button.
          fill.addActionListener(canvas);
          buttonBar.add(fill);
          JButton clear = new JButton("Clear");   // The second button.
          clear.addActionListener(canvas);
          buttonBar.add(clear);
          colorChoice = new JComboBox();  // The pop-up menu of colors.
          colorChoice.addItem("Black");
          colorChoice.addItem("Red");
          colorChoice.addItem("Green");
          colorChoice.addItem("Blue");
          colorChoice.addItem("Cyan");
          colorChoice.addItem("Magenta");
          colorChoice.addItem("Yellow");
          colorChoice.addItem("White");
          colorChoice.setBackground(Color.white);
          choiceBar.add(colorChoice);
          figureChoice = new JComboBox();  // The pop-up menu of shapes.
          figureChoice.addItem("Curve");
          figureChoice.addItem("Straight Line");
          figureChoice.addItem("Rectangle");
          figureChoice.addItem("Oval");
          figureChoice.addItem("RoundRect");
          figureChoice.addItem("Filled Rectangle");
          figureChoice.addItem("Filled Oval");
          figureChoice.addItem("Filled RoundRect");
          figureChoice.setBackground(Color.white);
          choiceBar.add(figureChoice);
       }  // end init()
    } // end class SimplePaint3
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Display extends JPanel
                  implements MouseListener, MouseMotionListener, ActionListener {
               // Nested class Display represents the drawing surface of the
               // applet.  It lets the user use the mouse to draw colored curves
               // and shapes.  The current color is specified by the pop-up menu
               // colorChoice.  The current shape is specified by another pop-up menu,
               // figureChoice.  (These are instance variables in the main class.)
               // The panel also listens for action events from buttons
               // named "Clear" and "Set Background".  The "Clear" button fills
               // the panel with the current background color.  The "Set Background"
               // button sets the background color to the current drawing color and
               // then clears.  These buttons are set up in the main class.
          private final static int
                      BLACK = 0,
                      RED = 1,            // Some constants to make
                      GREEN = 2,          // the code more readable.
                      BLUE = 3,           // These numbers code for
                      CYAN = 4,           // the different drawing colors.
                      MAGENTA = 5,
                      YELLOW = 6,
                      WHITE = 7;
          private final static int
                     CURVE = 0,
                     LINE = 1,
                     RECT = 2,               // Some constants that code
                     OVAL = 3,               // for the different types of
                     ROUNDRECT = 4,          // figure the program can draw.
                     FILLED_RECT = 5,
                     FILLED_OVAL = 6,
                     FILLED_ROUNDRECT = 7;
          /* Some variables used for backing up the contents of the panel. */
          Image OSI;  // The off-screen image (created in checkOSI()).
          int widthOfOSI, heightOfOSI;  // Current width and height of OSI.  These
                                        // are checked against the size of the applet,
                                        // to detect any change in the panel's size.
                                        // If the size has changed, a new OSI is created.
                                        // The picture in the off-screen image is lost
                                        // when that happens.
          /* The following variables are used when the user is sketching a
             curve while dragging a mouse. */
          private int mouseX, mouseY;   // The location of the mouse.
          private int prevX, prevY;     // The previous location of the mouse.
          private int startX, startY;   // The starting position of the mouse.
                                        // (Not used for drawing curves.)
          private boolean dragging;     // This is set to true when the user is drawing.
          private int figure;    // What type of figure is being drawn.  This is
                                 //    specified by the figureChoice menu.
          private Graphics dragGraphics;  // A graphics context for the off-screen image,
                                          // to be used while a drag is in progress.
          private Color dragColor;  // The color that is used for the figure that is
                                    // being drawn.
          Display() {
                 // Constructor.  When this component is first created, it is set to
                 // listen for mouse events and mouse motion events from
                 // itself.  The initial background color is white.
             addMouseListener(this);
             addMouseMotionListener(this);
             setBackground(Color.white);
          private void drawFigure(Graphics g, int shape, int x1, int y1, int x2, int y2) {
                // This method is called to do ALL drawing in this applet!
                // Draws a shape in the graphics context g.
                // The shape paramter tells what kind of shape to draw.  This
                // can be LINE, RECT, OVAL, ROUNTRECT, FILLED_RECT,
                // FILLED_OVAL, or FILLED_ROUNDRECT.  (Note that a CURVE is
                // drawn by drawing multiple LINES, so the shape parameter is
                // never equal to CURVE.)  For a LINE, a line is drawn from
                // the point (x1,y1) to (x2,y2).  For other shapes,  the
                // points (x1,y1) and (x2,y2) give two corners of the shape
                // (or of a rectangle that contains the shape).
             if (shape == LINE) {
                   // For a line, just draw the line between the two points.
                g.drawLine(x1,y1,x2,y2);
                return;
             int x, y;  // Top left corner of rectangle that contains the figure.
             int w, h;  // Width and height of rectangle that contains the figure.
             if (x1 >= x2) {  // x2 is left edge
                x = x2;
                w = x1 - x2;
             else {          // x1 is left edge
                x = x1;
                w = x2 - x1;
             if (y1 >= y2) {  // y2 is top edge
                y = y2;
                h = y1 - y2;
             else {          // y1 is top edge.
                y = y1;
                h = y2 - y1;
             switch (shape) {   // Draw the appropriate figure.
                case RECT:
                   g.drawRect(x, y, w, h);
                   break;
                case OVAL:
                   g.drawOval(x, y, w, h);
                   break;
                case ROUNDRECT:
                   g.drawRoundRect(x, y, w, h, 20, 20);
                   break;
                case FILLED_RECT:
                   g.fillRect(x, y, w, h);
                   break;
                case FILLED_OVAL:
                   g.fillOval(x, y, w, h);
                   break;
                case FILLED_ROUNDRECT:
                   g.fillRoundRect(x, y, w, h, 20, 20);
                   break;
          private void repaintRect(int x1, int y1, int x2, int y2) {
                // Call repaint on a rectangle that contains the points (x1,y1)
                // and (x2,y2).  (Add a 1-pixel border along right and bottom
                // edges to allow for the pen overhang when drawing a line.)
             int x, y;  // top left corner of rectangle that contains the figure
             int w, h;  // width and height of rectangle that contains the figure
             if (x2 >= x1) {  // x1 is left edge
                x = x1;
                w = x2 - x1;
             else {          // x2 is left edge
                x = x2;
                w = x1 - x2;
             if (y2 >= y1) {  // y1 is top edge
                y = y1;
                h = y2 - y1;
             else {          // y2 is top edge.
                y = y2;
                h = y1 - y2;
             repaint(x,y,w+1,h+1);
          private void checkOSI() {
               // This method is responsible for creating the off-screen image.
               // It should be called before using the OSI.  It will make a new OSI if
               // the size of the panel changes.
             if (OSI == null || widthOfOSI != getSize().width || heightOfOSI != getSize().height) {
                    // Create the OSI, or make a new one if panel size has changed.
                OSI = null;  // (If OSI already exists, this frees up the memory.)
                OSI = createImage(getSize().width, getSize().height);
                widthOfOSI = getSize().width;
                heightOfOSI = getSize().height;
                Graphics OSG = OSI.getGraphics();  // Graphics context for drawing to OSI.
                OSG.setColor(getBackground());
                OSG.fillRect(0, 0, widthOfOSI, heightOfOSI);
                OSG.dispose();
          public void paintComponent(Graphics g) {
               // Copy the off-screen image to the screen,
               // after checking to make sure it exists.  Then,
               // if a shape other than CURVE is being drawn,
               // draw it on top of the image from the OSI.
             checkOSI();
             g.drawImage(OSI, 0, 0, this);
             if (dragging && figure != CURVE) {
                g.setColor(dragColor);
                drawFigure(g,figure,startX,startY,mouseX,mouseY);
          public void actionPerformed(ActionEvent evt) {
                  // Respond when the user clicks on a button.  The
                  // command must be either "Clear" or "Set Background".
             String command = evt.getActionCommand();
             checkOSI();
             if (command.equals("Set Background")) {
                    // Set background color before clearing.
                    // Change the selected color so it is different
                    // from the background color.
                setBackground(getCurrentColor());
                if (colorChoice.getSelectedIndex() == BLACK)
                   colorChoice.setSelectedIndex(WHITE);
                else
                   colorChoice.setSelectedIndex(BLACK);
             Graphics g = OSI.getGraphics();
             g.setColor(getBackground());
             g.fillRect(0,0,getSize().width,getSize().height);
             g.dispose();
             repaint();
          private Color getCurrentColor() {
                   // Check the colorChoice menu to find the currently
                   // selected color, and return the appropriate color
                   // object.
             int currentColor = colorChoice.getSelectedIndex();
             switch (currentColor) {
                case BLACK:
                   return Color.black;
                case RED:
                   return Color.red;
                case GREEN:
                   return Color.green;
                case BLUE:
                   return Color.blue;
                case CYAN:
                   return Color.cyan;
                case MAGENTA:
                   return Color.magenta;
                case YELLOW:
                   return Color.yellow;
                default:
                   return Color.white;
          public void mousePressed(MouseEvent evt) {
                  // This is called when the user presses the mouse on the
                  // panel.  This begins a draw operation in which the user
                  // sketches a curve or draws a shape.  (Note that curves
                  // are handled differently from other shapes.  For CURVE,
                  // a new segment of the curve is drawn each time the user
                  // moves the mouse.  For the other shapes, a "rubber band
                  // cursor" is used.  That is, the figure is drawn between
                  // the starting point and the current mouse location.)
             if (dragging == true)  // Ignore mouse presses that occur
                 return;            //    when user is already drawing a curve.
                                    //    (This can happen if the user presses
                                    //    two mouse buttons at the same time.)
             prevX = startX = evt.getX();  // Save mouse coordinates.
             prevY = startY = evt.getY();
             figure = figureChoice.getSelectedIndex();
             dragColor = getCurrentColor();        
             dragGraphics = OSI.getGraphics();
             dragGraphics.setColor(dragColor);
             dragging = true;  // Start drawing.
          } // end mousePressed()
          public void mouseReleased(MouseEvent evt) {
                  // Called whenever the user releases the mouse button.
                  // If the user was drawing a shape, we make the shape
                  // permanent by drawing it to the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              dragging = false;
              mouseX = evt.getX();
              mouseY = evt.getY();
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs
                  drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                  repaintRect(prevX,prevY,mouseX,mouseY);
              else if (figure == LINE) {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX || mouseY != startY) {
                       // Draw the line only if it has non-zero length.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              else {
                 repaintRect(startX,startY,prevX,prevY);
                 if (mouseX != startX && mouseY != startY) {
                       // Draw the shape only if both its height
                       // and width are both non-zero.
                    drawFigure(dragGraphics,figure,startX,startY,mouseX,mouseY);
                    repaintRect(startX,startY,mouseX,mouseY);
              dragGraphics.dispose();
              dragGraphics = null;
          public void mouseDragged(MouseEvent evt) {
                   // Called whenever the user moves the mouse while a mouse button
                   // is down.  If the user is drawing a curve, draw a segment of
                   // the curve on the off-screen image, and repaint the part
                   // of the panel that contains the new line segment.  Otherwise,
                   // just call repaint and let paintComponent() draw the shape on
                   // top of the picture in the off-screen image.
              if (dragging == false)
                 return;  // Nothing to do because the user isn't drawing.
              mouseX = evt.getX();   // x-coordinate of mouse.
              mouseY = evt.getY();   // y=coordinate of mouse.
              if (figure == CURVE) {
                     // A CURVE is drawn as a series of LINEs.
                 drawFigure(dragGraphics,LINE,prevX,prevY,mouseX,mouseY);
                 repaintRect(prevX,prevY,mouseX,mouseY);
              else {
                    // Repaint two rectangles:  The one that contains the previous
                    // version of the figure, and the one that will contain the
                    // new version.  The first repaint is necessary to restore
                    // the picture from the off-screen image in that rectangle.
                 repaintRect(startX,startY,prevX,prevY);
                 repaintRect(startX,startY,mouseX,mouseY);
              prevX = mouseX;  // Save coords for the next call to mouseDragged or mouseReleased.
              prevY = mouseY;
          } // end mouseDragged.
          public void mouseEntered(MouseEvent evt) { }   // Some empty routines.
          public void mouseExited(MouseEvent evt) { }    //    (Required by the MouseListener
          public void mouseClicked(MouseEvent evt) { }   //    and MouseMotionListener
          public void mouseMoved(MouseEvent evt) { }     //    interfaces).
       } // end nested class Display

  • This was only 1 page, not a large amt of printing?

    This was only 1 page, not a large amount of printing?

    Your post makes no sense the way it is written, please take some time to recompose and ask a question. Please remember we are end users just like you and cannot read minds or see what you're doing so you need to write clearly and draw an accurate picture of what is occuring.

  • 8/20/2014 - Beta - AIR 15.0.0.233 Runtime and SDK

    Adobe AIR Beta Channel Update
    This beta release provides access to the latest AIR runtime and SDK (with compiler) for Windows, Mac OS, iOS and Android.  You can download the AIR beta here: Download Adobe AIR 15 Beta - Adobe Labs
    Below are some of the key features and benefits of AIR 15. Please see our release notes for full details.
    New Features:
    Stage3D “Standard” profile support for iOS and Android
    In the Flash Runtime 14 release we introduced the Stage3D “Standard” profile which provided many advanced 3D features.  At that time, the “Standard” profile was only available on desktop platforms.  In the AIR 15 release we are extending this coverage to mobile platforms.  If a device supports OpenGL ES3, it can successfully request the “Standard” profile and use the same advanced features as the desktop platform.
    Relaxing Stage3D Render Target Clear
    In previous versions of Stage3D, after switching the render texture through Context3D::setRenderToTexture, you were required to clear it before drawing. In this release, we're removing this limitation and optimizing the use of render textures. This change will allow you to further optimize and reuse depth and stencil buffers between different render textures.
    StageText.drawViewPortToBitmapData now supports Retina displays
    Currently, AIR will allow a bitmap with the same width/height of the StageText object to be passed into drawViewPortToBitmapData.  While fine for standard resolution displays, this is not sufficient for Apple's Retina HiDPI displays.  Based on customer feedback, we've altered the drawViewPortToBitmapData method to accept a doubled size BitmapData with StageText's view port on a Mac Retina display, and then draw a HiDPI image from the view port.
    Improved Packaging Engine is now default - iOS
    Starting AIR 15, new improved IPA packaging engine is now the default packaging mode when packaging for AOT targets ipa-app-store, ipa-test, ipa-ad-hoc and ipa-debug. If you encounter any packaging or runtime issues, please report at http://bugbase.adobe.com. To use older packaging mode, use "-useLegacyAOT yes" in the ADT command, before the signing options. To learn more about the feature, please follow http://www.adobe.com/devnet/air/articles/ios-packaging-compiled-mode.html
    AIR Gamepad Enhancements
    AIR Gamepad feature enables the app developers to provide a second screen on Android mobile devices for the Flash based browser games. AIR Gamepad API enables Flash based browser apps to connect to a paired Android device running the AIR Runtime app and therefore allowing the Android devices to be used as game controllers or second-screen interfaces. Following enhancements are available starting AIR 15.
    Multiplayer Support
    Gyroscope Events
    Magnetometer Events
    Applying skin as AIR gamepad screen
    To learn more about the feature and usage guidelines, please follow www.adobe.com/devnet/air/articles/android-air-devices-as-gamepads.html
    AIR Cross Promotion
    Adobe AIR 15 now supports cross promotion of AIR games for mobile devices. Cross promotions can be effective in saving some amount of advertising cost. With the right partnership, you gain access to a wider customer base with a demographic similar to that of your application. This cross promotion is free and works on a credit system. All you need is to earn enough credit points by promoting other AIR games to begin your own promotion campaign. The AIR SDK offers the new AdViewer API for promotion campaigns as a SWC, it provides functions to load and show in-game advertisements. You earn credit points for promoting AIR games by other developers based on ad impressions and clicks. To learn more about the feature and usage guidelines, please follow www.adobe.com/devnet/air/articles/cross-promotion-of-air-games-mobile.html
    Fixed Issues:
    Multiple stability fixes
    Failing to call Context3D.clear before drawing on every frame no longer throws a runtime error. (3726980)
    Poor AIR performance while starting app after restarting Windows OS. (3690665)
    ADL crashes when Workers attempt to open local shared object. (3768436)
    StageVideo with camera doesn't work properly, no video is displayed. (3781244)
    [iOS] [Fast Packager] Couple of runtime performance fixes in new fast packager.(3695884)
    Known Issues:
    [AIR] [Android L] Application hangs on playing Mp4 videos.
    [AIR] [Android L] Arabic, Hebrew, Korean, Bengali, thai characters are displayed as boxes.
    [Javascript] Custom cursor failed on the Jscode HTML AIR app, but success on the AS code AIR APP. (3792475)
    [Win]Unable to prevent default when pasting into TextField with AIR 14.(3776183)
    AIR Publish Fails when Including Large Files. (3772815)
    [Win] GPU accelerated video stop playing when screen resolution changes after NetStream.Buffer.Flush event. (3766000)
    Dispatching Sound Complete. (3764974)
    [iOS] [Fast Packager] "Compilation failed while executing: compile-abc" error pops out when packaging some large AS code applications. (3753783)
    [iOS] [Fast Packager] FPS reduces for Feathers Component Explorer app on iPad when packaged with fast packager.(3776055 )
    About the Beta Channel
    If you would like real-time notification for announcements related to the AIR Beta Channel please follow the Flash Runtime Announcements forums by choosing "Follow this forum" from the right-hand menu on the Forums page.
    You can find instructions for getting started with this release here: AIR Labs Page

    I've settled on the following workaround, which fixes the problem consistently, albeit with a slight flicker sometimes:
    Check if you're on Android;
    Add an ENTER_FRAME listener to the stage in the activation handler (called when returning to the app from an overlay displayed by a native extension);
    Use a ticker to have 2 frames delay between the quality switch, anything quicker than that resulted in inconsistent or non-functional behavior for our app;
    Switch from StageQuality.LOW to StageQuality.HIGH and back again. Going to MEDIUM and back did *not* result in a fix.
    In my case, the code for the switch itself looks like this:
    private function OnActivate(event:Event):void
         if (Settings.IS_ANDROID)
              _Ticker = 0;
              stage.addEventListener(Event.ENTER_FRAME, OnEnterFrameFixGPUContextLoss);
    private function OnEnterFrameFixGPUContextLoss(event:Event):void
         _Ticker ++;
         if (stage.quality.toLowerCase() == StageQuality.LOW) // stage.quality returns string in capitals
              stage.quality = StageQuality.HIGH;
         else
              if (_Ticker > 2)
                   stage.quality = StageQuality.LOW;
                   stage.removeEventListener(Event.ENTER_FRAME, OnEnterFrameFixGPUContextLoss);

  • FAQ: What are the known issues so far in Photoshop CS6 Beta

    APPLICATION  COEXISTENCE
    Lightroom 4 Beta + Photoshop CS6 beta -- Editing the same video file simultanously in both applications may result in an error, crash, or blank (transparent) frames. You might see this Photoshop error: "Could not complete the Render Video command because of a problem with Adobe Media Encoder".
    This will only be an issue with Lightroom 4 beta and Photoshop CS6 beta on the same system, editing the same video. The released versions will not have this issue.
    Workaround: Upgrade to LR Release version (even if it's just the trial), or don't open the same file in both apps at the same time.
    CS5 Help fails to launch after install of CS6
    Workaround: Launch the stand alone "Adobe Help" application or reinstall CS5
    CROP
    Crop action shows wrong crop box.Playing an action with a crop step that has dialogs turned on results in a crop box that covers the entire canvas instead of the expected area.
                    Workaround: Ensure that the Crop Tool is selected before running the action or disable dialogs for the action.
    FILTERS
    (32bit OS only) Initial "Merge to HDR Pro" image display and result is black until settings are changed
    Workaround: It will remain black until droplist in the "mode" line is selected, changed and activated, then action appears to be normal.
    Bokeh color is different from preview after render at certain zoom levels on particular image patterns
    Workaround: View image at 100%
    Lighting effects bump map generates artifacts if an alpha channel bump map is used. The resulting preview and final image is artifacted across the gradiated areas of the alpha channel.
                   Workaround: Do not use a gradiated alpha channel as a bump map
    Liquify will perform the filter and save to just part of the photo if you click cancel while it is "finishing processing" a large file.
    LAYERS
    If a vector layer has a center-aligned stroke combined with an inside-aligned layer style stroke, then that vector layer's stroke may not display correctly -- part of the vector layer stroke will disappear as the layer is moved around the image.
    Workaround: Use the "Path Selection Tool" to move your vector around -- alternatively, Change the stroke alignment or remove underlying layers.
    Dragging a selection box while layer filters are applied stops marquee selection from following cursor movement
    Workaround: Even though the graphic of the selection marquee stops, the selection still happens. OR Turn off layer filtering before targeting the layers using a selection box
    TYPE
    Editing text attributes in the Character panel when the layer is locked can result in a crash
    Workaround: Unlock your text layer prior to attribute adjustments in the Character panel
    Setting the menu type>font>preview size to "huge" after opening a saved file caused photoshop to crash
    Workaround: Uncheck Background save in Photoshop CS6
    Style by example or definition not working as expected:
    If any attribute in the Paragraph Panel is set and you create a new Paragraph Style, the new style is based on the default and the override is not cleared.
    DRAWING AND PAINTING
    Paint is offset with Grip Pen- if you select the Soft Low Density Airbrush Preset with Grip Pen paint with swicth facing right with a high tilt towards you the cursor shows the spray should be going up, but it sprays down.
    3-D
    Creating a video timeline and rendering video from two 3D layers may not include ground plane reflections
    Workaround: Use mesh for ground plane instead of 3D engines construct, or duplicate the file and remove the keyframes
    Creating a New background texture after changing lighting presets results in crash
    Workaround: Create the New background texture prior to adjusting lighting presets
    Unable to create a constraint on extruded object with Pillow Inflate setting applied. Further actions may result in Photoshop instability or crash.
    Photoshop may crash when trying to align/distribute constraints from selections of two 3-D extruded objects
    Photoshop may not always save a texture when you paint directly onto the 3d object using Paint on Target Texture setting.
    Photoshop may crash when selecting a different panel filter after the focus has been on 2 fields in the environment flyout with IBL map present
    Photoshop may crash after embedding a 3D layer into a layer group, creating a new 3d object in the group, and then closing the document.
    When changing the color of the lines or points in the 3D scene cross section from the Properties panel, side b color overwrites the color in side A.
    Program Error when adjusting fill value in Layers panel while in Lighting Effects workspace.
    Workaround:You will have to use opacity slider instead of fill slider to pull back the lighting effect
    PLUGINS
    DUPLICATE PLUGINS CAUSE ISSUES ON MAC:
    If you install duplicate plugins or point the additional plugins folder preferences to a duplicate set of plugins (such as, to an older version of Photoshop), then it is possible for odd Photoshop behavior, such as an inappropriate file extension to appear when saving files.
    (example: while performing a "save as"  to JPEG file type, the file format appears to change to .dcm)
    In this case, there may be a duplicate "file formats" plugin that's populating the Save As file types list with duplicates of the same options.
    If there are duplicate file format plugins installed, the Mac OS will remove the duplicates from the list, but you may still see the odd saving behavior.
    Solution:
    Remove the duplicate plugins.
    If you are not sure if you have this issue, but are seeing odd behavior, you can check for duplicates by looking through the plugins listed in the Help > System Info dialog.
    Bridge
    Unable to Copy and Paste in File info in Bridge
    Workaround: Typing info in Manually works, or copy and paste work in Photoshop's File Info dialog
    Install
    Adobe Setup Utility may quit, or error during install. You may see error: "Exit Code: 15"
    Workaround: Create a folder named 'Templates' at "<Windows drive>:\Users\<current user login id>\AppData\Roaming\Micorsoft\Windows\"
    Message saying trial of PS CS6 beta expired,Content coming soon, stay tuned.
    Workaround: re-launch photoshop CS6 beta. This issue should not happen anymore

    1. You can get full support for your camera by upgrading to Lightroom 4. But personally, I would wait for Lightroom 5 since it will be released shortly, probably within the next month. Lightroom 5 will work with Photoshop CS5. The only difference is that Lightroom will need to create a TIF or PSD file that contains all the changes you have made in Lightroom. That's not a big deal, in my opinion. That file has to be created at some point anyway whenever you use Photoshop.
    2. Yes, Lightroom 4 will pass images back and forth between it and Photoshop.
    3.  The upgrade would not break Lightroom 3. It would essentially work the same as it does with your current setup.
    4. If you purchase CS6 it is my understanding you will be allowed to use it indefinitely. This is not true of the Creative Cloud version. Support and updating for additional cameras will cease for CS6. Adobe has announced that they will make Camera Raw 8.1 so that it can be usable with CS6 as far as reading Lightroom adjustments. But any new controls will not be accessible.
    5. So far, Adobe has indicated that they have no plans to making Lightroom a subscription-only offering.
    You are asking your questions as though you are addressing Adobe directly. This is a User-to-user forum. I don't work for nor do I speak for Adobe. I am only giving you the information as I understand it. It seems to me that upgrading to Photoshop CS6 and Lightroom 5 is a "safe" choice. None of us, not even Adobe, really knows what the future will bring. Technology changes so quickly anymore that everything we are doing right now could be obsolete in a matter of a very short period of time. As Adobe changes their marketing strategies I think it will probably motivate some people to look elsewhere. I have Photoshop CS6 and I'm going to upgrade to Lightroom 5. Then I will have to wait and see what develops after that. At any rate, I have tools that I can use for the foreseeable future. If I have to change at some point then I will do so.

Maybe you are looking for

  • In BPM - How to populate the recievers

    Hi All, I need to create two files from my BPM. Basically I am using a fork (without any condition) and it should create me two files in anycase.                    Mapping1 -> receiver detremination1 -> send1    Fork--->  {                    Mappin

  • Portability between Designer 9i r2 and Designer 10g r2, and deployment?

    I have some questions to ask... I have been given the job of adding Oracle to the reportoire of databases available to be used for a commercial Delphi application. The idea is to create a database in 10g that this application can talk to. I wish to d

  • How to find out the top 20 queries used in a week

    Hi Guru's, I would like to know how to gather the information regarding the Top 20 queries used in the system per week, by a multicube. Note: I am using BI 7.0 and also Statistics are turned on. The aim is to pre-calculate these queries at night to h

  • My recent podcast episodes are not getting updated on my iTunes page.

    My podcast which hosts on Podomatic (http://mandate.podomatic.com/) has not been updating on iTunes for my last few episodes. Usually it takes a few hours or even a day, but its been weeks since iTunes updated my last episodes. I'm not too sure what

  • 32 bit Adobe Flash on 64 bit Windows 8 PC

    Are there problems with having the latest 32 bit version of Adobe Flash on a 64 bit Windows 8 PC?  Should I uninstall the 32 bit version and install the 64 bit one?