Problem in a canvas

I need to erase completely a canvas in which I have drawed images, and I am trying with drawing a rectangle of the etire size of the canvas with the same color but It seems that the images are above the rectangle and nothing happends. this is my paint method, please take a look, thank you very much.
public void paint(Graphics g)
g.setColor(new Color(136,136,251));
g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
for(int i = 0; i<image.length ; i++)
if(image!=null)
g.drawImage(image[i], 3 + i * 43, 3, this);

but It seems that the images are above the rectangle Well thats what you code is doing. First your draw a rectangle. Then you paint the images. How would you expect it to work any other way. If you set your image array to be empty, then there will be no images to draw.
By the way, why are you still using a Canvas. You've been told before that you should be using JPanel when using Swing and you should be overriding paintComponent().

Similar Messages

  • The problem of the Canvas and JInternalFrame

    I have some problem with the Canvas and JInternalFrame, my application contains serval internalframes and each has one canvas, but i found that canvas is at the top z-order of the window. so it result in that the canvas is at the same z-level, which confuse very much.
    who can help me with this problem, thanks.

    I think the problem stems from mixing AWT and Swing components (non-lightweight and lightweight)
    if the reason you are using a canvas is for the paint method; do away with them and just use a JPanel (which you can use the paint method within)
    hope this helps?!
    Simon

  • Problem with Stacked Canvas

    Hi,
    I have prepared a stacked canvas on a content canvas.
    Both content and stacked canvas are based on the same data block. In the data block 2 items are on content canvas and the remaining are on stacked canvas. I have also a scroll bar on the content canvas so that we can scroll to the right as there are many items on it.
    so 1st and 2nd fields are on the content canvas and remaining ones are on stacked canvas.when i tab out of the 1st field stacked canvas goes invisible, but when i tab out of the 2nd field stacked canvas again comes back.
    How can i avoid this?
    I want the stacked canvas always to be displayed when i tab out from any where.
    One more problem is, when i click on the 2nd field the stacked canvas goes invisible too
    Your suggestions are greatly appreciated.
    Thanks
    Sandeep

    Check if the second item overlaps the area of the stacked canvas. Forms always makes the current item be displayed fully and therefore hides all areas which would overlap the item.

  • Focus problem in TAB Canvas form

    Hi
    I am calling FormB from FormA by using
    CALL_form('FormB.FMX',NO_HIDE);
    But when I click on the any other field ( other than the first field in the called Form ), the screen is becoming blank, again I need to click on the Execute Query button, but after that I can click on any other field it wont go invisible.
    FormB has TAB canvas
    Oracle & Form Version Oracle 10g
    THanks in advance

    Hi,
    When I run the form directly also I am getting the same problem,
    Hi Tony,
    <<Define what's blank??? Errors???? >> means , I need to click on the execute query button to see the data, even to see the controls in the forms.
    As I said, i am calling this form from another form, and I am assign the values in the prequery, I am gettign the result propery, but when I click on any other control, the form become empty, I need to click on exec query to see the values and tex items etc.
    This form has one content canvas and one tab canvas.  What are the properies to set to place tab canvas on the content canvas.

  • Problem using tab canvas

    I am creating a form which has 2 canvases . The first one is a content canvas . The second one is a tab canvas . The problem is that at run time ,I need to click the "next block" button to get the tab canvas . It should have appeared below my content canvas to be correct . What do I need to do to solve this problem ? Thanks.

    How did you create your canvases? Did you create them separately and then through the properties of the Tab Canvas tell it where to be displayed? If so, this could be problematic. The best option I've found is to create your content canvas and then - using the Tools pallet on the left of the canvas screen - select the Tabbed Canvas button and draw the tabbed canvas on the content canvas. This ensures your tabbed canvas "fits" properly on your content canvas and gets displayed automatically during run-time.
    If this doesn't solve the issue, let us know a bit more details about how you created the canvases and we should be able to help you figure out a solution.
    Craig...

  • Problem with my Canvas Viewer

    Never had this problem before in over 8 years of Final cut editing...
    No images appear in my canvas viewer when I am editing! The canvas viewer is there, but no images appear when the playback is idol.
    Obviously this is pain in the neck if I want to position images, crop images, layer images on top of each other, etc.
    However, when I press "play", the playback in the canvas viewer works fine. I can watch everything that is in the timeline just fine. But once I stop the player, whichever point I stop at, that image is frozen there, until I press play again. Even when I click a new point on the timeline, the frozen image does not change.
    I just spent half a day clearing out my hard-drive. The Ram disc space says it's okay. And I even ran a disk utility check.
    *** FCP!
    Any suggestions? Anyone ever have this problem?

    Hi - Make sure the Canvas is set to display RGB:
    !http://www.spotsbeforeyoureyes.com/SetCanvastoRGB.jpg!
    Hope this helps.

  • Problem with resizing canvas

    PSE 8, Windows XP
    Attempting to resize the canvas I entire a width and a lenght. I leave the position square in the middle. I click OK. The canvas extension appears only at the bottom of the photo, not all around as it does in PSE 3. I tried relative. Same result, just new canvas at the bottom. I checked Barbara Brundage's book and it should work the same as it does in PSE 3 but doesn't. I also went to PSE "Learn more about canvas size". It also shows that my canvas extensions should show all around. It also suggests that I should be able to choose a background color, but that option is grayed out for me.
    I know I can just do what I want to do using PSE 3 which I kept on my computer for emergencies just like this, but I would like to solve the problem.
    Can anyone tell me what I'm doing wrong?
    Thanks. Eva

    Eva,
    Works fine in my PSE8 on Win XP. I see the following options (sorry, I only have a German version available):
    The image centers just fine. Are you sure you're seing the entire image (ctrl-0)? What's the image format you're working on (PSD, JPG, 8-Bit, 16-Bit)?
    Beat Gossweiler
    Switzerland

  • Simple Problem with Stacked Canvas, I hope

    Hello all,
    I am become a bit frustrated with what I thought would be a simple form development solution. I am trying to create a form with a stacked canvas that will display about 20 fields that can be scrolled through. This is the detail
    Total of 25 fields
    5 Fields on the content canvas
    20 Fields on the stacked canvas
    I created the first canvas that originally contained all 25 fields. Then I created the stacked canvas and moved the appropriate fields to the stacked canvas. Using the forms builder editor, I positioned my stacked canvas as such so that it would not overlap the last field on the content canvas or visa versa. This is a form being developed for Oracle EBus. Whenever I run the form in the apps, the stacked canvas is not visible. It only becomes visible when the 1st field on the canvas has focus. When the stacked canvas becomes visible, it shows all of the items of the stacked canvas and not just the ones that I included in the viewpoint. Once I tab through the last field of the stacked canvas, it goes back to the first field on the content canvas and the stacked canvas disappears. At this point I am not doing anything complicated, but for whatever reason this just is NOT working. Any advice anyone can provide, I would very much appreciate it. This is VERY frustrating.
    Thank you in advance.

    Step No. 1
    Set the STACKED CANVAS's property VIEWPORT WIDTH AND VIEWPORT HEIGHT
    This property determines what viewable width and height of the stacked canvas at runtime.
    Set SHOW HORIZONTAL SCROLL BAR or SHOW VERTICAL SCROLL BAR or BOTH as YES so that you can scroll down to view all the items in the CANVAS.
    Step NO.2
    In your WHEN-NEW-FORM-INSTANCE trigger, write the code to make the canvas visible
    SHOW_VIEW('stack_canvas_name');

  • Problem playing back canvas on external monitor

    I am using Final cut express HD
    When I play my final sequence (the one shown on the right hand screen of a standard layout, the canvas). All i get from my external TV is the audio, i cant get any picture. However if i then play a clip on the viewer (left hand screen) the external tv plays both the audio and video.
    I'm trying to record to mini DV tape whilst playing through the TV. At the moment all I can record is audio.
    HELP??!!

    Try this:
    - render the sequence (alt-R), and mixdown audio (alt-cmd-R)
    - make sure the canvas zoom is set to Fit to Window
    Piero

  • 'Easy Set-up' Option - Problem with edit canvas/windows - really need help!

    Hello Everyone. . .
    Have a problem that i really need help with, i have tried so many different things to sort this - but with no sucess.
    I usually work in High Definition and i have recently done a small project for someone in DV. When changing to work in DV, i selected the DV setup from the 'Easy Setup' menu. I have now changed back to HD and there are a few things different with Final Cut that i can't shift!
    When i move a clip from the capture bin into the edit window, the clip no longer fills that window like it always used to and there are lines at the top and the bottom of the clip - almost like it is in widescreen.
    Editing like this wasn't too much of a problem, but when i came to compress and do a final render of the whole film - there was the same black lines on the top and bottom of the film.
    I can't figure out how to get the setting back to how they were, and have the clips fill the edit windows and fix the end render/compress.
    Any ideas from anyone on what i am experiancing with all this? And. . . how to fix this problem?
    Any help on all this will be very much appreciated!

    Hello Everyone. . .
    Have a problem that i really need help with, i have tried so many different things to sort this - but with no sucess.
    I usually work in High Definition and i have recently done a small project for someone in DV. When changing to work in DV, i selected the DV setup from the 'Easy Setup' menu. I have now changed back to HD and there are a few things different with Final Cut that i can't shift!
    When i move a clip from the capture bin into the edit window, the clip no longer fills that window like it always used to and there are lines at the top and the bottom of the clip - almost like it is in widescreen.
    Editing like this wasn't too much of a problem, but when i came to compress and do a final render of the whole film - there was the same black lines on the top and bottom of the film.
    I can't figure out how to get the setting back to how they were, and have the clips fill the edit windows and fix the end render/compress.
    Any ideas from anyone on what i am experiancing with all this? And. . . how to fix this problem?
    Any help on all this will be very much appreciated!

  • Very basic problem with a Canvas and JScrollPane

    Ok, I'm making this software, with a lot of graphics, and as usual I start all classes alone to see them work and then I put them together in one nice JFrame with MenuBar and so on... but something strange (to me) happened when I made a JScrollPane with some of the Canvas because I couldn't make them for 1024x768 because of its contents.... so I add this JScrollPane to the TabbedPane as a new tab, so I have in my JFrame: the menubar, the tabbedpane and the canvas with a vertical scrollbar in the right, BUT, when I scroll down, the Canvas starts to scroll over the tabbedpane and the menubar!
    very wierd to me, I know one must try to not use scrollbars, but I really need this to work this way!
    thanks!!
    help!!
    Message was edited by:
    Reinaldo_Matte

    Ok, I'm making this software, with a lot of graphics,
    and as usual I start all classes alone to see them
    work and then I put them together in one nice JFrame
    with MenuBar and so on... but something strange (to
    me) happened when I made a JScrollPane with some of
    the Canvas because I couldn't make them for 1024x768
    because of its contents.... so I add this JScrollPane
    to the TabbedPane as a new tab, so I have in my
    JFrame: the menubar, the tabbedpane and the canvas
    with a vertical scrollbar in the right, BUT, when I
    scroll down, the Canvas starts to scroll over the
    tabbedpane and the menubar!
    very wierd to me, I know one must try to not use
    scrollbars, but I really need this to work this way!
    thanks!!
    help!!Don't mix heavyweight(AWT) components such as Canvas, with lightweight (Swing) components.
    See:
    http://java.sun.com/products/jfc/tsc/articles/mixing/
    and
    http://java.sun.com/products/jfc/tsc/articles/painting/index.html

  • Go_item problem on stacked canvas

    Hello.
    I use stacked canvas in my form. On that canvas i have a button. User use this button to close stacked canvas. I use:
    hide_view('canvas_name');
    go_item('block.item_name');
    It seems as go_item is not working. Cursor only moves to the block and to the first item in that block.
    Why doesn't cursor move to item i choose?
    Thanks.

    Hello.
    It's still not working.
    And i'm not hidding first canvas.
    It is the main canvas. And on that canvas i press button to open small stacked canvas. And on that stacked canvas there is a button to close this canvas and to move cursor to one item on the main canvas. And that is not working. Cursor moves to the first block item on main canvas.

  • Problem with rotated canvas in Illustrator

    I'm having a strange problem here. Friend of mine sent me a screen grab of her Illustrator workspace - it seems the artboard got rotated somehow. And she can't get it to straighten back... Neither can I, or any of our friends of designing persuasion... I wasn't even aware you can do that in Illustrator. Anyway, the question is, how do you undo this? All the new files start already rotated, too.
    Screen grab follows:
    http://img27.imageshack.us/img27/1882/ctrln2.jpg
    Any help would be greatly appreciated.

    See Constrain Angle inside the Illustrator Preferences.

  • Problem With a Canvas Pane.

    Hello.
    I need implement a Print Preview for my application, and I use a Canvas Pane for perform the custom painting.
    Everything works very well, with the exception that the canvas, is drawing outside of the bounds of the scrool panel who contains it. My question is, How I maintain my canvas, within the pane who contains it?
    My code is:
         public static void myPreview() {
              createPreview(); // Here is where I create the canvas ans perform custom painting.
              // For centering the canvas.
              JPanel myPane = new JPanel(new FlowLayout());
              myPane.setBackground(Color.GRAY);
              myPane.add(new JScrollPane(myCanvas));
              previewPane.add(myPane);
              previewPane.setVisible(true);
         }Best Regards
    Manuel
    Mensaje editado por:
    MacManolin
    Mensaje editado por:
    MacManolin

    I tried that but then it slows down all actions.For example,clicking and dragging actions become very slow.Even opening a JDialog takes a long time.
    RS

  • Problem with AreaChart canvas.addDataChild()

    Hello.
    canvas.addDataChild(hint,_x,_y) works incorrectly. I don't know why).
    I want to when you click it added a hint. There is no reaction after click. I use DateTimeAxis.
    If I set a direct values (canvas.addDataChild (hint, 50,50)), the graph is redrawn and added point scale. Mistification).
    Source:
    <mx:AreaChart ... itemClick="handleChange(event)" >
    <mx:annotationElements>
           <mx:CartesianDataCanvas id="canvas" includeInRanges="true"/>
    </mx:annotationElements>
    </mx:AreaChart>
    <mx:Script>
    <![CDATA[
    private var date:String = new String();
    private var actions:Number = new Number();
    private function handleChange(e:ChartItemEvent):void
         var hint:String = e.hitData.item.hint;
         date = e.hitData.item.date;
         actions = e.hitData.item.actions;
         addLabelsToColumn(hint,date,actions);
    private function addLabelsToColumn(_hint:String,_x:String, _y:Number):void
         canvas.clear();
         hint = new Label();
         hint.setStyle("fontWeight", "bold");
         hint.setStyle("color", "0x660000");
         hint.text = _hint;
         canvas.addDataChild(hint,_x,_y);
    </mx:Script>
    Thanks in advance.

    Upd. I added a few lines for the trace.
    canvas.addDataChild(hint,_x,_y);
    var lab= canvas.getChildAt(canvas.numChildren -1);
    trace(lab.text);
    (in console: 9 actions)
    The hint is added but its coords are equal: 0,0. And hint is not displayed.

Maybe you are looking for