Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    50
    Thanks
    4
    Thanked 4 Times in 4 Posts

    Why did my form get bigger?

    For some reason, the form I see in my Design view inside Netbeans doesn't look the same as when I run the project. The buttons are much bigger, and the alignment looks way off. It's like it has a different format.

    I'm not sure how to explain the issue other than that. I was hoping someone might have that old "oh yeah, here's what happened" solution.

    Thanks to you if you do.

  • #2
    New Coder
    Join Date
    Sep 2009
    Posts
    50
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Here's a picture of design-preview (left) run-time (right):



    Any ideas why they'd be different?

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,133
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Different font sizes? If you don't specify your font sizes using absolute pixels (e.g., font-size: 12px; ) then the browser chooses the size based on other considerations.

    And, really, you should *NOT* use absoute font sizes. If you do so, you make your sight inaccessible to, for example, people with vision problems. So long as you use the *recommended* relative font sizes (e.g., x-small, small, medium, etc.) then the user can change the text size via his/her VIEW menu and maybe actually read the stuff that you otherwise made too tiny to see.

    One of the BIGGEST mistakes you can make is designing a site down to the very pixel. It may make a pretty site, but it can also make an inaccessible site. I understand that inaccessible sites are technically illegal in some countries, even. (Not, so far, in the USA, but don't be surprised if that changes.)

    Anyway, *NEVER* trust the view of your site that you get from some designer program. Always actually look at the site with a browser. And, even better, always look at it with as many browsers as you can. I'd recommend a *minimum* of looking at it with MSIE 7, MSIE 8, FireFox, Chrome, and Safari. You'll surely still find difference between them, but with good overall *flexible* design, the site should look good in all of them.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New Coder
    Join Date
    Sep 2009
    Posts
    50
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Thanks for the response. This isn't a website, it's a desktop app. The picture is putting the two windows side-by-side. The first window (left) is what I see when I click the preview button of the JFrame Design view withini NetBeans. The second window (right) is what I see when I select the "Run Project" within NetBeans.

    The wierd thing is that I had looked like the window on the left for quite a while. I added a couple items to the form and changed some alignments, then it started showing up like on the left. But why wouldn't it show up that way in the preview?

    I'm not worried about accessibility in this anyways, because it's solely for myself as a simple admin tool for something. I just think it's strange that it changed like it did. I just started another app to test something out, and it's also showing up differently. I obviously changed something, but I truly can't figure out what I did...It's frustrating me though, because I want to see what the app's going to look like as I'm designing it.

    Hmm..

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    One is metal and the other is windows themed from the looks of it.
    Change you're ui theme using the ui manager. Follow this tutorial to make the changes: http://java.sun.com/docs/books/tutor...feel/plaf.html
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    FlyingRat (01-02-2010)

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,133
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    I noticed the difference in the "skins" but attributed it to diff between the tool and the browser. DOH on me. Good catch, as usual, Fou-Lu.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by Old Pedant View Post
    I noticed the difference in the "skins" but attributed it to diff between the tool and the browser. DOH on me. Good catch, as usual, Fou-Lu.
    Yeah, I wasn't quite certain when I was looking at first myself. I seem to recall that the windows theme was a little... yellower than the metal was. The only part that clued me in was the curvature in the buttons on the windows themed one. It could be the use of the vista that causes that though, my windows theming is limited to the xp apps. I wonder why it is that the preview selects that as its running gui, but doesn't pack it in? Perhaps the OP could post back whether the change was what fixed it.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #8
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    In the OP's application, the Look and Feel was most likely not set. When using Netbeans for Windows, the default Look and Feel is WindowsLookAndFeel. However, when you run the application, Java defaults to the Java L&F (CrossPlatformLookAndFeel). Thus, you will get differences between the L&Fs of the IDE's preview and the actual Java app.

    Two solutions exist:


    -Shane

  • #9
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    Pulling from old memories, but doesn't the pack() method of the Window class resize your frame to fit its contents? If you set your preferred sizes up carefully for your components, this may help to keep the sizing consistent under different L&F settings.


  •  

    Posting Permissions

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