DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Image Button

  1. #1
    Rocco Balsamo Guest

    Image Button

    Is there any way to place an image on a Button? Or is this not

  2. #2
    Paul Clapham Guest

    Re: Image Button

    Rocco Balsamo <rbalsamo@hillier.com> wrote in message
    > Is there any way to place an image on a Button? Or is this not possible?

    Copied from the documentation for class JButton:
    -----------------start copy----------------------------

    public JButton(Icon icon)

    Creates a button with an icon.
    icon - the Icon image to display on the button
    -----------------end copy-----------------------------

    However, if you can't use Swing the answer appears to be No. But I suppose
    you might be able to create a class that extends Button by making the button
    transparent or invisible or something (override the paint() method to do
    nothing?), placing the object of your class on top of your chosen Image, and
    getting button clicks when the user thinks they're clicking on the image.
    Haven't tried this myself, just an idea.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.