I need help on something


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: I need help on something

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    I need help on something

    Hello

    I'm new here.

    I was just wondering if anyone knew how to put buttons overtop of an animated series of images in Java?

    I would really apreciate it...

    its a JApplet I am working on btw.


  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Extend a JPanel for drawing. Set its LayoutManager to null. Create your buttons and
    issue a setBounds(x,y,width,height) for each of them before your to place them on the excact spot on your panel by a simple thePanel.add(button);
    Important:
    Do all your draiwing by overriding the JPanels paintComponent(Graphics g) method. Don't 'paint' the buttons, they will be placed on top og the drawing after the paintComponent method exits.

    Good Luck !

    PS: you can animate (move) the buttons by calling the buttons' setBounds and then the panel's validate/repaint method.
    Last edited by sjalle; 01-07-2006 at 09:48 AM.
    eschew obfuscation

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