Use the JPanel's graphics to draw something

I get a Jpanel's Graphcis g and use g to paint something,
g.drawRect(......),
the rectangle show on the JPanel , but it was clear when I resize the JPanel
or switch between applications. I think I can override the paintComponent()
method to let the image keep on it. I want to know: Is there some component
I can get its' graphics like JPanel and whatever I painted on use it can not
be clear?
BTW, I want to try some small game programming, anyone know some BEAutiful
component package?

the rectangle show on the JPanel , but it was clear when I resize the JPanelThe reason your painting clears when you resize your window (or min/maximize) is because you will need to
tell your program to repaint the scene after anything happens to the window. The best thing to do is create
a thread to constantly call your paint routines so that even when the painting clears, it is repainted
immediately.
Is there some component I can get its' graphics like JPanel and whatever I painted on use it can not
be clear?I'm afraid not, all components behave this way. You don't have to worry if you use a thread for painting
(a thread for painting is infact one of several standards for rendering). Here is some code:
public void startPainting(){
   Thread paintTimer = new Thread(
      new Runnable(){
         public void run(){
            try{
                Thread.sleep(delay);
            }catch(InterruptedException e) {break;}
            repaint();
   paintTimer.start();
}[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to Use the Scalable Vector Graphics API (JSR 226)

    im doin an Application with Maps and locations...
    i need 2 use the Scalable Vector Graphics API (JSR 226)..
    can anyone plz guide me to get it and use the API.. Im using netBeans 5.0
    it will be great help :)
    Regards
    Muhammedh aka MNM

    Thanks Rohan :)
    i did read some stuff from the URLs u gav me :)
    and I manage 2 solve the prob i had :) (Thank God)
    1. downloaded latest version of netBeans (5.5)
    2. Java SDK 6 :D...
    3. the key thing: Wireless tool kit for CLDC 2.5 Beta
    now when u create a project make sure u set the above given tool kit :)
    when u set it.. u get an option 2 select the APIs frm a List.. Check on SVG API :)...
    Other APIs Such as,
    * wireless Messaging API
    * Location API
    and many more...
    Cheers 2 Every1 :)
    regards
    Muhammedh

  • HT4623 I got an iPhone5 with apple care and it got stolen and I got it back but the person who took It drawed something on the back would that void my apple care?

    I got an iPhone5 with apple care and it got stolen and I got it back but the person who took It drawed something on the back would that void my apple care?

    probably not.

  • I have an IPhone 6 I'm going on a cruise and I won't be making calls or using data I'm just wanting to use the camera ...is there something I can do to to turn these off?

    I have an IPhone 6 I'm going on a cruise and I won't be making calls or using data I'm just wanting to use the camera ...is there something I can do to to turn these off?

    All you need to do is turn on Airplane Mode. It's in the settings, or the easier way is to swipe up from the bottom to open the Control Center and turn on Airplane Mode there. It's the first button at the top, with the airplane icon.
    When you turn on Airplane Mode all of your data is shut off. You can optionally turn on just Bluetooth and Wifi if you want; for example, if you wanted to use the cruise ship wifi without turning on your phone radio, or if you wanted to use a Bluetooth speaker or keyboard. But if you don't need all that just turn on Airplane Mode and leave Bluetooth and Wifi off.

  • Can you use the Sapphire PCIE Graphics Card on the Xeon Power Macs ?

    Hi,
    does anyone know if you can use the Sapphire 11168-02-20R HD 5670 512MB GDDR5 PCIE Graphics Card on the xeon intel power macs  ?
    I did see on on another discusion that the ATI Radeon cards were all good, but I wanted to check.
    Cheers K

    If would have to be flashed to even have the possibility of working at all in a mac.
    I suggest you start with the following MacRumors thread if you are considering such a thing:
    The Golden Guide to Flashing Graphic Cards

  • How can I use the SDK(cs5 or cs6) draw a dot matrix bimap

    how can I draw a dot matrix bitmap?
    I want to use the SDK to draw a dot matrix bimap,like, Please someone help?Thanks a lot!

    I've moved your question to the InDesign SDK forum.

  • "Offline material is present in this export and will be encoded using the offline media graphic"

    This comes up every so often with my renders.  I have a 28:30 minute project that is 100% complete.  All the files are present locally, and nothing shows as offline or missing.  I've gone through the final sequence frame by frame and NOTHING is offline or missing.  But when I want to send it out to export, I get the message above in the title.
    What's strage is if I ignore it, then sometimes the final render WILL have display the offline graphic even though it didn't display as such in the Premiere timeline.
    Often, restarting Premiere and reopening the project irons that glitch out just fine, but I have one particular project that seems to do it every time. I've tried the "import into a new project" trick, but with no luck.
    Clueless in Exportville

    Hey Guys,
    Anybody find a solution to this yet? I am working with Premiere Pro cs5, working with r3d footage, and am having the "offline material is present" error pop up when I try to export using adobe media encoder. Prior to that error box popping up, there is another dialogue box that says that premiere has detected that there is an update to media encoder, I am running media encoder 5.01 and tried to update it but it tells me all files are up to date.
    Anyways back to the problem, there is only one shot that is affected and is rendered with the offline media image( this clip also happens to be a different colour(green or teal) than the other clips in my sequence(which are blue or greyish), not sure if this is an indication of anything. I reimported the clip, and re did the edits and then exported just that new small section to see if the error would happen again,this time however, when I did the export, instead of  "queue", I just hit "export" ,and the export happened without media encoder actually opening. The file came out fine,even though I had the offline media present pop up, the video was all good. I know I changed a couple of variables in that troubleshooting, so now I am trying the entire sequence with the "export" button instead of "queue" button in the media encoder pop up box, hopefully that will help. The only downside is that it seams like it takes way longer to export this way than in the queue.
    I'll report back to let you know if that helps and if I can reproduce the error with the "queue" button.
    EDIT
    Both exports worked, so it must have been due to the re importing and re editing of the clips, however I still get the error message "offline material is present..." I guess I'll see what happens next time I do an export. Cross my fingers.

  • How can I open multiple "non-merged" firefox windows? With IE, I would use the "-nomerge" option. Is there something similar for Firefox?

    I use a website in my daily work activities that I need to have multiple sessions of the website open at any given time. Natively, I cannot have multiple sessions open in a single browser (separated tabs or separate windows) without one session taking over the other. Internet Explorer has a command line option (-nomerge) that will allow me to accomplish what I need. The target line of the IE shortcut properties would look like this:
    "C:\Program Files\Internet Explorer\iexplore.exe" -nomerge
    Is there a similar solution for Firefox?
    I am running Windows 7, IE11 and Firefox 26
    Thank you in advance,
    Robert

    Hello rpvincent, try
    * firefox.exe -new-window <url>
    (the url is without < >)
    see also : http://kb.mozillazine.org/Command_line_arguments
    thank you

  • Has anyone used the T410S swictchable graphics card with games?

    Anyone?
    There had been some reports of over heating with this unit
    I was looking to purchase one
    Thx

    order my new MP with the 8800 card day after announced (over 4 weeks ago), still waiting.
    Some say they have a shipping sate of next week. Other have rumours of the container ship with all the cards being stuck in port in Shanghai because of bad weather.

  • I have Photoshop elements 9, when using the cloning tool. It grabs something else and shoots it across photo ?

    ?

    Did it work in previous sessions? If so, suggest that you reset the tool.
    To do that, there should be a little arrow on the tool's option bar, top left. Click on it, then reset.

  • Using the display on something else than a computer

    Is there any way to use the 20-inch Cinema Display on something else than a computer? Such as using it as an external monitor for my HD camera? I'm shooting a short film, and I was wondering if such a display could serve as a video assist.
    Thanks.

    Apple displays aren't much use for any other purpose besides computer monitors. You can use add-on hardware to make them more flexible, but the add-on is so expensive you could almost buy another monitor.
    http://www.gefen.com/kvm/product.jsp?prod_id=4173

  • Accessing Business Graphics using the WebDynpro API

    I would like to access Business Graphics created with IGS using the WebDynpro Business Graphics API.
    I have no problem displaying the graphic in WebDynpro UI, but i have no idea how to access the binary data of the graphic to work with it outside of WebDynpro UI (in fact i want to embed it into a PDF form).
    Is there any possibility to do this using the WebDynpro API?
    I would appreciate your help!
    Regards,
    Christoph

    Thanks, but this al clear to me. I am able to display business graphics on web without problem (I have dynamic Business Graphic in my WebDynpro User Interface).
    The Problem is, that i want to make further processing with the graphic. Therefore i need to access the binary data of the graphic.
    Do you know if there is any possibility to get the binary data of the bmp - image generated by IGS into a byte array?

  • Drawing connected direct lines using the mouse

    Hallo all,
    What I want to do is, to draw connected lines on a graph using just the mouse...
    First I will define min and max values for (x,y) -graph range- using the property node...
    Then using the mouse I want to draw frequency ramps over time like in FMCW modulation... For example it will just draw the ramps by connecting several points marked by my mouse clicks on the graph. Moreover I need the (x,y) values that I click on the graph...
    Thanks,
    Ogulcan

    Hmm, this does not sound very clear. Do you want the cursor to follow the mouse even when the mouse button is up. If you have multiple cursors, which one should be followed? What should happen if you move the mouse outside the window? How do you release the cursor from the mouse when done?
    I think it is much easier if you just drag the cursors via the normal mechanism. It is most direct and intuitive. See attached LabVIEW 7.1 example. For another example of moving points, have a look at this older thread..Message Edited by altenbach on 06-28-2005 10:13 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Cursorcontrol.vi ‏45 KB

  • ASA 5505 8.4. How to configure the switch to the backup channel to the primary with a delay (ex., 5 min) using the SLA?

    I have ASA 5505 8.4.  How to configure the switch to the backup channel to the primary with a delay (for example 5 min.) using the SLA monitor?
    Or as something else to implement it?
    My configuration for SLA monitor:
    sla monitor 123
     type echo protocol ipIcmpEcho IP_GATEWAY_MAIN interface outside_cifra
     num-packets 3
     timeout 3000
     frequency 10
    sla monitor schedule 123 life forever start-time now
    track 1 rtr 123 reachability

    Hey cadet alain,
    thank you for your answer :-)
    I have deleted all such attempts not working, so a packet-trace will be not very useful conent...
    Here is the LogLine when i try to browse port 80 from outside (80.xxx.xxx.180:80) without VPN connection:
    3
    Nov 21 2011
    18:29:56
    77.xxx.xxx.99
    59068
    80.xxx.xxx.180
    80
    TCP access denied by ACL from 77.xxx.xxx.99/59068 to outside:80.xxx.xxx.180/80
    The attached file is only the show running-config
    Now i can with my AnyConnect Clients, too, but after connection is up, my vpnclients can't surf the web any longer because anyconnect serves as default route on 0.0.0.0 ... that's bad, too
    Actually the AnyConnect and Nat/ACL Problem are my last two open Problems until i setup the second ASA on the right ;-)
    Regards.
    Chris

  • Every time i try to play draw something i keep getting knocked off. I also have a game that is stuck and i can't get rid of it or keep playing.

    I am continually knocked off of draw something while trying to play. I also have a game that when they sent it back to me, it was frozen at the point where it shows them guessing my drawing. It lets me watch my drawing but shows the wrong letters available and the wrong word in the spaces. The right word was wedgie but the word guessed is candy and the remaining available letters are a,d,q,v,y,y,z.

    go to the appstore and make sure that there are no new updates for Drawsomething.
    If that is fine, double tap the home button and remove every app you see in that area. (hold your finger on the recent apps area that just came up and then remove every app from that area.
    Now try to go to DrawSomething.
    If that didn't do it:
    Now go to where you have draw something and remove it from your ipad (hold down the icon until it all of them start to wiggle and hit the X on Draw something.
    Now go back to the App Store and redownload draw something.
    See if that doesn't help.

Maybe you are looking for