Reputation: 351
I have been using jFrame to build a GUI. I had to insert images in the GUI, for which i inserted a label and put the image as an icon for the label. Now, i have to find out the position of the image in terms of the x and y co-ordinates and i am unable to do that. I have used
setLocaction(x,y);
but it still doesn't seem to work. I even disabled the layout manager by using
setLayout(null);
What is the possible solution for this problem?
Edit
Basically i am creating a Solar system GUI using Swing, so the positions of the planets are to be set by me. I being new to java, there is being some difficulty in implementing the layouts.
Upvotes: 0
Views: 175
Reputation: 285405
This isn't a layout issue at all, but a drawing and possibly an animation issue. If this were my project, I'd
paintComponent
method.HashMap<Plant, Image>
. Upvotes: 2
Reputation: 2091
With null layout you should use setSize
and setLocation
methods on you label to get your image visible correctly inside your frame.
Upvotes: -1