Results 1 to 3 of 3
  1. #1
    The_L is offline Member
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    0

    Cool Problems with ImageIcons

    Hello everybody. I am new here and relative newbie on Java.
    I have done an almanac with ImageIcons. One for each day. I used drawImage method. I used Over them I have used drawString method to print the date. Is it possible to get the ImageIcons clickable? I canīt use actionListener, but I can use a mouseListener on the panel where the imageIcons are lined up. But then I have to calculate witch imageIcon I was clicked wigh getX() and getY() method.
    Is there any simplier way to do this?

    //The_L

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,767
    Rep Power
    20

    Default

    You can use JButtons with icons and text, probably in a GridLayout. Then you get to use ActionListener and don't have to calculate which was clicked.

    To get a 'plain' appearance for the JButtons you can
    Java Code:
    setBorderPainted(false);
    setFocusPainted(false);
    setContentAreaFilled(false);
    db

    db

  3. #3
    The_L is offline Member
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    0

    Default

    Yes, that is one solution. Mayby I canīt get the what i want with the ImageIcons. Thankīs for the reply! :)

    //The_L

Similar Threads

  1. Problems in JSP : Need help
    By raj4u in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-07-2008, 11:06 AM
  2. GUI problems.
    By saytri in forum New To Java
    Replies: 1
    Last Post: 12-16-2007, 11:27 PM
  3. many to many problems
    By cecily in forum JDBC
    Replies: 1
    Last Post: 08-02-2007, 05:51 PM
  4. gui problems
    By bluebirdjc in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 05:38 PM
  5. a few problems
    By gary in forum AWT / Swing
    Replies: 0
    Last Post: 07-11-2007, 04:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •