CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Gui application

  1. #1
    Join Date
    Aug 2009
    Posts
    78

    Gui application

    Hey

    I wrote an gui application in java .
    The application work fine in the resolution of 1280X800.
    But if i change the resolution for 1024X768 , the application is not shrinking , and cut from the right side.

    How do i fix my application for the resolution?

  2. #2
    Join Date
    Apr 2007
    Posts
    442

    Re: Gui application

    Can you tell us anything of how did you layout it, what components it contains (eg. scrollpanes and such)? Basically when layout is sensible, Swing components should adapt to window size changes neatly.

  3. #3
    Join Date
    Aug 2009
    Posts
    78

    Re: Gui application

    I am using free design layout.
    The component inside are jpanels .

    I wrote this code

    _instance = new MainFrame();
    _instance.setExtendedState(MAXIMIZED_BOTH);


    and its still didnt help,the panels are still flowing to the right side.

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

    Re: Gui application

    By free design layout I take it you mean you aren't using a layout manager.
    If that is the case then you are responsible for resizing and repositioning the components to fit the Window size that is available to you.

    The advantage of layout managers is they auto position and auto size components when the window size changes but if you don't want to use them (and I've never understood why people don't want to use them - except maybe in a few very specialised cases) then you have to write this code yourself.

    I'm not sure how the setExtendedState computes it's maximised value (I 've no time to investigate now, but if no one elses provides confirmation in the next few hours I'll look into it) but if it's based on the size of the components rather than the size of the screen and you aren't using a layout manager then that's probably why your app is not sizing to the screen.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Gui application

    If you could post some sample code that demonstrates the problem, perhaps we could be more specific.

    When you say you are using 'free design layout', what exactly do you mean? Did you set the layout manager to null?

    Bad code isn't bad, its just misunderstood...
    Anon.
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  6. #6
    Join Date
    Aug 2009
    Posts
    78

    Re: Gui application

    My mistake, i just saw that in free design layout , the netbeans designer uses Group layout.



    For dlorde :
    I created jframe (single tone ) , in the jframe using group layout to fill with jpanels.
    What code exacly you want to see? (there is more then 1000 lines only in the jframe)
    Last edited by inmar32; February 8th, 2010 at 06:07 PM.

  7. #7
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Gui application

    Quote Originally Posted by inmar32 View Post
    I created jframe (single tone )
    Single tone? what does that mean?

    What code exacly you want to see? (there is more then 1000 lines only in the jframe)
    As I said, it would be useful to see sample code that demonstrates the problem. Not necessarily the full application code, but a simple, minimal but complete example that demonstrates the problem.

    ETA - wait, 'single tone' == 'singleton' ?

    If you want truly to understand something, try to change it...
    K. Lewin
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

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