Results 1 to 6 of 6
- 10-27-2009, 11:22 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 56
- Rep Power
- 0
- 10-27-2009, 12:03 PM #2
Could u send the code withj codetag so that we can see and give solution?
Ramya:cool:
-
The best way to set the location of JPanels and other components is to let the layout managers do the heavy lifting for you. I recommend (if you haven't done so already) that you have a look at the layout manager tutorials. Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
- 10-27-2009, 06:24 PM #4
Senior Member
- Join Date
- Jan 2009
- Posts
- 119
- Rep Power
- 0
Hello,
true Furable is right!!!
you could try using : FlowLayout, GridLayout, BoxLayout They are easy to use.
- 10-27-2009, 07:07 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,412
- Blog Entries
- 7
- Rep Power
- 17
... on the other hand: suppose the OP wants to create a card game where the cards (JPanels with an image) float around freely in their parent container. Remove the LayoutManager from the parent container and whenever a JPanel is repositioned call revalidate() on it.
kind regards,
Jos
- 10-27-2009, 07:24 PM #6
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,143
- Rep Power
- 5
Only component using LayoutManagers require the use of revalidate(). If you don't use a LayoutManager then you are responsible for setting the size/location of the component. That is why the recommendation is to always use a layout manager so you can invoke revalidate() and you don't have to worry about all the minor details.Remove the LayoutManager from the parent container and whenever a JPanel is repositioned call revalidate() on it.
Similar Threads
-
location provider returns no location
By sandeeprao.techno in forum CLDC and MIDPReplies: 0Last Post: 09-24-2009, 09:54 AM -
File Location
By bcbird in forum New To JavaReplies: 1Last Post: 09-17-2009, 08:03 AM -
weird location of ovals
By diggitydoggz in forum New To JavaReplies: 6Last Post: 12-24-2008, 12:25 AM -
how to get the location of some button
By mary in forum Java 2DReplies: 2Last Post: 08-05-2007, 04:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks