Re: How to go about a problem with JFrame

first before anything, I suggest you read the Sun Java Swing graphics and 2D graphics tutorials. They'll give you the answers you need including using JPanels, overriding the paintComponent method, etc...
Next, try to separate your logic from your graphics. It will make updating and debugging a whole lot easier.
Good luck.

This is the approach I would (and did) take:
Extend JPanel
Have an ArrayList of Shape or any class implementing Shape
Override paintComponent and iterate over the ArrayList to draw the shapes
AddMouseListener which iterates over the ArrayList to detect whether any element contains() MouseEvent#getPoint()
If one is found, take action accordingly. As per your OP, you probably want to perform two different actions alternately, could use a boolean flag for that.
If (as was the case for me) the shapes may overlap, iterate upwards in the paintComponent and downwards in the MouseListener so that the first shape detected is the last drawn (the topmost). Break out of the iteration if you want only one shape to be detected.
db

Similar Messages

  • Hello Apple? How do i fixed my problem with my ipad apps every time i open that apps it takes 10min. to play the games ant its getting LOST MODE and the ipad system is crashing

    How do i fixed my problem with my ipad apps every time i open that apps it takes 10min. to play the games ant its getting LOST MODE and the ipad system is crashing

    We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple.
    Have you tried closing all apps via the iPad's multitasking bar and then doing a soft-reset and seeing that helps ? To close all apps :
    iOS 7: double-click the home button to open the taskbar, and then swipe or drag each app's screen from there up and off the top of the screen to close it, and click the home button to close the taskbar.
    iOS 6 and below : from the home screen (i.e. not with any app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of each app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    Soft-reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • How to go about multiple inclination with different data selection in Delta

    We have to copy large amount of data ( more than 42lak of recodes) selectivly from on ODS to other ODS. in delata load ( BW 3.5 enverioment)
    I thought of loading data in slices through delta loading with selection condition.
    step 1> Do The initialization with selection condition as for calyear =2001 ( Init without data transfer )
    step 2> Take the delta load .. it will take all delta record with same selection
    step 3> Now I want to do Initialization with selection condition as for calyear =2002
    step 4> take the delta now it will take delta for year 2001 and 2002 both Right ?
    Here what problem I am facing.. while doing 2nd time initialization it prompt me to delete the last  initialization request form scheduler menu.
    if i delete the last request .. will it take the delta  for previous initialization selection  and new initialization selection. ?
    Please advice how to go about multiple inclination with different data selection in delta loading.
    Looking forward your reply.

    Hi,
    step 1> Do The initialization with selection condition as for calyear =2001 ( Init without data transfer )
    step 2> Take the delta load .. it will take all delta record with same selection
    step 3> Now I want to do Initialization with selection condition as for calyear =2002
    step 4> take the delta now it will take delta for year 2001 and 2002 both Right ?
    You are correct with this scenario normally. The message you mentioned normally comes up when you open a infopackage and don't change the selection first or in case you have overlapping selections with an already done init.
    regards
    Siggi

  • HT5137 I made a purchase with my debit card on The Simpson Tapped out game, And now my game won't open. It just kicks me out every time I click on it. How do I fix this problem with out deleting my app?

    I made a purchase with my debit card on The Simpson Tapped out game, And now my game won't open. It just kicks me out every time I click on it. How do I fix this problem with out deleting my app?

    Personally, I would never use a debit card online, for security reasons.  If your card gets hacked its your money that is stolen.  At least with a credit card it is the card providers money that is stolen.
    Anyway,  I would delete the app and re-install.  If you paid for the app in the first place you will be able to re-install free of charge.  Also, the app should allow the in-app purchase to happen again as it should recognise that you have already purchased it previously.
    Finally, it might be that the 3G doesnt have as much ram as more recent models of iphone and you may have applications running in the background that are preventing the app to function with the in-app purchase unless you shut down any apps eating all you memory that are running in the background.  Shut-down these apps (and the simpson tap out app) by exiting to your home screen and double-tapping the home button to show what apps are running in the background.  press and hold any of the open apps until it starts shaking.  close all the apps down.  exit then re-launch the app.
    good luck.

  • We have version 10.5.8 photoshop CS3 for Mac. How do we fix a problem with photoshop not resizing dpi? For example we resized a 72 dpi image to 200 dpi, when we do a pdf analysis it read as 344 dpi.

    We have version 10.5.8 photoshop CS3 for Mac. How do we fix a problem with photoshop not resizing dpi? For example we resized a 72 dpi image to 200 dpi, when we do a pdf analysis it read as 344 dpi.

    Sounds like it's a problem with the Acrobat settings. Did you set them to the same resolution?

  • HT4623 How can i solve installation problem with iOS 6.

    How can i solve installation problem with iOS 6. I've tried to install it on my iPhone 4 but nothing turned out. Thanks in advance!!!!

    can you connect your device to Tiunes and check to see if there are any files in
    OSX: ~/Library/Logs/Crashreporter/Mobiledevice/<Devicename>/
    Windows: %appdata%\Apple Computer\Logs\Crashreporter\MobileDevice\<Devicename>
    specifically named OTA......
      Also for the failed itunes restore please attach the contents of the latest log in
    OSX:   ~/Library/Logs/<iphone or ipod or ipad> updater logs
    Windows: C:/User/ Appdata/Roaming/iTunes/<iphone or ipod or ipad> updater logs

  • HT1338 what about the problems with the trojan virus is that a problem for my mac as well?

    What about the problems with the Trojan virus will this be a problem also for me using Mac

    What Trojan?
    If you're referring to the DNS Changer Trojan, it's highly unlikely you're affected. The actual distribution of the trojan was stopped several years ago and the perpertrators jailed.
    The FBI has been maintaining the servers used by the trojan for the last 5 years in order to give affected systems time to be purged. They will finally shut them down on Monday.
    Ensure that your router and the Mac's network settings are set for the DNS addresses of your ISP, or if you're not sure what they should be, change them to Open DNS using the IP addresses;
    208.67.222.222
    208.67.220.220

  • How do I resolve a problem with the Pompiere font download?

    How do I resolve a problem with the Pompiere font download for Word on a MacPro?

    never mind... download must have been corrupt. re-downloading it seems to have fixed the problem.

  • Lately and i dont know why i see a pop up about a problem with script. can some1 help me?

    there is a pop up about a problem with script. it ask me end and contuniue the script. i didnt have that problem before. plz help me it gets really irritating. it asks a lot

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • Problem with JFrame's dispose();

    Hello everyone,
    I'm having a problem with JFrame's dispose() method. In my program I have 2 classes which go into full screen. On each screen there is a button to switch to the other screen. The first time I push the button on both of them the other screen closes, which is what I want. However, if I push the same button more than twice - like by going from Screen1 to Screen2 and Screen2 to Screen1 and then Screen1 to Screen2 - I get 2 screens. If I keep doing that I eventually get 10+ screens up, which is bad. How do I prevent that?

    There's a lot of code, so I'll just post up the part that does it.
    backButton.addActionListener(new ActionListener()
                  public void actionPerformed(ActionEvent e)
                      soundManagerM.close();
                        new MenuScreen().setVisible(true);
                        dispose();
             });I don't think it opens up 2 at once, because it would play multiple music right?

  • HT1918 How do I clear a message about a problem with a previous purchase when my order history shows no purchases?

    I am trying to download an app.  I get a message that says there is a problem with a previous purchase.  I log into the store and there is no history.  I updated my address but continue to get the same message and cannot download my desired app. Any suggestions please?

    If you get a pop-up message asking to update Firefox or plugins or scanning for malware then such a message is likely a scam and you should never respond to such an alert to avoid getting infected with malware.
    *Only update Firefox via "Help > About" or by downloading and installing Firefox from the Mozilla server and never via a pop-up or link on a web page.
    *Plugins should only be updated via the plugin itself or by visiting the home page of the plugin.
    Do a malware check with several malware scanning programs on the Windows computer.
    Please scan with all programs because each program detects different malware.
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender:<br>http://windows.microsoft.com/en-us/windows/using-defender
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • How do I know if I have a wifi problem with my new iPad 3 (it seems very slow) and how does one address the problem with apple if there is one?

    I just read about the possible issue that some folks are having with their new iPad wifi (my seemed to be running very slowly but I thought that perhaps it was just me overreacting).  How do I know if I have a definite problem, and what is my recourse?  Do I need to take it to an Apple store for testing?  I have apple care which I assume addresses stuff like this.  Thoughts?  Thx so much.

    Your iPad is covered by the normal warranty for one year. If you have AppleCare that extends the coverage. If you feel there is a problem with your wifi reception visit an Apple store with your iPad for a consultation. Be sure to make an appointment before you go.

  • How do i solve the problem with repeated renew lease requests

    How can i solve the problem of repeated renew lease requests?

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430http://support.apple.com/kb/ht1430
    You don't say what you are doing or trying to do. See #5 below.
    Some things to try first:
    1. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    2. Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    3. Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netwhttp://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    4. Go into your router security settings and change from WEP to WPA with AES.
    5.  Renew IP Address: (especially if you are drooping internet connection)
        •    Launch Settings app
        •    Tap on Wi-Fi
        •    Tap on the blue arrow of the Wi-Fi network that you connect to from the list
        •    In the window that opens, tap on the Renew Lease button
    6. Potential Quick Fixes When Your iPad Won’t Connect to Your Wifi Network
    http://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-wonhttp://ipadinsight.com/ipad-tips-tricks/potential-quick-fixes-when-your-ipad-won t-connect-to-your-wifi-network/
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    Fix WiFi Issue for iOS 7
    http://ipadnerds.com/fix-wifi-issue-ios-7/http://ipadnerds.com/fix-wifi-issue-ios-7/
    iOS 6 Wifi Problems/Fixes
    Wi-Fi Fix for iOS 6
    https://discussions.apple.com/thread/4823738?tstart=240https://discussions.apple.com/thread/4823738?tstart=240
    How To: Workaround iPad Wi-Fi Issues
    http://www.theipadfan.com/workaround-ipad-wifi-issues/http://www.theipadfan.com/workaround-ipad-wifi-issues/
    Another Fix For iOS 6 WiFi Problems
    http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/http://tabletcrunch.com/2012/10/27/fix-ios-6-wifi-problems-ssid/
    Wifi Doesn't Connect After Waking From Sleep - Sometimes increasing screen brightness prevents the failure to reconnect after waking from sleep. According to Apple, “If brightness is at lowest level, increase it by moving the slider to the right and set auto brightness to off.”
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bughttp://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading-http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    iPad: Issues connecting to Wi-Fi networks
    http://support.apple.com/kb/ts3304http://support.apple.com/kb/ts3304
    How to Boost Your Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.hhttp://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Boost-Your-Wi-Fi-Signal.h Mt
    Troubleshooting a Weak Wi-Fi Signal
    http://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sighttp://ipad.about.com/od/iPad_Troubleshooting/a/Troubleshooting-A-Weak-Wi-Fi-Sig nal.htm
    How to Fix a Poor Wi-Fi Signal on Your iPad
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-Ohttp://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-A-Poor-Wi-Fi-Signal-O n-Your-iPad.htm
    iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting http://www.apple.com/support/ipad/wifi/http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connecthttp://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet http://support.apple.com/kb/HT1695http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199http://support.apple.com/kb/HT4199
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Connect iPad to Wi-Fi (with troubleshooting info)
    http://thehowto.wikidot.com/wifi-connect-ipadhttp://thehowto.wikidot.com/wifi-connect-ipad
    10 Ways to Boost Your Wireless Signal
    http://www.pcmag.com/article2/0,2817,2372811,00.asphttp://www.pcmag.com/article2/0,2817,2372811,00.asp
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxEhttp://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0https://discussions.apple.com/thread/2398063?start=60&tstart=0
    How To Fix iPhone, iPad, iPod Touch Wi-Fi Connectivity Issue http://tinyurl.com/7nvxbmzhttp://tinyurl.com/7nvxbmz
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    Some Wi-Fi losses may stem from a problematic interaction between Wi-Fi and cellular data connections. Numerous users have found that turning off Cellular Data in Settings gets their Wi-Fi working again.
    You may have many apps open which can possibly cause the slowdown and possibly the loss of wifi. In iOS 4-6 double tap your Home button & at the bottom of the screen you will see the icons of all open apps. Close those you are not using by pressing on an icon until all icons wiggle - then tap the minus sign. For iOS 7 users, there’s an easy way to see which apps are open in order to close them. By double-tapping the home button on your iPhone or iPad, the new multitasking feature in iOS 7 shows full page previews of all your open apps. Simply scroll horizontally to see all your apps, and close the apps with a simple flick towards the top of the screen.
    Wi-Fi or Bluetooth settings grayed out or dim
    http://support.apple.com/kb/TS1559http://support.apple.com/kb/TS1559
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • How to contact support? Problem with subscription

    Hello,
    I payed today 10euros to get more credit in Skype, but then I noticed that I had only about 2 euros in my credit. Then I went to my account and I saw that I had subscribed to the monthly unlimited (which I didn't). 
    Why/how did this happen?
    I tried cancelling my subscription of the one month unlimited, but I got an error and an ID that I have to use when contacting Customer Support.
    REQUEST-0634ec74/2014110817
    How do I contact Customer Support?
    Thank you

    Hi, Tatabrasil, and welcome to the Community,
    Here is a link to the instruction on how to contact Skype Customer Service via their secure portal: Contact Customer Service   Also, here is a link to the instruction on how to start an instant message chat with an agent: https://support.skype.com/en/faq/FA10656/what-is-live-chat-support
    Skype is aware of continued problems with the website when contacting their customer service agents. If you experience difficulty reaching Skype Customer Service or find yourself redirected back to the Community, please try again using a different web browser and - important - by choosing a different path through the various drop-down menu options presented. Also, look to approve a pop-up dialogue box which would connect you to start an instant message chat with a customer service agent. If you have pop-ups blocked in your browser settings, this will also impede reaching an agent.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • How do I fix the problems with the newest version of firefox

    I a having a major problem with the newest version of firefox and I am not happy with it. I did everything that I am supposed to do with the reset, but it is still not working correctly. It has a lot of no responses and freezing up problems.
    How do I fix this problem?

    You didn't provide any information about your Firefox setup. Can you do that and paste it in a new reply?
    *Navigate to <code>about:support</code> via Address Bar
    *Click the button that says <code>Copy text to clipboard</code>
    *Now, go back to your forum post and click inside the reply box. Press Ctrl+V to paste all the information you copied into the forum post.
    Can you try to start Firefox in Safe Mode to see if Firefox opens and works properly with no error? You can start Firefox in Safe Mode below:
    *'''Windows/Mac''': Hold the SHIFT/Option key while opening Firefox
    *'''Linux''': Run ''firefox -safe-mode'' in the Terminal/Konsole
    If Firefox opens up fine with no problems, it's probably one of your extensions that's causing the issue. You can re-enable your add-ons one by one until you find the one that causes the issue upon being re-enabled.

Maybe you are looking for

  • Oracle 9i function to perform data manipulation

    Hi everyone, I have two scenarios. I would like to write one Oracle 9i function that can accommodate both these scenarios, using PL/SQL developer. I intend passing a varchar2 parameter to this function. Within the function, I perform a select on a ta

  • Serial Number table at SO

    Hi, Can anyone please tell me serial number data goes to which table (not view or structure) at the time of Sales order delivery creation... I need to find out the latest Sales order number with the input of serial number of material... Thanks, Yuvni

  • I need *.eap or *.deb file for firefox update

    I am using an asus netbook with linux. For whatever reason the installed firefox is set to update automatically, which it unfortunately for me does not do When I download the latest version of firefow the netbook only accepts *.eap or *.deb files. I

  • Finder" disappears, can't restart.  MacBook Air

    Hi Folks: I tried to connect my 2013 Macbook Air to a remote disk this am.  I saw the disk but not the files on the disk.  When I went back to my Macbook Air the finder was hung up.  When I restared Finder under the Force Quit menu the finder bar dis

  • Edge Animate and iBooks Author

    Hello, Let me start by saying that I love Edge Animate! It is easy to learn with plenty of support and examples. However, I am having difficulty publishing my file to iBooks Author. After publishing my animation file, when I drop it into iBooks Autho