Using images with jbutton

I am working on my final grade 12 programming project, making a minesweeper game in java. I am trying to make a locally stored image appear on buttons when they are clicked on. How do I do this? I need to know where to save the image files, and how to assign the image after the button is created. This is because the images each button will need to display after being clicked on will be different every time the program is run. If it is possible, I would also like to display a flag image on the button when it is right clicked. Thanks.

Read the [Swing Tutorial|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html]. It answers these questions and more.
If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

Similar Messages

  • Using images with Transparency in Photobooks

    I'm to a point where I would like to use images that utilize transparency in Aperture photo books. Is this possible? So far, PSD files that I've cropped with PS's lasso tools to have transparent areas surrounding their subject tend to change this area to white when dropped into a book.
    Does anyone know of a way or format to use to retain this transparency? I love the speed of Aperture's photobook tools, along with export and printing options, and would like to be able to layer images that bleed together, or have a cut-out subject on top of others, but I haven't noticed a way as of yet.
    Is this ability even available in Aperture yet?
    If not, is there a third party plugin that gives it to the user when making photo books?
    Please let me know soon, else i'm going to have to adjust my workflow back to photoshop only for page set layouts and the created PSD files on blank book pages- not fun.

    i have been trying different ways to make it work fine, and find several things to consider:
    Note: for the next ways i tried with images with transparency.
    1 searching images in the iPad with safari and saving it into Photo app
    then copying it with the popup and pasting it with the popup inside Pages or Keynote:
    work fine.
    2 using the saved images that worked fine in the first way but
    then inside Pages in my opened document, using the menu to import the image from the
    Photo app, to insert the same downloaded image used in the first case:
    does not work, the image appears with a white background.
    3 trying the first way (manually copying and pasting) but with the images i imported from
    my MacBook Pro using the normal way via iTunes(10.1.1 (4))
    does not work, some images appears with a black background, other images
    appears with a white background.
    4 trying with the images of the third way, but changing the method using the photo app
    menu from Pages
    does not work as in the third way
    i dont have problem using transparency images in the first complex way.
    my problem is when i try to use images with transparency in the other three normal ways.

  • Use images with instant alpha in smart build?

    I have a few logos with solid backgrounds that I would like to use in a smart build with the backgrounds removed. I can put the logos in the smart build with and I can also remove the backgrounds using instant alpha. I cannot figure out how to put the logos with the background removed into the smart build. Perhaps this is not possible since the instant alpha effect is non-destructive and doesn't truly change the image file? Any help or suggestions would be appreciated.

    Check this thread.
    http://discussions.apple.com/thread.jspa?messageID=6497364&#6497364
    What you have to do it "set" the image WITH the Instant Alpha before using it in a Smart Build.

  • Using images with transparent backgrounds

    Hello. I'm trying to design several forms using a large background graphic along with several other overlays (defined by the form user) that contain transparent backgrounds. Unfortunately, everytime I go to change the graphic, the program won't recognize the transparency of the overlay and substitutes white in it's place. So, for example, I have a background image that is rectangular and when my form user selects an overlay that is circular, it inserts the circle with a white background (which is supposed to be transparent). Can anyone help me with this?
    Thanks!
    -Mike

    Min required version of flash player for my application is 9..
    I think I figured it out, Here is my solution:
    private function completeHandler(evt:Event):void
       var originalWidth:int=loaderG.content.width;
       var originalHeight:int=loaderG.content.height;
       var scale:Number = 0.5;
       var matrix:Matrix = new Matrix();
       matrix.scale(scale, scale);
       myBitmapDataObj=new BitmapData(originalWidth, originalHeight, true, 0xFFFFFF);
       myBitmapDataObj.draw(loaderG.content, null, null, null, null, true);
       var copyBitmapData:BitmapData= new BitmapData(originalWidth* scale, originalHeight* scale, true, 0x000000);
       copyBitmapData.draw(myBitmapDataObj, matrix, null, null, null, true);
       var myBitmapG:Bitmap=new Bitmap(copyBitmapData,PixelSnapping.AUTO,true);
       addChild(myBitmapG);
    I also try blur filter on my bitmap:
    var blur:BlurFilter = new BlurFilter();
       blur.blurX = 1.4;
       blur.blurY = 1.4;
       blur.quality = BitmapFilterQuality.HIGH;
       myBitmapG.filters = [blur];
    Or is there better solution?

  • Using images with matching quiz.

    How are images added in a matching quiz?  can't find the answer anywhere?
    thanks!

    Hi there
    You click Insert > Image just like any other slide.
    Then again, they will also behave as they do on any other slide. You may place them for reference, but you cannot click them and drag them. You would also want to avoid using the Shuffle Answers option.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Disjointed rollovers using images w/transparency

    Hi all!
    I am trying to build a configurator which will allow me to change different elements (colors) of an object (like a car). In order to do this cleanly and properly, I'd need to use images with transparency, like a PNG/GIF file.
    1. Is it possible to use tranparent files for this purpose?
    2. Will I be able to overlap images? For example, if I want the wheels a different color than the body, the images will need to overlap even though they're rectangle shaped essentially (which is why I'd need to use transparency).
    3. Is it possible to do this using all CSS?
    4. Are there any tutorials out there available?
    Thanks in advance!!

    I've only seen this done with Flash. 
    Example, click "see colors" for a demo
    http://www.chevrolet.com/corvette-grand-sport-convertible/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • I am using a Photoshop cs2, and I wonder if it is possible to keep the settings of the guidelines when closing an image, with the actual document ? It would be nice to have the guidelines locked down, I find it than when opening the same or another image,

    I am using a Photoshop cs2, and I wonder if it is possible to keep the settings of the guidelines when closing an image, with the actual document ? It would be nice to have the guidelines locked down, I find it than when opening the same or another image, the guidelines are not locked, it is annoying to have to lock them down again. and it would actually be nice, to ba able to give specific directions when placing the guidelines. Thanks

    Then why are the guides unlocked when I reopen a document that I saved with the guides locked ?
    Thanks.

  • Using Printable with an Image 5TH POSTING

    I am trying to print out an image with the following code:
    public class print_panel extends JPanel implements Printable{
    Image the_image;
    public print_panel(Image i){
    the_image = i;
    public int print(Graphics g, PageFormat pf, int p) throws PrinterException{
    if(p>=1) return Printable.NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D)g;
    g2.translate(pf.getImageableX(), pf.getImageableY());
    g2.drawImage(the_image, 0, 0, null);
    paint(g2);
    return Printable.PAGE_EXISTS;
    }//end class
    All the printer does is spit out a blank sheet. I can get this to work with a swing component, such as a JButton, but somehow it will not print out an image. What more needs to be done?

    Hello
    I struggled with the same problem. In the Graphics2D Forum is a thread that solved the issue for me (http://forum.java.sun.com/thread.jsp?forum=20&thread=160408).
    It seems that Graphis2D.drawRenderedImage(RenderedImage img,AffineTransformation at) is the trick to let the printer know...
    Hint: BufferedImage is a implementation of RenderedImage.

  • Using still images with Final Cut (and the apple suite in general)

    I have had a re-occuring and long term problem that has caused me many lost hours of head scratching and work arounds, and as of yet I have not been able to come up with a good solution.
    Its to do with integrating still images with the Final Cut suite.
    If I receive a high quality image from a client to use in their video and I then try importing it into Final Cut and animating it, it always ends up looking like a pile of ahem. Often I will get "swimming" lines appear across fine detail on the image, and parts of it will flicker as it moves across the screen. For instance, if I have a picture of some blinds or other fine detail (especially horizontal and vertical lines), when I add a grow and throw movement to it the detail will become very noisy - buzzing and flickering like mad.
    I have found I can counter this by resizing the image in photoshop to a resolution closer to SD video (700w or 500h) - but I always end up losing detail, and the flickering and noise is only reduced, not eliminated. Other things that have helped are blur effects applied at a very low level, like 0.5 blur, so its not noticeable visually, but Final Cut seems to treat it differently and quieten the noise and flicker down.
    However, all of these workarounds are ultimately still giving a reduced quality product.
    Also, this problem is not necessarily constrained to Final Cut, I am currently fighting DVD Studio Pro because it is murdering the text quality in a stills slideshow I am creating - and in this situation there is no animation being applied. No matter what file type (psd, jpeg, tiff, png...) or size I output the text and images from Photoshop in, the moment DVD studio pro gets hold of it, it turns to cripe.
    For a while I was putting it down to the fact that I usually edit in SD (PAL) formats, and there just wasn't the resolution available to reproduce fine detail. However, I do often see other people achieving pin-sharp fine detail on still images and text in SD formats (the Apple templates are a good example)
    So, my question to you, oh great and high boffins, if you are dealing with still images and text, how do you do it? How do you work around any noise problems you have, and how do you produce those pin-sharp images (both moving and still) I see in other professional productions?
    Quad G5   Mac OS X (10.4.8)  

    still images with too high a resolution will always cause problems. this is due to the detail of the image being finer than the scanline of the tv can display ... obviously this will caise the image to flicker as these details alternately appear and disappear as and when the scanline can display them. as you have discovered, the answer is to apply a very small blur, the effect being that the detail is spread by the blur such that the scanline can dislay it correctly.
    text issues are often rooted in the same problem ... unless the text is placed very carefully (whole even number on the y axis) then the quality may be impaired due to the resulting interlacing/scanline issues

  • I had this video file and I was trying to flip it to a format that would work with iMovie.  It used to have the Quicktime image with it.  So, I assume it was a QT file.  But, somehow I've changed the file from a video to a folder.

    I had a video file and I was trying to flip it to a format that would work with iMovie.  It used to have the Quicktime image with it.  So, I assume it was a QT file.  But, somehow I've changed the file from a video to a folder.  I've tried to undo the action.  No luck.  I wasn't running my Time Machine.  So, I can't go back.  Help.  It's the only copy of this video.

    I've tried to undo the action.
    How?
    Please detail ALL you have done so far in the way of troubleshooting?   Need this info to avoid the been there done that scenarios.
    it's the only copy of this video.
    Where did you get the video from?
    From the pic I noticed that the folder is 841.9mb.  What's inside?  Or what happens when you click on it?

  • Using Image Capture to scan with Canon Pixma MX700

    I previously had trouble connecting my Canon Pixma MX700 to my MBP, but soon figured out that I needed a new high speed USB 2.0 cable, versus the old one I was trying to use it with. Doh!
    So now it prints without any trouble at all, and I know that all its features - printing, scanning, fax, copier, are supposed to be compatible with Leopard.
    However, I'm still having issues scanning. I Googled and found a comment somewhere that with this specific model, one has to use Image Capture for the scanning portion, instead of the Canon software.
    Great, so that explained the problem I was having trying to figure out how to GET it to communicate at all with the MBP (downloaded the latest scanner driver from Canon with no result).
    But it still will not scan with Image Capture. Communication is fine- the image is detected and I can see it perfectly in the Image Capture window, am able to change options, etc. Once I drag and select the image I want to scan and click the scan button, nothing happens. Or more specifically, the button will be click-able and for about two seconds it appears to be working (with the scan button substituted by a cancel button), but then the scan button will pop back up and nothing appears in the folder I specified the image to be saved to.
    Now I'm completely stumped. What am I doing wrong?
    Thanks!!!

    With my MacBook running Leopard, I had been able to successfully scan multiple images by pressing the MX7000 scan button and capturing the images with MP Navigator. The MX700 is networked over WiFi. Early on, I learned that it seemed to be more reliable to drive this process using the scan button, rather than trying to initiate the scan from the MP Navigator UI.
    However, recently things stopped working, and after the first image was scanned, subsequent scans would fail, with MP Navigator complaining about not being able to connect to the scanner. This sounds similar to the problem described in the original posting.
    I went to the Canon USA support site and downloaded /installed the latest versions of the MX700 scan driver (13.9.0) and MP Navigator (1.0.4), both available under the "Drivers and Downloads" section for the MX700 support page (be sure to select "Mac OS X" from the pull-down menu).
    http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&tabact=SupportDeta ilTabAct&fcategoryid=238&modelid=15651#DownloadDetailAct
    The new updates seem to have solved the problem, and I can now scan multiple images one after the other. Again, I always initiate the scan from the button on the MX700, and always capture using MP Navigator, which has the really nice feature for creating and editing multi-page PDFs.
    Message was edited by: donbondio

  • How do I crop an image with a Clipping Mask using a circle instead of a rectangle?

    I watched Adobe TV Illustrator's tutorial about cropping images with a clipping mask. In the video, the presenter uses the rectangle tool with the clipping mask, and makes a reference that the circle or vector shape could be used, but I cannot figure out how to get the circle. 
    http://tv.adobe.com/watch/learn-illustrator-cs6/cropping-images-with-clipping-masks/
    I'm new to Illustrator and need step by step instructions!
    Thanks!

    Christine,
    As Larry said, and as I said in the first post:
    For a Clipping Mask, you just create a path, in this case a circle, and place it on top of the image, then select both and Object>Clipping Mask>Make.
    You can see the shortcut when you use the dropdown; it is Ctrl+7 for Windows.
    At least in the old days, you could also use Alt/Option+O+M+M (easy to remember, Object>Mask>Make).
    It is easy to skip/overlook the exact steps.

  • Instead of using image in a link column can we have button with name?

    Hi,
    In Apex , in report region instead of using image in a link column can we have button with name?
    Thanks,
    Anoo..

    From your wording, it sounds like you used the built-in column link within APEX. You will need to edit your column and remove that so that the column is only containing the definition that is coming from the query (you can also just change the alias used for the column and then the old column with the link will be removed and the new alias will be added against your new button column).
    -- Sharon

  • I use images for presentations. Recently I've noticed a decrease in quality ( sharpness and definition) of pictures copied into Keynote. Same problem with both JPEGs and TIFF files. I've recently upgraded to keynote 09, but with no improvement.

    I use images of paintings for presentations. Over the last 3 months or so I've noticed that I cannt copy images (either JPEg or TIFF) without a reduction in sharpness and definition. Hope someone can help with this problem.

    Figured it out myself! yay!  (only took my entire moring)
    The solution:
    Dont print to PDF!
    SAVE AS COPY, then select Adobe PDF and click SAVE, this will bring up a dialog box with the options you need (including the "High Quality Print" Adobe PDF Preset)
    This was not clear in any of the instructions i read

  • Using RAW images with CS6

    Hi - im not sure if there is another forum that answers this question.
    So far the only way I have been able to open up a RAW image in photoshop which then automatically launches camera RAW is by going to finder > iphoto > open package contents - to find the original file. Ive been told that can possible damage/corrupt yout image library. Is there another safe way to deal with RAW images? Right now iPhoto will open a raw image with photoshop the problem is it throws it over into PS and claims its a JPEG.
    Maybe im just not as educated as I need to be with the Apple software.
    Thanks in advance!
    J

    Set ACR as your preferred editor in iPhoto
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> Advanced -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor.
    Then check the box underneath 'Use Raw when using external editor'
    Now your Raw will be sent there.
    But getting it back is a bit of a kludge
    You cannot save a Raw. The work you do must be output to a new file, in a new format (jepg, tiff, whatever). However, as the External Editor is making this new file iPhoto has no knowledge of its existence. Therefore you must save it to the desktop and then import it back to iPhoto as a new file.
    This means that you will have your Original Raw and the processed version in iPhoto but they will not be recognised as version and original. iPhoto will see them as two separate shots.

Maybe you are looking for

  • MDM7.1 Relationship Tables

    Hi  Everyone, We are working on MDM 7.1 and we have 3 different main tables. We have a scenario to import relationships between different remote systems. The records from both the remote systems are maintained as company. But we are trying to import

  • Problem with database resource manager.

    Hello to all, I am using 10.2.0.1 I am enterprise manager to assign user scott and hr to 'appuser' consumer group. I created a plan which specifies that appuser consumer group will be switched to sys_group after executing for 1 minute, but it is not

  • Importing from a hard disk

    i have various song playlists on a hard disk, numbered etc. BUT when I import these to iTunes on another computer, the order goes completely berserk. No separation is respected, the wednesday playlist is partly copied for monday, etc. etc. What can I

  • Solaris 9 - INIT: Cannot create /var/adm/utmpx (System Hangs)

    Hello, I am unable to boot into solaris 9 after I did a init 0. I did init 0 because shutdown -y -g0 -i0 did not work. This is the error message I get Hardware watchdog enabled INIT: Cannot create /var/adm/utmpx INIT: failed write of utmpx entry:" "

  • Convert Oracle SQL query to single column output

    Hello All, I need to build the query to have multiple columns in a single column with multiple rows. select a.customer_trx_id,a.previous_customer_trx_id from ra_customer_trx_all a where a.customer_trx_id = :customer_trx_id here, a.customer_trx_id and