CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    How to position widgets

    When putting widgets like JList or Jbutton on containers like Jpanel , how does one set position as to where they are displayed ,

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: How to position widgets

    If you don't want to use one of the layout managers, Remove the layout manager and use one or more of the JComponent methods to set the components position.
    Norm

  3. #3
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    Re: How to position widgets

    which method to call to remove default layout manager ( flow layout ) , and which method of JComponent
    to set position .

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: How to position widgets

    Have you read the API doc for the JComponent class to see what methods could be useful?
    Are there any that deal with the layout manager or the location and size of the component?
    Norm

  5. #5
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: How to position widgets

    which method to call to remove default layout manager ( flow layout )
    My advice is don't do this. There are very few occasions where you need to manually position components - in all my years of programming in Java I never yet had a situation where I can't get a layout manager to do the job for me (admittedly I had to write my own layout manager on a couple of occasions but it's not that hard to do).

    Using layout managers may seem a little complicated at first but once you get the hang of them the benefits are more than worth the effort.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured