Repainting specific areas of the canvas

Hello, ive been trying all day to search for good examples on how to repaint specific areas of the screen. I know there are som atributes to the repaint() method, but im trying to repaint an area of 20x20 px on the left corner of the screen with a thread. Can someone pleeeeeeez guide me maybe to how to accomplish this. Thanks in advance.

Well you would call repaint(0,0,20,20), instead of just repaint().
But more importantly is that you set up your paint() method so that it can recognize that you're only repainting part of the screen. Something like:
public void paint(Graphics g) {
  // you use the Graphics.getClip????() methods to find out the clipping region for this paint request:
  int clipX = g.getClipX();
  int clipY = g.getClipY();
  int clipW = g.getClipWidth();
  int clipH = g.getClipHeight();
  // now, if you called repaint(0,0,20,20) then clipX=0, clipY=0, clipW=20 and clipH=20
  // so you can now use these variables to set up code that only repaints the appropiate part of the screen
}Even if you don't set up the paint() method this way, it will still work, because anything you paint outside the clipping region won't show up on screen. But I imagine that you want to repaint just part of the screen because you need the painting to be faster, so unless you take the clipping region into account, all the paint code will be executed and you won't gain too much speed by only repainting part of the screen.
shmoove

Similar Messages

  • How do I make a button work in a specific area on the canvas only?

    I'm making a Minecraft-Terraria style mining game, and I have a pickaxe tool. I want to make it so it can only be triggered over a certain area or position. How would I do this?
    PS. If it uses coordinates, how would I find those?

    which one?
    there are 2 different suggestions.  using coordinates is easiest to use but only works well if the area is rectangular.

  • When using the "Fill & Sign PDF" feature, is there a way to stretch to size the text box, for a specific area on the page...instead of it going on in one straight long line...?

    When using the "Fill & Sign PDF" feature, is there a way to stretch to size the text box on a specific area of the page...instead of the text box going on in one straight long line....? I'm not seeing there's an option or ability to do so, just wanting to confirm.

    Improving the handling of multiple line text fields is in our plans, but for now, you will have to add manual carriage returns (Enter).
    Thanks,
    Josh

  • OIM11gR2 - Is it possible to create a direct link to a specific area in the oim plattform?

    hi,
    is it possible to create a direct link to specific area in the oim self service plattform? for example a link to the users account list, or a link to a specific resource account?
    br,
    max

    Hi,
    Yes, Its very much easy in R2 as compared to R1. You can use following link to achieve your requirement:
    http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/uicust.htm#BABIDJAB
    ~J

  • I have created a form. I just want a specific area of the form to be printed to a specific printer in Windows 7. Is there a way to do this?

    There are 2 printers on the system.  I want to create a Print Button, so that if the user clicks it, a desired area prints on a specific printer.
    Thanks for your consideration.

    No, unfortunatley there is not.  For a full listing of Unicode supported characters please refer to section Unicode Character Support at FormsCentral Help | Formula syntax for built-in functions
    -Jeff Canepa

  • Reload servlet to a specific area on the page

    Hi, gang
    I have a servlet that refreshes at user defined rate and displays a bunch of different things on the page.
    I would like to the user to be able to click on a link that would take him to (for instance) a middle of the page, and when the servlet refreshes again the user will still be in the same area, and not at the top of the page.
    I am using meta-refresh to refresh the servlet, and I know I have to use the "A HREF" and "A NAME" commands, but I am unable to do it dynamically.
    The simplified segments of my code look like this.
    protected void service(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    response.setContentType("text/html");
    java.io.PrintWriter out = response.getWriter();
    int time = (new Integer(request.getParameter(REFRESH_RATE))).intValue();
    out.println("<html><head>");
    out.println("<meta http-equiv='refresh' content='"+time+";URL=MyServlet?"+REFRESH_RATE+"="+time+"' frame='self'>");
    out.println("</head><body>");
    out.println("<A HREF='#MIDDLE'>Jump to Middle</a>");
    out.println("<A NAME=TOP>");
    out.println("<FORM NAME=setTime METHOD=GET ACTION="MyServlet?"+REFRESH_RATE+"="+time+"'>");
    out.println("<input type=textfield name='"+REFRESH_RATE+"' value='"+time+"'>");
    out.println("<input type=submit value='Refresh after this many seconds'>");
    out.println("</form>");
    out.println("<P>Blah blah blah<P>");
    out.println("Back to Top");
    out.println("<A NAME=MIDDLE>");
    out.println("<P><P>More Blah Blah Blah<P><P>");
    out.println("</body>");
    out.println("</html>");
    out.close();
    Thank you in advance,
    Val.

    Try this... modify your initial part of the code as below
    response.setContentType("text/html");
    java.io.PrintWriter out = response.getWriter();
    String time = request.getParameter(REFRESH_RATE);
    String area = request.getParameter("area");
    out.println("<html><head>");
    out.println("<meta http-equiv='refresh' content='"
    +time
    +";URL=MyServlet?REFRESH_RATE="
    +time
    + "#"
    + area
    +"' frame='self'>");
    out.println("</head><body>"); and the part where you hav links as shown below...
    out.println("<A HREF='MyServlet?"
    +REFRESH_RATE
    +"="
    +time
    +"#MIDDLE'>Jump to Middle</a>");
    out.println("<A NAME=TOP>");
    out.println("<FORM NAME=setTime METHOD=GET ACTION='MyServlet?"+REFRESH_RATE
    +"="
    +time
    +"#MIDDLE'>");
    out.println("<input type=textfield name='"+REFRESH_RATE+"' value='"+time+"'>");
    out.println("<input type=submit value='Refresh after this many seconds'>");
    out.println("</form>");Just a giude line... Hope this may help you.

  • Tooltip at a specific place of the form.

    Dear D2k-Gurus
    Is it possible to show the tooltip at a specific area of the canvas? Generally it shows at the bellow of the item, which can cover some other field. So, if I can specify some area in the canvas where all the tooltip will be displayed, will be helpful.
    IF possible please get me on the way for 6i & 10g.
    Thanks
    Ananda

    Of course if you need it... you can do it programmatically without the use of 'native' tooltip capability....
    Use the SET_ITEM_PROPERTY built-in procedure and the following properties:
    1) X_POS
    2) Y_POS
    This item (text item) should be invisible and will become visible as the mouse enters into another text item(text item of your application)... in order to mimic the tooltip functionality.....
    Regards,
    Simon

  • How to darken a specific area in iPhoto for Mac?

    Hi. I am trying to darken a specific area (not the entire picture) in iPhoto on my Mac. How should I do that? Thanks!

    Nitin, the link you provided is a bit better than nothing, but it refers to the AVPlayer object in applications, rather than iOS delivered data.  In our experience currentTime is a settable property for the native video player in mobile Safari, using a normal progressive uploaded stream, as the documentation shows:
    http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLMediaEle mentClassReference/HTMLMediaElement/HTMLMediaElement.html
    The question is "Are there browser based methods that seek AMS delivered streams more quickly or with better accuracy?" 
    Everyone is aware that mobile is exploding.  On some of our videocentric apps the share for iOS is approaching 20%.  PM Kevin Towes, what are you doing to accomodate this need???

  • How to mask out specific area in a specific time?

    Hi,
    I want to make a mask on a specific area of the footage in a specific time. I drew the mask and all the frame went black,so I clicked on Mask-> invert and only the specific area I masked went black,which is exactly what I wanted.
    Now I want to make it happen in a specific time, not on all timeline, but I can't find a way to do it. I thought about lowering down the mask opacity to 0% and a frame later bringing it to 100%, but if I lower down the opacity of the mask, it lowers down the opacity of the whole frame, same as
    lowering down the opacity of the frame by intention, which seems weird, cause I did inverted the mask, and as I understand it, it should affect the opacity of the mask and not the whole frame...
    any ideas...?
    I'm using CS4.

    Put a copy of the footage on the timelime below the one you masked. Use opacity like you doing and it will reveal the track below.

  • Hyperlink from MY website to a specific area on EXTERNAL website

    i was hoping to use an HTML snippet to accomplish this on iWeb. i've spent several hours on google, and this forum too but found NOBODY addressing this:
    i need to create a hyperlink from MY website to an external url. the external page needs to open at a very specific area on the page. i see that this is done on hand-coded websites.
    most iWeb discussions were about hyperlinking to lower down on the same page or within the same website where 'anchors' can be used. obviously that can't be done when linking to an external website.

    Cyclosaurus i appreciate your quick advice.
    the external site i am targeting is:
    http://www.tcg.org/international/events/festivals.cfm
    scrolling down the page, i want to land on this sub-headline beginning at "Rome, Italy"
    i.e.
    Rome, Italy
    IL VATICANO CADE: The English title of this play by American writer Frank J. Avella is Vatican Falls, but the fi............
    if that site is coded so that it can work, i would so greatly appreciate it if you can indicate the actual HTML to put inside the snippet --- i'm an artist, and the rigid 'science' of code is always a challenge. thanks again

  • Cant find the Canvas

    Hey guys,
    Forgive me for sounding like a noob but I cant seem to find the canvas. I xed out of it one time before canceling out of my project and now whenever i bring the project back up it doesnt show a canvas. I play the sequence and all I can hear is the audio. I can get editor boxes for individual clips but not the canvas that displays how my time line looks. Any input you guys have would be helpful. Thanks in advance!

    Hey. I have tried this and the canvas still does not open. I have exited the program and then reopened the sequence so the timeline is there and i can play in it however the canvas refuses to appear. On the drop down box where it says all the boxes that are present the canvas is checked but i cant seem to find out where it has went. Once again any response is helpful and thanks again.

  • Pinning an object to a specific area

    Hey Muse Team,
    I was wondering if I could pin an object to a specific area of the website. In my case I have a defined area for the website and would like to pin an object so as to if someone opens the page in a smaller sized browser than the page itself the object is still visible, but if the have a much larger browser than the page itself, the image stays inside the page and not surpass it.
    Thank you,
    Carlos

    Do you want something like in the first movie of this post? http://blog.lilybiri.com/reset-effects
    Explanation of setting a motion path in this old post: http://blog.lilybiri.com/editing-motion-paths-and-reusing-customized-e
    You can also edit the XML that defines a motion effect, but know that those movements are always relative to the original place of the object.

  • I recently downloaded a 10.6.8 update and a game program has now been reduced in size.  It's specifications are set for full screen, but it is about 1/4 of the size.  Any ideas how to fix?

    I recently downloaded a 10.6.8 update and a game program has now been reduced in size.  It's specifications are set for full screen, but it is about 1/4 of the size.  Any ideas how to fix?

    Hi, I have got the same problem but all is 1/4 the size have you fixed it?

  • Can´t import files or iMovie projects, and are unable to view on the canvas

    I have just gotten the Final Cut Express software, but i have unfortunately run into some problems:
    The biggest problem I am having is all my footage no longer works. When I go to import it into FCE, it gives me the error:
    "File Error: 1 file(s) recognized, 0 access denied, 1 unknown."
    This is also true for my iMovie projects: it gives me an error, and a list of the problems.
    I can view the video in the viewer, but when I export it to the timeline and try to view it via the canvas (to see if it matches the music), it says that the video is "unrendered". Is there another video format I should be using that would enable me to view this footage with the imported music in the canvas? Or must I re-render every time I make a change (which I am sure I shouldn't have to!)? I'm very new to FCE so I do not understand it fully.
    Thank you!
    Morten

    These are the properties of the files of twho of the camras i want to use to capture footage.
    The properties of the browser are here:
    Thanks a lot!!!
    Morten

  • Since downloading IOS8, when I log in to certain websites that are password specific and check the stay logged in box, when I return to the home screen then back to the website I have to log in again which is very frustrating

    Since downloading IOS8 when I log in to certain websites that are password specific, despite checking the keep logged in box, when I go back to home screen then back to website, I have been logged out and have to log back in-very frustrating-any ideas please?

    To see registered devices in My account:
    1) Go to Account > My Account
    2) Scroll down, and ensure that that you first have an active subscrption (if you do not, you are not logged in to you Ovi Music unlimited account)
    3) Below Unlimited downloads subscription box, you should have a Registered devices box.
    Cheers,
    elin
    http://www.nokia.com/support
    Attachments:
    Music account.jpg ‏13 KB
    registered devices.jpg ‏49 KB

Maybe you are looking for

  • XPe supported?

    I have successfully installed AIR on XPe and everything seems ok, but it isn't on the supported list under system requirements and past posts that I have seen have gone unanswered as far as whether or not Adobe supports XPe, or if it does not because

  • How to find the number of decimals in a given value

    Hi all, Can u please help me in solving the problem, i have a value called 5987.45 and decimal places are 45 that is 2 numbers 2) 765.987 number of digits in decimals are 3. 3) 67543.1 number of digits in decimals are 1. for this i need a coding than

  • PORTAL screen got down

    hi all , i am working for ess mss portal , all of a suddden portal screen got down with unwanted sizing , kindly suggest me .....how to get default sizing ...any idea ?

  • Turning On/Off Frame Decorations

    I have a problem - where I need to turn on/off the frame decorations on Internal frames (borderless frames) - using possibly a hot key ? Is there a way to do this ?

  • LSMW-Direct Method

    Hi, Can any body send LSMW step by step process for direct method to this ID [email protected] Thanks in Advance regards, SaravanaKumar Edited by: saravana kumar on Mar 6, 2008 8:15 AM