DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2005
    Posts
    13

    JButton 3d effect

    Hi, somebody knows how to make JButtons show flat, and then become 3d when the mouse is over them?

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    The JButton inherits the mouse events and listener methods of java.awt.Component and javax.swing.JComponent. So - create a mouse listener which listens to mouse events in relation to the JButton of interest One of the mouse events which are available is entering (MOUSE_ENTERED) or leaving (MOUSE_EXITED) an unobscured portion of your component. Upon these events you can trigger a change in the appearance of your JButton.

  3. #3
    Join Date
    Jun 2005
    Posts
    13
    cheers man!

    Going to give it a try.

  4. #4
    Join Date
    Jun 2005
    Posts
    13
    I have been trying to add this mouse listener. Is there any property of JButton in order to make it 3d or 2d? I have been searching in java docs, but didnt find anything. Thanks!

  5. #5
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Swing does not provide 3D functionality internally.

    Take a look at http://code.j3d.org/ for information about a 3D graphics library.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links