Image Button


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
    possible?


  2. #2
    Paul Clapham Guest

    Re: Image Button


    Rocco Balsamo <rbalsamo@hillier.com> wrote in message
    news:3922D43D.8E712E15@hillier.com...
    > 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----------------------------
    JButton

    public JButton(Icon icon)

    Creates a button with an icon.
    Parameters:
    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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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