Hello, i'm using a Jpanel, I am using an image as background . On top of that i want to put buttons on it. The problem is I cannot repostion the buttons? can anyone help me here!!??

Hello, i'm using a Jpanel, I am using an image as background . On top of that i want to put buttons on it. The problem is I cannot repostion the buttons? can anyone help me here!!??

There's no reason to be shy. Post your code so we can help you out.

hi Zyaday,
using setBounds() method
first set the layout of panel as none.
syntax:

button_name.setBounds(int x,int y,int width,int height);

example:

JB_ClickMe.setBounds(20,25,150,20);

hi Zyaday,
using setBounds() method
first set the layout of panel as none.
syntax:

button_name.setBounds(int x,int y,int width,int height);

example:

JB_ClickMe.setBounds(20,25,150,20);

You could resort to absolute positioning, but in the event that the Panel is resized you may want to use a layout.

I'd suggest looking up the following in google--

Java class LayoutManager

--LayoutManager is really an interface, not a class... but nonetheless it will show you the multiple types of Layout Classes that implement the interface and will help you determine how you want your buttons to look on your Panel.

commented: Good help done :) +3

heyyy Alex its working thanks you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.