CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    Dec 2011
    Posts
    26

    Re: JTextField-Text Access

    actually earlier i used "BorderLayout"....
    but i put all my 3 buttons in south....
    but i got only 1 button covering the whole south part of the frame....
    and when i maximise my window it showed me all the buttons....
    so that's why i decided to move them by myself....

  2. #17
    Join Date
    Dec 2011
    Posts
    26

    Re: JTextField-Text Access

    and i used them on JPanel....

    Code:
    panel1.add(tfield1,BorderLayout.PAGE_START);
    i used this code....and i'm getting a flowlayout....

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

    Re: JTextField-Text Access

    With BorderLayout you can only put one component in any one region. If you want to add more than one component to a region you have to add the components to a container component such as JPanel and add the container component to the region.

    So, if you want to add 3 buttons to the SOUTH region then you need to add those 3 buttons to a JPanel and add the JPanel to the SOUTH region. There are a number of layout managers you could use in the JPanel to layout the buttons but FlowLayout with a center alignment and small inter component spacing is probably the one you want. ie

    Code:
    new FlowLayout(FlowLayout.CENTER);
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  4. #19
    Join Date
    Dec 2011
    Posts
    26

    Re: JTextField-Text Access

    got it....thanks a lot....

Page 2 of 2 FirstFirst 12

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