Can't seem to count, weird?

The code is basic because I extracted information from a larger program so that I could play around with bits and pieces of the code to improve it. Anyways, I'm trying to count the buttons with numerical commands, however the second for loop which is responsible of counting doesn't even execute correctly. For example, I placed the count++; outside the if statement and it stays at 0, very weird. Thanks in advance for your help.
import javax.swing.*;
import java.awt.*;       
import java.awt.event.*;
class mine {
     public static JButton[][] button = new JButton[10][10];
     public static void main(String args[]) {
          int i, j, h, count = 0;
          for(i = 0; i <10; i++) {
               for (j = 0; j < 10; j++){
                    button[i][j] = new JButton();
          button[0][0].setActionCommand("mine");
        button[0][1].setActionCommand("2");
        button[0][2].setActionCommand("mine");
        button[0][3].setActionCommand("1");
        button[0][4].setActionCommand("1");
        button[0][5].setActionCommand("1");
        button[0][6].setActionCommand("1");
        button[0][7].setActionCommand("opaque");
        button[0][8].setActionCommand("opaque");
        button[0][9].setActionCommand("opaque");
        button[1][0].setActionCommand("2");
        button[1][1].setActionCommand("3");
        button[1][2].setActionCommand("2");
        button[1][3].setActionCommand("1");
        button[1][4].setActionCommand("1");
        button[1][5].setActionCommand("mine");
        button[1][6].setActionCommand("1");
        button[1][7].setActionCommand("1");
        button[1][8].setActionCommand("1");
        button[1][9].setActionCommand("1");
        button[2][0].setActionCommand("2");
        button[2][1].setActionCommand("mine");
        button[2][2].setActionCommand("1");
        button[2][3].setActionCommand("opaque");
        button[2][4].setActionCommand("1");
        button[2][5].setActionCommand("1");
        button[2][6].setActionCommand("1");
        button[2][7].setActionCommand("1");
        button[2][8].setActionCommand("mine");
        button[2][9].setActionCommand("1");
        button[3][0].setActionCommand("mine");
        button[3][1].setActionCommand("2");
        button[3][2].setActionCommand("1");
        button[3][3].setActionCommand("opaque");
        button[3][4].setActionCommand("opaque");
        button[3][5].setActionCommand("opaque");
        button[3][6].setActionCommand("opaque");
        button[3][7].setActionCommand("1");
        button[3][8].setActionCommand("1");
        button[3][9].setActionCommand("1");
        button[4][0].setActionCommand("1");
        button[4][1].setActionCommand("1");
        button[4][2].setActionCommand("opaque");
        button[4][3].setActionCommand("opaque");
        button[4][4].setActionCommand("opaque");
        button[4][5].setActionCommand("opaque");
        button[4][6].setActionCommand("opaque");
        button[4][7].setActionCommand("1");
        button[4][8].setActionCommand("1");
        button[4][9].setActionCommand("1");
        button[5][0].setActionCommand("opaque");
        button[5][1].setActionCommand("opaque");
        button[5][2].setActionCommand("opaque");
        button[5][3].setActionCommand("opaque");
        button[5][4].setActionCommand("opaque");
        button[5][5].setActionCommand("opaque");
        button[5][6].setActionCommand("opaque");
        button[5][7].setActionCommand("1");
        button[5][8].setActionCommand("mine");
        button[5][9].setActionCommand("1");
        button[6][0].setActionCommand("1");
        button[6][1].setActionCommand("1");
        button[6][2].setActionCommand("opaque");
        button[6][3].setActionCommand("1");
        button[6][4].setActionCommand("1");
        button[6][5].setActionCommand("2");
        button[6][6].setActionCommand("1");
        button[6][7].setActionCommand("2");
        button[6][8].setActionCommand("1");
        button[6][9].setActionCommand("1");
        button[7][0].setActionCommand("mine");
        button[7][1].setActionCommand("1");
        button[7][2].setActionCommand("opaque");
        button[7][3].setActionCommand("1");
        button[7][4].setActionCommand("mine");
        button[7][5].setActionCommand("2");
        button[7][6].setActionCommand("mine");
        button[7][7].setActionCommand("1");
        button[7][8].setActionCommand("opaque");
        button[7][9].setActionCommand("opaque");
        button[8][0].setActionCommand("1");
        button[8][1].setActionCommand("1");
        button[8][2].setActionCommand("opaque");
        button[8][3].setActionCommand("1");
        button[8][4].setActionCommand("1");
        button[8][5].setActionCommand("2");
        button[8][6].setActionCommand("1");
        button[8][7].setActionCommand("1");
        button[8][8].setActionCommand("opaque");
        button[8][9].setActionCommand("opaque");
        button[9][0].setActionCommand("opaque");
        button[9][1].setActionCommand("opaque");
        button[9][2].setActionCommand("opaque");
        button[9][3].setActionCommand("opaque");
        button[9][4].setActionCommand("opaque");
        button[9][5].setActionCommand("opaque");
        button[9][6].setActionCommand("opaque");
        button[9][7].setActionCommand("opaque");
        button[9][8].setActionCommand("opaque");
        button[9][9].setActionCommand("opaque");     
          for (i = 0; i < 10; i++) {
                  for (j = 0; j < 0; j++) {
                       if (!(button[i][j].getActionCommand() == "opaque")) {
                            if(!(button[i][j].getActionCommand() == "mine")) {
                                 count++;     
                       count++;
          System.out.println(count);
}

Here's another question, how would I create a boolean statement that returns true when a int value is parseable from a string:
For example: the string "1234" can be parsed and the int value can be 1234. This is what I've thought of so far:
if (Integer.parseInt(button[i][j].getText()) instanceof int) {

Similar Messages

  • I can't seem to get my iMac (late 2009 model) into automatic sleep mode.  If I manually put it into sleep I don't have any issues.  I used to solve the issue by running "PleaseSleep" application but that doesn't work anymore since Lion.

    I can't seem to get my iMac (late 2009 model) into automatic sleep mode.  If I manually put it into sleep I don't have any issues.
    I used to solve the issue by running "PleaseSleep" application but that doesn't work anymore since Lion. I now want to fix the underlying problem.
    I'm not running any weird background processes and in my energy saver settings I've tagged "put the hard disk to sleep when possible:, "allow power button to put computer to sleep" and "automatically reduce brigthness". All pretty standard.
    Is there anyone who can give me some pointers ?

    Today I solved the same problem for my iMac running Snow Leopard. See https://discussions.apple.com/thread/3008791#15947706. The method may help you, too.
    For me it was the DynDNS Updater preventing my iMac from automatically entering sleep mode.
    To my knowledge the cause of this sleep problem can only be a peripheral device or a process. So I suggest to first unplug all peripherals and test whether that's the cause. If not, I suggest to terminate one process after another and to test automatic entering of sleep mode after each. Start with user processes; continue with system process if necessary.
    At least that's the way I found the offending process. Fortunately, I was able to change the configuration of that process to allow again automatic entering of sleep mode.
    Good luck!

  • Can't View ACL count details using ASDM

    We are running a ASA5520 with system image of "disk0:/asa843-k8.bin".  I'm also running ASDM ver: 6.4(7).
    So my question is while I'm in the ASDM on the configuration of the firewall, I'm looking at the Access Rules.  When I do a show log on any of the rules that have hit counts on them, it opens up a Real-Time Log Viewer but I don't see any information.  It's not showing anything, nothing appears, it just sit's there like it's waiting but no data is coming.  Even though if I go back out to all the rules, I can see the hit count incrementing.  The same thing happens no matter which rule I pick with hit counts on them. 
    I'm hoping in the end I can click on show log on the rule in question and see each individual hit information Source/Destination IP, Srce/Dest Port, Severity, Date and time.
    I'm sure it's just a configuration issue I'm missing somewhere but I can't seem to figure it out.  Any help with this issue would be greatly appreciated.

    Hi,
    Wat you would need to do is to add the log option after the acl that you are viewing, like:
    access-list outside_access_in permit ip any host 1.1.1.1 log
    Then go to ASDM and check the logs in the window.
    Hope that helps.
    Thanks,
    Varun

  • Can't seem to find my jsp

    i'm a first timer here and thanks to kevin yank, i am able to get the message
    "Apache/1.3.22 (Win32) running ..." and
    "Starting service Tomcat-Standalone
    Apache Tomcat/4.0.1
    Starting service Tomcat-Apache
    Apache Tomcat/4.0.1"
    when starting the server. However, i can't seem to view the simple jsp i've written on my internet explorer. i keep getting a prompt to tell me that web page is not available offline. i've keyed-in
    "http://localhost/jsp/count.jsp" at the URL

    Where is your Jsp? Have you created your own application?
    Suppose if your jsp is in your application (Myapp), then your Dir structure looks like this. Tomcat_Home\webapps\Myapp\jsp\count.jsp, then you need to give following URL,
    http://localhost:8080/Myapp/jsp/count.jsp.
    Hope this helps.
    Sudha

  • My green audio bars went invisible and I can't seem to get them to reappear

    Hello,
    I use After Effects CS6 with a pretty new i5 desktop computer with Win8. My green audio bars (not sure of the technical name) just starting being invisible for the first time, so I can't edit/move them around anymore, as shown in this screen capture here:
    http://i878.photobucket.com/albums/ab341/AAL2423W/artsies/3-30-2013010337PM_zps369a2cc1.jp g
    (Sorry if it's small, Photobucket shrinks my image files if they go beyond a certain size, but Ctrl++ may help to zoom in for details.)
    You can see how the green bars are missing even though you can still see the accompanying green Waveform underneath where the green bars should be.
    Why did they disappear and what can I try to do to reclaim the green audio bars? I also can't seem to continue the project until I get past this issue, as even putting in new audio bars show up as invisible. (It's as if the project file has 'had enough' and wants me to start a new project file, but this would result in repeated work.)
    (I feel like this started happening because the project got too big for one file, due to being 12min long and having 337 'layers' so far, but I don't want to suggest that as part of the answer, I'm just giving my own inexperienced feeling about the matter. Plus, I already tried dividing the project up into two 7min halves, since I only started having this problem at the 11.5min mark, and, unfortunately, the new second half still doesn't even show the invisible green bars, despite being only 7min long instead of 11.5min. I also notice performance issues replaying the entire thing with a RAM Preview after it got to be around 11min in total, with random audio skipping and the like, making me assume I'll keep projects to about a 7min maximum from now on to be safe and just compile them all afterwards. Another performance issue is that it clearly doesn't complete the RAM Preview distance that is set. Instead it stops where it wants to and commences replaying.)
    Thanks

    Edit --> Preferences --> Media and Disk Cache --> Purge. And you might wanan consider substituting any compressed audio sources with WAVs, too, to avoid such corruptions. Similarly, check your audio in a proper audio editing app. Odd sample rates, weird channle mapping and so on can have all sorts of ill effects.
    Mylenium

  • HT2506 hi i can't seem to copy and paste pdf files from preview to a microsoft word document. it always comes up with nonsense characters in the word document. how do i fix this? thanks in advance

    hi i can't seem to copy and paste pdf files from preview to a microsoft word document. it always comes up with nonsense characters in the word document. how do i fix this? thanks in advance

    Hi,
    The quickest way to do this (tested with OS 10.8.2, MS Word 2011) is in one line:
    tell application "Microsoft Word" to close every document whose name begins with "book"
    The reason why your script doesn't work is that you aren't specifying to Word which document you want it to close.
    So, changing one line ought to do it:
    close document incrementvalue -- instead of "close document"
    But... when you close a document, you change the document count. Document 2 becomes document 1, document 3 becomes document 2 etc. So eventually you'd get a message saying "The object you are trying to access doesn't exist".
    Because of this, if you want to do it in a repeat loop, you have to work backwards:
    tell application "Microsoft Word"
      set doc_count to count documents
      repeat with x from doc_count to 1 by -1
      if name of document x begins with "book" then close document x
      end repeat
    end tell
    Hope this helps.

  • Can't seem to re-install Classic support

    I have been preparing an old PowerMac G4 to give to a friend.   I erased the hard-drive and did a clean install of Tiger, and updated it.   I'm now trying to re-install Classic support (so I can occasionally go to her house and run one of my OS9 apps, since I can't seem to find Chubby Bunny to get classic support on my new/old Intel machine :-(
    I thought all that was necessary was to copy an OS9 System Folder onto the hard-drive.   (I actually made a small separate partition when I erased the hard-drive, although I doubt this was necessary).   I copied the System Folder from a "Mac OS9 Install" CD that was in the original set of discs that came when I bought an older G4 new.   I think the discs are probably OSX 10.1, but the OS9 disc seems to be 9.2
    Anyhow, when I try to fire up Classic mode, I get a message somehting like "this system software can only run on the original media, not if it is copied to another drive".     I assume it's referring to the fact that I have copied the System Folder from the CD to my hard-drive.   And if I leave the OS9 CD in the drive and point Classic to it (which would be a poor long-term solution), it complains that it needs to update the Classic resources and the volume is un-writable.   Kind of a catch-22.
    The weird thing is, I successfully did this once before, when I bought (used) this same G4.
    Thanks.
    P.S.  Please let me know if I should put this in the OSX Tiger forum instead.

    RustyQShackleford wrote:
    But when I went to do the OS9 install, it could only find the root partition where I have 10.4.11 installed.  It could not find the other partition of the my main HDD (where I'd hoped to put OS9), nor could it find the smaller HDD at all.   It refused to install it on the root partition anyhow, without doing a clean install and nuking OSX.
    Evidently the problem was that I didn't check "install OS9 drivers" when I formatted the smaller HDD - even though it said "this will not affect Classic".   So I re-formatted it and checked that, and now it allowed me to install OS9.2 on it, and now Classic works fine.   It still refused to recognize the smaller partition of my main HDD, which is where I really wanted to install it.
    Thanks all.

  • HT1632 I can view a workout on my ipod touch history, but not in itunes or on nike+ website.  I can't seem to upload this run and it's really annoying as I'm loosing about 12k of runs.  It seems to happen when I program in a custom run.  Can you help?

    Hi there,
    I have just done a custom run on my Ipod touch 2nd Gen of 12k.  When I finished the run is appearing in my run history on my iPod touch, however it is not appearing in my itunes 'Nike+' tab, or on the Nike + website.  I can't seem to get this run to sync and it is really annoying because I'll be loosing 12k.  Can anyone help or has experienced this before?  I know there are solutions to add runs to iPod nano's and older iPods using the 'Enable disk' and iPod_control function however from what I'm aware you cannot do this on an iPod touch.  Can anyone please help?
    Many thanks
    Phil

    You should really read the manual.
    "How do you restore from backup? "
    Restore.  When given the choice, choose to use backup.
    "And how can I check to see if the pics and videos are on my computer somewhere first??"
    They would only be where you put them.  What program did you use to import them?  Pics/vids taken with ipod are not part of the sync process at all.  You should be importing them just as you would with any digital camera.
    If you did not import them, then they are not on your computer.

  • ITunes 8.1 Can't Seem to do More Than One Thing at a Time

    I upgraded to 8.1 and now, rather than a "faster" iTunes experience as was advertised on Apple's website, iTunes can't seem to do more than one thing at a time without locking up the application completely. For instance, when trying to download podcasts if I choose to hit more than one "Get" button at a time iTunes will freeze up until the first podcast has completely downloaded. During this time I cannot access any other screen in iTunes at all.
    This freezing of iTunes also occurred while I was trying to sync my iPhone 3G. I received the Calendar sync error that a few other people have mentioned on the forum and wanted to turn off Calendar sync (since I don't use it and don't understand why iTunes turned it on by default, apparently, after the upgrade) but I had to wait for my iPhone 3G to completely sync before I could gain access to any of the tabs in the iPhone sync window.
    So, basically it seems like the new version of iTunes (8.1) really doesn't like to be bothered while it is trying to copy data from one place to another.
    Any ideas?

    I'm using Vista Ultimate 64-bit and iTunes 8.1 installed OK, but required a restart of the entire OS after upgrading. It takes forever to launch, clicking on certain items (like applications) causes itunes to freeze for about 15-30 seconds before it continues (this is actually something that's been there since the introduction of the app store), I've had to switch my library view to LIST and avoid any sort of album art. Using album art to view my library causes iTunes to be extremely, obnoxiously unresponsive.
    The best part - plugging in my iPhone to sync it... iTunes simply sits there dumbly - doesn't even recognize that I've plugged my iPhone in. So now I can't even sync. QUALITY product, quality. So the app I'm FORCED to use to manage my phone doesn't even work after upgrading. Outstanding.
    I'm terrified of uninstalling and reinstalling... the last time I did that with iTunes it jacked my library up... it "lost" all of my music... basically it disassociated all of the music (even the stuff purchased through the itunes store) with the index file so I had to re-import EVERY song and delete the duplicate entry.
    I searched a ton of forums looking for any clues as to how I could improve performance... All I run into is apple fan boys flaming any and all forums to the point of PC *****, no Apple *****, and so forth. Extremely unhelpful.
    The fact is this - if I wasn't forced to use iTunes to manage my non-jailbroken iPhone 3G, then I'd dump it completely. It is a horrible app. Why punish the customers that haven't gone the route of "jail breaking" their iPhones?
    One individual on one of the forums suggested that blue screens, and all the other random errors, including slow performance were due to a lack of RAM. I have 4GB of RAM on my machine I can run a virtual Fedora core 9 machine and a virtual WinXP machine on my Vista x64 box and still not have any performance issues with those two virtuals in the background sucking up system resources, yet with nothing open and less than 50% of my 4GB of RAM in use iTunes performance is abysmal. I have not run into any other application on my Vista machine that performs as badly as iTunes.
    And Apple is touting a "64-bit" version of iTunes - it isn't. The applications the 64-bit installer installs are all 32-bit.
    So, I'm searching as the two of you are for an answer to horrible performance of iTunes.
    Even exiting out of iTunes takes a day and a half... "saving itunes library".... And my "library" isn't that big.

  • Syncing iphone and can't seem to transfer audiobooks that i have put in a playlist.  Sync menu doesn't show all playlists.  Help

    syncing iphone and can't seem to transfer audiobooks that i have put in a playlist.  Sync menu doesn't show all playlists.  Help

    I have the same problem with podcast playlists.  When I go to the music window in my iPhone devices section, the playlists I have created on my macbook pro in iTunes do not appear as an option to sync with the iPhone.  I know some web radios streams, like the BBC, won't transfer because of compatibility issues, but the playlists of podcasts that I have created consist entirely of podcasts downloaded from the podcasts section on the iTunes Music Store.  They used to show up and sync properly before I upgraded to OS 5.1.1, but now they don't.
    Does anyone have a fix and am I right in surmising that the cause is a glitch in OS 5.1.1?

  • Why isn't my iTunes store loading properly? It lists everything in text without images, and I can't seem to access the store when I try to search for music or movies etc.

    Why isn't my iTunes store loading properly? It lists everything in text without images, and I can't seem to access the store when I try to search for music or movies etc.

    1) The best way to relocate the iTunes library folder is to move the entire iTunes folder with all subfolders to the new path, then press and hold down shift as start iTunes and keep holding until prompted to choose a library, then browse to the relocated folder and open the file iTunes Library.itl inside it.
    If you've done something different then provide some more details about what is where and I should be able to help.
    2) Purchases on the device should automatically transfer to a Purchased on <DeviceName> playlist, but it my depend a bit on whether automatic iCloud downloads are enabled. If there is a cloudy link then the transfer might not happen. You can use File > Devices > Transfer Purchases. In iTunes you should also check out iTunes Store > Quick Links > Purchased > Music > Not on this computer.
    3) Backup the device, then immediately restore it. In some cases you need to add a restore as new device into that equation. Obbviously not to be attempted until you're sure all your media is in your library. See Recover your iTunes library from your iPod or iOS device should it be needed.
    4) I believe there is complimentary 1 incident 90-day support with hardware purchases, but no free software support for iTunes itself. AppleCare gets you a different level of support.
    tt2

  • HT1918 I can't seem to update my apps or make any purchases on from my account. Nothing has changed with my credit card information and for some reason the iTunes Store tells me my information is incorrect. What do I do?

    I can't seem to update my apps or make any purchases on from my account. Nothing has changed with my credit card information and for some reason the iTunes Store tells me my information is incorrect. What do I do?

    Yes, it's frustrating.
    I don't have my iPod with me but, as I recall, the change is done in Settings/Store.  That change will apply to NEW purchases.  However, be aware that all purchases are permanently associated with the Apple ID that was originally used.  Generally, it's only a problem when you need to update an app.  IF you do your updating from iTunes and your logged in to the "wrong" ID, you'll need to log out and back in again.  It's easier from the iPod as you do not need to log out/in but you do need to know the password.
    Unfortunately, you can not merge IDs nor can you transfer purchases from one ID to another.  Go here to find out exactly what you have.  I have the same problem so I deliberately made both passwords identical to make things slightly easier for me.

  • After updating to the latest version of Firefox on my Mac there is no progress bar for the page load. I really miss this feature and can't seem to find a way to obtain it.

    The page load progress bar that was on the lower right of the window is no longer there. After updating to the latest version of Firefox on my Mac there is no progress bar for the page load. I really miss this feature and can't seem to find a way to obtain it. The tab has a circular progress wheel but this is useless for determining a stuck or slow loading page.
    PLEASE NOTE: I am typing this in from a Windows based work computer but am asking about my Apple MacBook Pro that i use at home.

    Firefox 4 saves the previous session automatically, so there is no longer need for the dialog asking if you want to save the current session.<br />
    You can use "Firefox > History > Restore Previous Session" to get the previous session at any time.<br />
    There is also a "Restore Previous Session" button on the default <b>about:home</b> Home page.<br />
    Another possibility is to use:
    * [http://kb.mozillazine.org/Menu_differences Firefox (Tools) > Options] > General > Startup: "When Firefox Starts": "Show my windows and tabs from last time"

  • Can't seem to update firmware on Zen Xtra (3

    I am having trouble upgrading firmware on player.
    I am trying to go from .0.0 to .20.08.
    Followed instructions and removed current OS from player.
    Launched the upgrade firmware file and followed instructions.
    Where I seem to be having trouble...is after the upgrade seems to be proceeding nicely and get to the end of the progress status bar...the PC GUI says "the player is now rebooting"...but
    the player does not rebot.
    I think this is necessary...because if I manually boot from the rescue menu...i simply go back to the original OS.
    I am having other trouble as well.
    I am trying to upgrade the firmware because i can't seem to get any music to transfer to the player anymore.
    I have not tried to move content into the player for along time...and since that time I have a new PC.
    I can't seem to put my hands on the original CD that came with the player...so I went to the Creative Website and downloaded the most recent Media Source Organizer. It gives me a file transfer error when I try to move new content onto the player...so I thought I would update the firmware on the player.
    Any help would be appreciated....thank you very much.

    Try the easiest and alternate way by downloading from here
    * getfirefox.com

  • I can't seem to get the iTS to update the description of my podcast, nor refresh to show new episodes?

    I recently launched a podcast series (http://itunes.apple.com/ca/podcast/notes-from-northwest-passage/id449063851) but its still showing an older description text with some typos and an incorrect link in it, as I registered it with a pre-edited file so it would be in line for review while I finalized the details, and now I can't seem to get it to refresh and show the new texts at all, even though I edited the description texts in the xml file well over 2-3 weeks ago.
    I've tried redoing this file several times.  It always validates but changes never get picked up by the iTunes store.I can manually subscribe to the feed using iTunes' advanced menu, with no problems. The feed is at:
    http://a4.g.akamai.net/7/4/66750/v1/smb2.download.akamai.com/66750/http/podcasts /archaeology2011/arcticarchaeology2011_eng.xml
    I recently (about 3-4 days ago) tried redirecting the feed to a new version of the xml file stored in a new folder, just to see if that would somehow jolt it back into reading it, but again after 3-4 days it hasn't done anything.
    It's also not showing any of the most recent episodes even though they have all been there about a week, so the store should have picked them up by now, no?
    Any suggestions?

    If you look at the feed, and look at the entry 'The end to an exciting field season in Aulavik National Park' you will see the line:
    <pubDateFri, 29 Jul 2011 04:00:00 GMT</pubDate>
    You have not closed the 'pubdate' tag - there should be a '>' as the 9th character. Because the tag has been left open, it invalidates everything which follows it, and thus the entire feed. iTunes therefore cannot read it, which is why the Store has not updated. Add the '>' and republish, and all should be well.
    It's always worth checking your feed by subscribing manually, from the 'Advanced' menu, or by clicking the 'subscribe free' button on the Store page (both do the same thing) - if you can subscribe to the feed it should be OK.

Maybe you are looking for