CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Location
    Ho Chi Minh, Vietnam
    Posts
    126

    GUI, component locked to grid

    Hey,
    I'm new to Swing GUI. I'm using Eclipse Ganymede to create simple GUI, just some buttons and text field on a JFrame. However, during the WYSIWYG, I cannot place the button freely, it must be either locked to some orientation (East, Center, North, South...) and make the button big and ugly. Anyway to turn that thing off.
    Thanks.

  2. #2
    Join Date
    Apr 2007
    Posts
    442

    Re: GUI, component locked to grid

    If you aim to free yourself from any "gui designer" -tools, which is recommendable, there really is no other way around it, but pick up the spoon, and learning to Swing.

    All of this is rather throughly explained in Suns Swing tutorials, those should be the first place to look. Basically You have the flexibility of building your gui-puzzle of as many panels you like, each having the kind of LayoutManager you choose. The outlook, such as how the button looks and behaves in the layout, is in an optimal case quite completely down to the LayoutManagers you use.

    Then also, you have the option of using absolute placement. This however, is rarely suited and should not be any kind of stamp case to "get what you want". Combined use of LayoutManagers gets you to places in 99% if your likely cases, rest assured.

    Heres some kind of entry level package:

    BorderLayout
    FlowLayout
    GridLayout
    BoxLayout

    Also remember to check up non layout related gui management, such as Borders.

    These are enough for most of the common place issues. More flexibility, and hence more coding, is involved in other managers, such as the following

    GridBagLayout
    SpringLayout
    MigLayout
    FormLayout

    Then can provide a move concise way to describe a specific layout need. In the most used cases the coding can be stored in library classes for each layout, these would then provide you convinience methods resulting in the desired layout.

  3. #3
    Join Date
    Oct 2004
    Location
    Ho Chi Minh, Vietnam
    Posts
    126

    Re: GUI, component locked to grid

    Hey, tks for the reply, I'll give myself a treat on ur suggestions. For the time being, I'm quite satisfied with the plug-in "visual swing" http://code.google.com/p/visualswing4eclipse/ it does exactly what I want, put the component anywhere on the form (put here for anyone who might faced the same problem). I remember such thing has been done by NetBeans, hasn't it?
    Cheers.

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