Rollover/Selected images in ImageIcon Array

I am creating a bejewelled applet and currently have the board drawn.
    private JButton[][] createRandomMap() {
        JButton current[][] = new JButton[ROWS][COLUMNS];
        for (int r = 0;r < ROWS;r++)
            for (int c = 0;c < COLUMNS;c++) {
                Random rand = new Random();
                grid[r][c] = new JButton(pic[rand.nextInt(7)]);
                grid[r][c].setRolloverIcon(pic[+7]);
                grid[r][c].setSelectedIcon(pic[+14]);
                grid[r][c].setRolloverSelectedIcon(pic[+21]);
                jp.add(grid[r][c]);
        return grid;My array is as follows:
    ImageIcon pic[] = {
        new ImageIcon("Images/Black.PNG"),
        new ImageIcon("Images/Blue.PNG"),
        new ImageIcon("Images/Cyan.PNG"),
        new ImageIcon("Images/Green.PNG"),
        new ImageIcon("Images/Purple.PNG"),
        new ImageIcon("Images/Red.PNG"),
        new ImageIcon("Images/Yellow.PNG"),
        new ImageIcon("Images/BlackRO.PNG"),
        new ImageIcon("Images/BlueRO.PNG"),
        new ImageIcon("Images/CyanRO.PNG"),
        new ImageIcon("Images/GreenRO.PNG"),
        new ImageIcon("Images/PurpleRO.PNG"),
        new ImageIcon("Images/RedRO.PNG"),
        new ImageIcon("Images/YellowRO.PNG"),
        new ImageIcon("Images/BlackSel.PNG"),
        new ImageIcon("Images/BlueSel.PNG"),
        new ImageIcon("Images/CyanSel.PNG"),
        new ImageIcon("Images/GreenSel.PNG"),
        new ImageIcon("Images/PurpleSel.PNG"),
        new ImageIcon("Images/RedSel.PNG"),
        new ImageIcon("Images/YellowSel.PNG"),
        new ImageIcon("Images/BlackROSel.PNG"),
        new ImageIcon("Images/BlueROSel.PNG"),
        new ImageIcon("Images/CyanROSel.PNG"),
        new ImageIcon("Images/GreenROSel.PNG"),
        new ImageIcon("Images/PurpleROSel.PNG"),
        new ImageIcon("Images/RedROSel.PNG"),
        new ImageIcon("Images/YellowROSel.PNG")};When I run the applet to test the new code the rollover images are always the black jewel, but the rolloverselected images display correctly for each different colour. What am I doing wrong?

I'm trying an alternate method using an IF statement.
                if (grid[r][c] = pic[1]) {
                    grid[r][c].setRolloverIcon(pic[14]);
                    grid[r][c].setSelectedIcon(pic[21]);
                    grid[r][c].setRolloverSelectedIcon(pic[28]);}I am having trouble with the syntax on the first line. I get an 'incompatible file type' error where it finds the imageicon but is looking for a JButton. What is the proper syntax to check an imageicon a JButton array in a 2D array?

Similar Messages

  • Cannot select images from iPhoto

    I made a desktop AIR application that allows users to upload images to our server. Everything works except for Mac people trying to select images from iPhoto.
    This is how I have the file selection setup:
    private var fileRefList:FileReferenceList;
    private var imageFileTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg)", "*.jpg; *.jpeg");
    private var allImageTypes:Array = new Array(imageFileTypes);
    You can see the problem in the screenshot is that the select button won't enable, even though images are selected. Any ideas?

    This is an example of the problem. It actually works the first time you select iphoto images, but if you try it again the select button (in the file browser window) is disabled.
    UploadImageExample.fxp
    UploadImageExample.air

  • Display image from byte array

    Hello Everybody,
    I need to display an image given in a byte array, how can I show this image in a JFrame?
    1. I tryied saving the image in a .jpg file,
         File file1 = new File("Path to my destination image");2. then I use a FileOutputStream to save the image in the path:
            FileOutputStream fos1 = new FileOutputStream(docu);
            fos1.write(ImageInbyteArray);
            fos1.close();3. Once I have the image in a file I'm trying to load it using a JButton, but the JButton doesn't display the image. I think that for some unknown (at least for me ;-) reason the file isn't still available to be used in the ImageIcon, this is my code:
            imgIconDocu = new ImageIcon("Path to my destination image");
            jBtnDocu = new JButton(imgIconDocu);What's wrong here?
    Thanks a lot

    Does the byte array contain a JPEG image? Where did
    you get the contents of the byte array?yes the array contains the JPEG image, I have a database in PostgreSQL, and the images are stored in blob in the database. I have to call a service in the server and in return it gives me the 3 images as byte arrays, that's the reason I only have the byte arrays. so I tryed saving the images as jpeg files in my hard disk to show them, but it appears that they are not available to show them in Swing after saving them. I can only show the images if I close my application and start it again :-(
    I tryed flushing and closing the FileOutputStream after the writting process (fos.write(bytearrayImage);
    fos.flush();
    fos.close();)
    Y also tryed:
    fos.write(bytearrayImage);
    fos.close();
    fos.flush();But it doesn't work either :-(
    What do you recommend me?.
    Thanks a lot,
    Johnny G L

  • How to get index of selected image??

    hi all
    I have a set of images that is displayed for the user and when he choose one image click on it and it will do sime action ... these images are stored in an array of images . How can i know the index of selected image ??

    i woul like to append an array of images in the screen and whenever i choose one of this images it link me to the class

  • Threshold image to D array

    Hello
    I have included 2 Visa. The first one called 'scale image' introduces a picture and converts it to a resolution on 100x100. Is there a way I can export this picture into the second VI which includes IMAQ to threshold the image. 
    I didn't create the second VI it is an example. But from what I Understand it produces the picture into binary. Is there a way I could produce an array with this information on it where the blacks are 1 and the white 0 or visa versa.
    Thanks Craig
    Attachments:
    ScaleImageExample.vi ‏12 KB
    binary.vi ‏43 KB

    Hello Craig
    I am the applications engineer who will be supporting you with this question, as I understand you are looking for alternative methods for displaying image data once you have used the threshold function. Thank you for your thread and including your vi's, this allowed me to look at your code and come up with some ideas without asking you a number of tedious questions.
    Firstly yes you can display your image as an array of binary data, either LED's or 0and1's I have created a project for you which includes your vi's and some additional examples, the additional examples show the new method which you will want to implement.
    Secondly, I created a project so that you can easily pass data between vi's using shared variables, I have created one just to show you, to use the variable just select and drag from the project to your block diagram.
    If you have any further questions or would like any additional examples regarding the conversion of images please get in touch and I will be happy to help. The attached files are in LabVIEW 2010 so if you cannot open them I can down convert them for you.
    Thank you
    Stephanie L
    Applications Engineer
    National Instruments UK and Ireland
    Attachments:
    CraigForum.zip ‏96 KB

  • Is the file size of a selected image shown on Adobe Bridge CC 2014?  If so, where?

    Is the file size of a selected image among the filter categories?  Or anywhere else? I know I can find it in Photoshop, but that is cumbersome.

    The file size is shown in the Metadata panel.
    You can not filter on file size but you can sort by file size.

  • How can I take a single selected image from a slideshow to pass  to another page?

    I have a slideshow of several images from which a user needs to select one (for example the image that is featured in a lightbox after cicking the thumbnail) and then go to another page for further details on that image, with the same image displayed again, and where I want to embed some html to offer further options based on that selected image. How do I pass the name of the object from one page to another? How do I detect that a user has selected an image?
    I have tried setting each image in the lightbox as a hyperlink to a new page, and also tried setting its caption as a hyperlink, but neither of those ideas seem to work (at least in Preview).
    Any suggestions please? I am working in Muse CC 2014.

    Creating a hyperlink from the text caption should work. Try previewing: File/Preview Site in Browser to test.
    (I tested it using both Preview and File/Preview Site in Browser and it did link to the page I assigned)

  • How can I import selected images from a folder instead of the whole folder in iPhoto 9.5.2?

    Hi there,
    I was trying to help my parents import some photos from a folder they have created with photos from their holiday. They only want to import select images from this folder into iPhoto. I said it would be easy and they can do it in 2 ways. First, they can drag and drop selected photos from their folder into iPhoto - and this works for them. However, more convieniently, they can click file>import to Library and then select the photos they want by going into the folder... Well that's how it works on my iPhoto '11 at least. When they showed me their screen via Skype (they are running iPhoto 9.5.2), when they click import to library, and try to go into the folder containing their photos, it imports the whole thing and there appears to be no way that they can enter the folder to select just a few photos from what I could see.
    Does anyone know anything aout this problem?
    Cheers.

    What view are using in the Import dialogue. Column view might be easiest to navigate.

  • In Indesign cc the preview of the selected image is not showing in the place dialog box how to enable that?

    I can't able to see the preview of the selected image in place dialog box of indesign cc but it working in indesign cs6

    Post Author: Argan
    CA Forum: .NET
    A couple things can cause this.
    Right click on the red x to find out the name of the png file.  Search the web server for that png and make sure that the asp worker has access to it.
    The other is a image handler issue.  Search the kbase for Red X NET 2005 and you will find a kbase or two that addresses this.

  • Can't select images in Pages 5.2 from updated older Pages document

    I have a Pages document created 18 months ago.  Upon trying to open and edit in the new Pages 5.2, none of my images in the sidebar (outside my main body margins) are now selectable.  In prior Pages versions you had some feature to allow you to select images in background.  No longer can I find out how to do this.  This I have a document template with images that are unselectable.
    I can't be the only one facing this dilemma. Of course my proposal is due tomorrow and my old documents-as-templates are now worthless.
    Anybody?  (the documentation is so weak it simply states to "select image" before any feature explanation on manipulating etc..)

    No, VikingOSX very sound comment didn't help because no older versions were not saved when Applecare did a clean install of Mavericks after my machine fix.  All I have is Pages 5.2.
    The "hijack" comment was that you insist I downgrade my Pages version, when my question was related to how to do something in 5.2.   App store does not let me download any older versions nor does the link you provided give me instructions on how to download older version.  It stated that it was a popup option "Download an older version of this app?"  However, I do not get that option when I try. 
    1: Not an option as I will not waste the time and many app upgrades which utilize Mavericks as my daily workflow to downgrade my entire system to an older OSX version just for Pages.  That is unreasonable and very timeconsuming and will cause many of my Mavericks upgraded applications to not work any longer (yes, I have researched each app to determine a versioning punchlist if I were to downgrade OSX, and many current daily applications are versioned for the current OSX version)
    2&3:  Yes a have spoken to Apple multiple times, they have only given me the same response to use current version (5.2) that was available in the App store under the "Purchases" tab. They would not give me instructions on how to download an older version.  Their response is that I have the newer version now, which is what they support and what they have given me access to.
    4: Yes, I have replied mutiple times, that the problem is that I cannot select the image on the document.  Hence the original title of this post.  Cannot move if I cannot select.  Pages will only let me select the text next to it.  Click on the image will not select it at all.  So the answer to your question "at what point you could not get them to work"  is that I cannot select an image on an existing document that is outside of the margin and was a background image when the document was created in an older Pages version.
    Thanks for your continued interest in my post, but please, let's stay on topic.  
    ** To others reading this thread, I am simply looking for an answer to how to select a background image in 5.2 from a older produced Pages document.  Is there a menu item I am overlooking or inspector item, etc that would allow me to click on an image already in the background of a document so I could delete or move it.   Pages will not let me select the image by clicking on it.  There must be a simple way I am overlooking.  Thank you.
    If Pages '09 is the answer, then fine.  How do I acquire for download Pages '09 as I cannot seem to get AppStore to offer me that option.

  • Hi, how can i break the value for a row and column once i have converted the image to the array?????​??

    Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
    At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've  tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
    Please help me!
    For your information, I'm using LABView 7.0.

    Hi,
    Thanks for your reply.Sorry for the confusion.
    I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
    Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
    I hope that I have made the problem clear. Sorry if it is still confusing.
    Hope you can help me. Thank you!!!!
    Attachments:
    arrayrowncolumn2.JPG ‏64 KB

  • Previously i was able to select tools in the bridge and then select image processor to make jpegs from my tiffs, the image processor tab is no longer on the tools drop down menu

    previously while in bridge, i was able to select tools in the drop down menu and then select image processor to get to the page where i can make tiffs and jpegs. That option is no longer available in the drop down tool selection. How do I make jpegs from my tiffs now in the bridge.
    thanks
    [Moved from the general Cloud forum to the specific Program forum... Mod]

    In current Firefox releases the search bar on the about:home page and the about:newtab page have an autocomplete=off attribute that prevents Firefox from saving form data and now show search suggestions just like you get on the regular Google search page.

  • Copying and pasting adjustments.  When I copy the adjustments of an image, I thought I could then select several images and batch paste the adjustments to all selected images. But instead it's only pasting to the first photo of the selection. What am I do

    Copying and pasting adjustments.  When I copy the adjustments of an image, I thought I could then select several images and batch paste the adjustments to all selected images. But instead it's only pasting to the first photo of the selected. What am I doing wrong?

    Copy and Paste develop settings in Develop mode on multiple photos on the film strip works for me, even with Auto-Sync turned off.  Lr5.6 OSx 10.8.5

  • Can I convert 3D image to an array of pixels in LabVIEW?

    Hi all;
    I am still new with labview. I has 1 question, can I convert 3D image to an array of pixels using labview?
    Most of the examples I found they only convert 2D image. Hope anyone can give me some hint.
    Thank You

    look at this thread.
    It has links to other threads where the 3D graphs were used.
    You should also search for "gif reader" to find threads where images are read from gif files.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Creating a pdf with user selectable images?

    Hello, I'm quite new to indesign and need some help. I really hate to be that guy saying "quick someone fix my problem for me" but I'm signifigantly behind schedual and this is holding me up.
    Basically, I need some way to alow a used to select from and print up to 8 of around 60 images. An ideal situation would be somehow being able to select images from dropdown lists, but as I said I'm behind schedual and no longer care if it's pretty or intuitive as long as it works.
    If anyone can offer some advice on acomlishing this I would be forever greatful. Oh, I'm using cs6

    I would make a web site for this. I might use a PDF for showing off the options/images and point them to the web site.
    That said, you can use images on buttons, or layers, and show/hide the images using javascript. What is displayed is what will print. I would put the request for aid into the Acrobat forum as someone may have already scripted this. I probably wouldn't use ID for more than the static elements to make the PDF pretty. Then use Acrobat to add images and script it.
    Mike

Maybe you are looking for