Cant change JLabel icon with setIcon a second time???

Hey all,
I have drawn 21 cards on my GUI - then as a user selects one of three columns via a radio button and subsequent Submit button, the deck reshuffles itself, and is THEN supposed to change all the labels to the new cards in their New order.
All the code is good up until the point where it tries to reset the icon - and then I get a
"AWT-EventQueue-0" java.lang.NullPointerException
pointing to the line of my first Label that I am changing.
I am trying to use the same settings as I did in the initial setting and think that maybe this could be my problem, but cannot find a proper setting in the Interface.
My initial settings are this :
for (i=0; i < 7; i++)
          cardscol1.setIcon(new ImageIcon("images\\" + deck.get(i)));
cardscol2[i].setIcon(new ImageIcon("images\\" + deck.get(i + 7)));
cardscol3[i].setIcon(new ImageIcon("images\\" + deck.get(i + 14)));
THEN I tried this again (( INSIDE MY buttonHandler ))
for (i=0; i < 7; i++)
                        j=0;
                        cardscol1.setIcon(new ImageIcon("images\\" + deck.get(j)));
j++;
cardscol2[i].setIcon(new ImageIcon("images\\" + deck.get(j)));
j++;
cardscol3[i].setIcon(new ImageIcon("images\\" + deck.get(j)));
j++;
And this is where I get the NULL POINTER EXCEPTION -- help??
****UPDATE:
I cant access these Label PERIOD from within my Button Handler -- any idea why?

OK -- the cardscol1 and 2 and 3 JLABEL arrays reference cards11, 12, 13, 14, etc. etc... THESE CARDS are within the initComponents class that is in a seperate class as well -- so that is probably my problem-- how do I get this submitButtonHandler class to see the cards that are in my initComponents class???
AND THIS initComponents class is listed as PRIVATE!!! ((This is a class that the NetBeans GUI maker sets up -- very nice feature, but I cannot edit this class at all!))
Message was edited by:
tvance929

Similar Messages

  • Hello am using ios 7.0.4 I have a question about messages that it does not show the time of a particular message after first message that I recive form a paricular person so please in the next version change this and with every message show time and date

    hello am using ios 7.0.4 I have a question about messages that it does not show the time of a particular message after first message that I recive form a paricular person so please in the next version change this and with every message show time and date

    Hi,
    How is everything going? Have you checked this issue from OWA? If so, please let me know the result.
    In adition, please also try to use the following powershell commands to check if the assistant has right permissions:
    Get-MailboxFolderPermission -Identity
    CEO’s email address:\Calendar -User assistant’s email address
    Also check with:
    Get-Mailbox -Identity CEO’s mailbox
    | fl *GrantSendOnBehalfTo
    Please let me know the result.
    Best Regards,
    Steve Fan
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Cant change bookmark icon

    basically what i have been trying to do is change the bookmark icon on my desktop for a web-link the link is for Air Droid ( i also have the Firefox addon on my phone) to transfer files but the icon is quite bad and easy to miss a white icon with a green paper airplane i have tried for multiple hours if you have any knowledge on the subject you can tell me please do share

    You will have to set an icon yourself to an shortcut on the desktop in the Properties via the right-click context menu if the current icon isn't distinctive enough.
    You can toggle the browser.shell.shortcutFavicons pref to see if that makes Firefox use the favicon for a desktop shortcut
    You can open the <b>about:config</b> page via the location/address bar.
    You can accept the warning and click "I'll be careful" to continue.
    *http://kb.mozillazine.org/about:config

  • Nano cannot be restored "cant mount", battery icon with exclamation point

    My ipod nano is showing a battery icon with an exclamation point whenever i reset it I get the same icon. When ever i connect it to my computer the updater wont acknowledge that it is plugged into the computer. Whenever its plugged into the computer i get the check mark with a "ok to disconnect" please help i really really want my ipod back in time for fall.

    Whilst it may not be your fault I am afraid it appears that your post is on a forum which is not the best for your OS. It will save the time of the unpaid volunteers here, and may resolve your issue faster, if you could examine the list below and see if there is a more appropriate forum to which you could direct your question.
    OS X 10.9 Mavericks
    OS X 10.8 Mountain Lion
    OS X 10.7 Lion
    OS X 10.6 Snow Leopard
    OS X 10.5 Leopard
    OS X 10.4 Tiger
    OS X 10.3 and earlier
    OS 9, OS 8 & System 7
    OS X Technologies
    OS X Server
    iPad
    iPhone
    iPod
    Other

  • Simulating animation by iterating - JLabel icon. ONLY  Working first time!

    I am "simualting" animation by changing the icon attribute of a JLabel. If I call the method from main, this works. It also seems to work (ie. the JLabel image changes on the screen as the icon attribute is changed in the program.) if I call it first from another or its own class one time, but not after that. What happens on subsequent calls is: The thread.sleep() is working (time passes), and the icon attribute of the JLabel is chaging (lblCaveActive.getIcon() for the JLabel returns the correct changed *.gif, but the images do not show up on the screen, until the last image, whatever I set it to be. I am pulling my air out over this little problem, which is the last lingering problem I am having with this project....I was wondering if you have seen this or have any ideas? I have tried lots of different things, including repainting and such. If you have a clue concerning this, please please please advise, o wise one.
    * simulates animation: ex. Wumpus approaching to eat the
    * player, bat appraoching to transport player
    * @param: int numPics - number of pictures to loop through
    * @param: String picNamePreface - filenames must be "*0.gif" through
    * picNamePreface + numPics + ".gif".
    * Send the "*" portion into this arg
    * @param: int milliSecSleep - seconds for the thread to sleep between
    * pictures
    private void animateMeetHazard(int numPics, String picNamePreface,
    int milliSecSleep)
    try
    for (int i = 0; i <= numPics; i++)
    caveCurrentIcon = new ImageIcon(picNamePreface + i + ".gif");
    lblCaveActive.setIcon(caveCurrentIcon);
    Thread.sleep(milliSecSleep);
    catch (InterruptedException e){}
    --A very tired girl.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Something like
    private void animateMeetHazard(int numPics, String picNamePreface,
    int milliSecSleep)
    try
    SwingWorker workHard = new SwingWorker()
    public Object construct()
    for (int i = 0; i <= numPics; i++)
    caveCurrentIcon = new ImageIcon(picNamePreface + i + ".gif");
    lblCaveActive.setIcon(caveCurrentIcon);
    Thread.sleep(milliSecSleep);
    return null;
    public void finished()
    workHard.start();
    catch (InterruptedException e){}
    Not really sure if the Thread.sleep() will throw you out and give you the same problems .. but it mightn't ;)

  • Cant change a icon..

    hello,
    I wanted to change the adobe suit's icons. I had no problem changing all but Indesign's icon does not change. It seems like its locked. I have never experinced this before.
    Anything I can do about it ?
    Thanking in advance.
    Gokce

    If you can't do it by means of the Finder Get Info panel then swap the app's icon in its bundle…
    Prepare the icon you want to use as an .icns. Quit from the app. Control-click on the app's icon and select "Show Package Contents". Open "Contents" and then "Resources". You will see the current .icns (probably called "InDesign.icns"). Drag it out and keep it somewhere in case you want to restore it. Give the icon you prepared exactly the same name as the one you just pulled out and put yours in "Resources". Close the folders.
    You may have to play around a bit with launching and relaunching the app, and/or logging out/in before Finder recognises the change. You may need to drag the app's alias from the Dock and drag it back onto the Dock.
     

  • Cant change the connection with the database

    its strange... i have 2 databases for same schema with diferent users ...in one i dont have data and the other i have data...... i have created 2 database connection in my connection navigator..... the strange thing is:
    when i change the connection of the application module to the database that doesnt have data and i run the page there are always appear data wich are in my first database.... eventhought i have change the connection... but if i use bussiness component browser to test it .... i dont get data for those views... in fact this is how this should be...... how is this possible ?
    i am using different faces-config.xml files..... is this connection saved in some files and i should change it by hand?

    Hi Me_J,
    Here is the bc4j from one of my application module: <?xml version = '1.0' encoding = 'UTF-8'?>
    <BC4JConfig>
       <AppModuleConfigBag>
          <AppModuleConfig name="MyAppModuleLocal">
             <DeployPlatform>LOCAL</DeployPlatform>
             <JDBCDataSource>jdbc/MyConnectionDS</JDBCDataSource>
             <jbo.project>DataModel</jbo.project>
             <AppModuleJndiName>dfly.datamodel.entities.MyAppModule</AppModuleJndiName>
             <java.naming.factory.initial>oracle.jbo.common.JboInitialContextFactory</java.naming.factory.initial>
             <ApplicationName>dfly.datamodel.entities.MyAppModule</ApplicationName>
          </AppModuleConfig>
       </AppModuleConfigBag>
    </BC4JConfig>You should have something similar. If you have applied security on your application, you could have a "data-sources.xml" file. Assume to have correctly change this file too.
    Instead of using two different connections, i prefer to use only one and changing the parameters when i need to access a different source. You just need to remake and rebuild your project for make your changes effective.
    Hope that help,
    Good luck,
    Tif

  • Cant change profile icon to photo

    Keeps askin if I want to save or share when I press to add photo

    OK -- the cardscol1 and 2 and 3 JLABEL arrays reference cards11, 12, 13, 14, etc. etc... THESE CARDS are within the initComponents class that is in a seperate class as well -- so that is probably my problem-- how do I get this submitButtonHandler class to see the cards that are in my initComponents class???
    AND THIS initComponents class is listed as PRIVATE!!! ((This is a class that the NetBeans GUI maker sets up -- very nice feature, but I cannot edit this class at all!))
    Message was edited by:
    tvance929

  • Cant change window Icon in a JFrame

    I cannot seem to set the icon in the upper left of the window or in the task. I am using NetBeans and it created my JFrame for me using the following code to initialize:
    java.awt.EventQueue.invokeLater(new Unable() {
                public void run() {
                    new MainFrame().setVisible(true);
            });I have checked online tutorials and this seem to be a trully easy task BUT my JFrame, MainFrame, seems not to have the method I need....
    I should be able too do this:
    MainFrame.setIconImage(Image image); But it seems I cannot get that method in my JFrame at all, it just doesnt show up in NetBeans and wont allow me to compile. I have tried looking at the base JFrame class and see no setIconImage there either. Any help would be apriciated.
    KN

    Can you post the code for your MainFrame class. Use
    code tags.Ok, 1st excuse the messy code, I am teaching myself Java and the code is a bit unproffesional. Also the code is large as it is a calendar program that allows you to input text into the actual calendar day boxes, loads, saves etc. Here is the declaration of the MainFrame class and the MainFrame constructor.
    public class MainFrame extends javax.swing.JFrame {
        // Constants
        public final int DATE_HEIGHT = 17;
        public final int DAY_HEIGHT = 80;
        public final boolean DBG = true;
        public boolean Init = true;
        public int curMonth = 0;
        public int curYear = 0;
        /** Creates new form MainFrame */
        public MainFrame() {
            initComponents();
            for(int x = 0;x < 12;x = x + 2){
                jTable1.setRowHeight(x,DATE_HEIGHT);
                jTable1.setRowHeight(x+1,DAY_HEIGHT);
            jTable1.setDefaultRenderer(Object.class, new ColorCellRenderer());
            DateFormat dateFormat =
                    DateFormat.getDateInstance(DateFormat.FULL);
            // Create our Gregorian Calendar.
            GregorianCalendar cal = new GregorianCalendar();
            cal.setTime(new Date());
            DaYear.setYear(cal.get(cal.YEAR));
            DaMonth.setMonth(cal.get(cal.MONTH));
            Init = false;
            LoadIt(curMonth, curYear);
        }KN

  • Cant change rotary speaker with wheel

    Hi I'm trying to change the rotary speaker in the Garage Band tonewheel organ using the modulation wheel on my midi keyboard.The activity shows up as a Midi input but the settings don't change,neither does the Pitch Bend.I have been right through the settings in Logic and garage band .Any help would be appreciated/Thanks

    First follow the instructions in this support article.
    If an iPhoto or Aperture library is the source of your desktop pictures, it may need to be rebuilt, or you may need to update the application to the latest version.
    Otherwise, continue as below.
    Back up all data.
    In the Finder, hold down the option key and select
    Go ▹ Library
    from the menu bar. From the Library folder, delete the following item, if it exists: 
    Caches/com.apple.systempreferences
    and move the following item to the Desktop:
    Preferences/com.apple.desktop.plist
    Launch System Preferences and test. If you still have the issue, put the item on the Desktop back where it came from and post again. Otherwise, delete the item.

  • Printing help, colour changes when i print files for second time

    Hi, iv designed a thank you card that i want to print off multiple times, iv saved it, happy with it, did a test print and it looked fine, i then went to print off a second copy and the colour had changed to a much lighter tone, so i assumed the ink was running low and changed the ink, went to print it again, and its still the same pale colour, any help anyone, thanks in advance

    Hi, thanks. Do you mean Save As - Photoshop PDF, or... how are you referring to doing that? 
    (Thank you for this!  I had taken to making screenshots for pete's sake, though this change happened suddenly, so ... I have no idea why printing to PDF suddenly didn't work and it seems it should be "repairable".)

  • New Issues with Flash builder - Second time you do search from imported Tutorial file it breaks with AS error

    Okay, so I had an issue with the Design View that was broke because of the <s:text> tag inside of the <s:RichText> tag. Adobe fiexed that in one of the next released builds (discussion here in fourms). So I took the tutorial file (again) and started to work on it and all went okay, except that the 'tracking' method on the ricktext tag was taken out. Forums mentioned that. So on import of the 'tutorial' fxp from FC to Flex builder, you get several errors because FC still builds the fxp file with 'tracking' property being used in the RichText tag. No biggie, i just remapped to trackingLeft property in the effected files. Now mind you in  the older build that I had this project, worked fine, with the exception of the 'design view' issue with the <s:text> file borking the design view. Bug on it said it was fixed with the next build. which it was but this now when you take the EXACT same code and compile and run it the seach will break each and everytime. Think it has or may have something to do with Adobe taking out the 'tracking' property on the richtext tag.
    anyone else having this issue?
    attaching the fxp file
    btw, posted as a bug FB-21116
    https://bugs.adobe.com/jira/browse/FB-21116
    Craig

    I can recreate the problem but I haven't seen it reported
    before. WebHelp has an option that would let you avoid the input
    box in the Index but not FlashHelp.
    There is information in Snippet 1 on my site about TOC
    synchronisation but I don't know if it will help with FlashHelp.
    Please report this bug via the Adobe site.
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • Buy twice, once - pre-installed with mac(imac2012), second time in the Mac App Store?

    1. md096 with preinstalled Mountain Lion
    2. mac app store asks to buy Mountain Lion
    buy twice???

    Why do you need to download a copy of the OS that is on your Mac. Use the recovery partition if you need to reinstall.
    If you get another copy from the Mac App Store you will need to pay for it.

  • JLabel Icon and Text

    Hi,
    I am creating a JLabel and setting an ICon with setIcon method. The label has a square border and a text. The Icon covers the the label with "X" form corner to corner on the square border. I can't see the text after setting the Icon. I tried to set the text after Icon, still it is hidden.
    So what should I do to display the Icon and Text at the same time and want the text to be visible.
    thanks,
    NT

    public static void main(String[] args)
    JFrame jf = new JFrame();
    jf.setSize(500, 250);
    JPanel jp = new JPanel();
    jp.setSize(250, 250);
    jp.setLayout(null);
    ImageIcon im = new ImageIcon("4.gif");
    JLabel jl = new JLabel();
    jl.setOpaque(true);
    jl.setBounds(0, 0, 150, 16);
    jl.setBorder(new LineBorder(Color.BLACK));
    jl.setText("NAME");
    jl.setIcon(im);
    jp.add(jl);
    jf.add(jp);
    jf.setVisible(true);
    this sets the icon and the text, but the icon is first and then the text. I want the icon on top of Text.
    thanks,
    NT

  • I changed my apple id email but cant change it on my phone

    I have changed my apple id email and cant change it on my phone now every time any app asks for my password is says its incorrect because the email is wrong.

    The problem is that you had "Find My iPhone" (activation lock) turned on, when you changed your Apple ID email address. In order to solve the problem. please follow this steps:
    Please change your Apple ID back to your old email address (that you used as Apple ID before) here:http://appleid.apple.com
    Then go to all your devices - iPhones, iPads, Mac etc. - ("Settings > iCloud") and delete your iCloud account from this devices (+ turn off Find My iPhone, but I guess it will ask you that anyway)
    After that go back to http://appleid.apple.com sign in again, and now change your Apple ID again to your new email address.
    Finally, set up your iCloud account on all your devices again.
    Now, everything should working properly again.

Maybe you are looking for

  • Wondering if possible to use Windows XP SP1 with Boot Camp

    I just recently bought a mac a few days ago and i only have Windows XP SP1 cd. I was wondering if it was possible to run that instead of the Windows XP SP2 cd that it says in the requirements.

  • Blackberry Development using WebDynpro for Java

    Hello We are trying to run a webdynpro application on Blackberry Storm.The application contains Standard UI Elements like table,group.The application runs but the table is not gettiing displayed. Could anyone help us with this.

  • How to read weblogic user/password within a J2EE app ?

    All,      There is an J2EE that exposes a webservice and the service can not be secured with ws-security since the service is an exact implementation of an standard that does not mandate  ws-secutiry and only insists on SSL/TLS. The application howev

  • IPhone stay in the apple logo

    HELP!!! My iPhone stay in the Apple Logo, i already restore it. i have a iPhone 3GS running on IOS 6 Please help me!!

  • BPC Consolidation without Tranding Partner - Intco

    Hi experts, I'm doing the blueprint on a customer to implent the BPC Consolidation 7.5 NW, but for my surprise on FI-NewGL the chart of accounts is oppen by the inter-company level, in other words, the system has many accounts for all the intercompan