Trouble with JFrame Sizes, background always seem to be exposed

I must be misunderstanding how this pack() and setPreferredSize() thing works. Basically I have a JPanel, which I draw a blue background in. I set it up so that it is a gridLayout.
super(new GridLayout(GRID_ROWS, GRID_COLS, GRID_SPACE, GRID_SPACE));
setPreferredSize(new Dimension(GRID_COLS * CELL_SIZE,GRID_ROWS * CELL_SIZE));to me this means I have a gridlayout of squares.
then I add JLabel "blocks" to this gridlayout, so that it will look like a maze. I set the preferred size of the JLabels to CELL_SIZE. So I would think everything would fit nicely. Then I insert this JPanel onto a JFrame. I also add another JPanel (ButtonPanel) to the bottom of the JFrame, and this seems to screw everything up.
First off, am I doing this setPreferredSize() stuff right. I was under the impression that I should set the preferredSize() of all the subcomponents, and then on the larger component, one that I really don't have a preferredSize() for, I just pack() it, and that will shape around the limitation of the subcomponents.
Secondly why doesn't this ButtonPanel just scale to the size of the maze? Why does it have to stretch it out, so that my, once square looking JLable blocks, look like rectangles? Is there a way short of setting the PreferredSize(some_number_of_pixels), that is more elegant that will make the ButtonPanel behave?

No takers? really any ideas about why this might be please let me know. I have a feeling it is a somewhat simple concept, but I'm just missing the point or something.

Similar Messages

  • Trouble with image size

    Hello everyone, I'm having some trouble with image sizes.
    I created a 977x5000 px image at 72 PX/inch resolution with text for use on a weebly website.
    When created the image looks like a small vertical bar(maybe around 50x500px) with a massive left and right photoshop background(not the image background). so if I drag the bottom slider to the left or right the image will completely disappear.  I can CTR and + to get it to the correct size so I can actually read the text. I can still go very far left and right with bottom slider. The problem comes in when I save it to a PNG or other file it still shows up as a bar.
    Is there any way to fix this so it saves it as the correct viewing size? that way when I open the image it's an actual 977x5000 instead of looking like a 50x500
    I'm on Windows 7, my display settings are at 100% and I'm using Photoshop  CC 2014

    You do not understand what is going on at all. First an image file's PX/inch resolution setting is meaningless when it come to the Web and displays all that is meaningful is pixels.  For displays are run at one resolution usually their native manufactured Pixel resolution so your image will be displayed at 96DPI on Desktop Displays and a 300+DPI on Phones and around 250DPI on tablets.  Your image  height is also to large to fit on any display.  The Display I think that displays the most pixels is the IBM T221 22.2" LCD 16:10 aspect ratio 3840px by 2400px.  at 204DPI.  Rotating  that display to portrait it can display an image with a height of 3840px your image height is larger 5000.  Your image has an aspect ratio in the neighborhood of 1:5  an image 50x500 has an aspect ratio of 1:10 a far cry from 1:5 your image is much wider then 1:10.
    IBM T220/T221 LCD monitors - Wikipedia, the free encyclopedia
    Most common display resolutions in the first half of 2014
    Acronym
    Aspect ratio
    Width (px)
    Height (px)
    % of Steam users
    % of web users
    SVGA
    4:3
    800
    600
    00.08
    00.64
    WSVGA
    ~17:10
    1024
    600
    00.17
    01.59
    XGA
    4:3
    1024
    768
    02.85
    09.84
    XGA+
    4:3
    1152
    864
    00.34
    00.85
    WXGA
    16:9
    1280
    720
    00.93
    01.65
    WXGA
    5:3
    1280
    768
    00.52
    01.09
    WXGA
    16:10
    1280
    800
    02.44
    08.90
    SXGA– (UVGA)
    4:3
    1280
    960
    00.35
    00.48
    SXGA
    5:4
    1280
    1024
    07.05
    05.74
    HD
    ~16:9
    1360
    768
    03.00
    02.43
    HD
    ~16:9
    1366
    768
    24.53
    26.64
    SXGA+
    4:3
    1400
    1050
    00.10
    n/a
    WXGA+
    16:10
    1440
    900
    05.74
    05.95
    HD+
    16:9
    1600
    900
    07.76
    04.99
    UXGA
    4:3
    1600
    1200
    00.30
    n/a
    WSXGA+
    16:10
    1680
    1050
    06.27
    02.96
    FHD
    16:9
    1920
    1080
    32.91
    08.64
    WUXGA
    16:10
    1920
    1200
    02.11
    00.95
    QWXGA
    16:9
    2048
    1152
    00.08
    n/a
    WQHD
    16:9
    2560
    1440
    00.93
    00.58
    WQXGA
    16:10
    2560
    1600
    00.13
    n/a
    3:4
    768
    1024
    n/a
    05.31
    16:9
    1093
    614
    n/a
    00.64
    16:9
    1536
    864
    n/a
    00.70
    Other
    01.41
    09.42

  • Trouble with image sizes....

    I have a freelance job where I am creating a few simple animations for a digital menu board for a Dairy Queen. I am having trouble with the size of my stage translating to the proper size on the LCD monitor. Is there a trick for making the conversion? The stage is huge and in writing is way bigger but still comes up smaller when viewed on the monitor. The monitor we are using is 768 x 1366 (or 15.5” x 27.5”) and my stage is 5100px x 7688px ( or 70"x106"). So you would think the flash file would be huge but it is too small by about 4in?!?!
    --Matt--

    those aspect ratios are different.  to fill the screen, you will need to make a descision to leave space at the top/bottom, crop your stage width or distort your stage. 
    you can publish for 100%x100% and use the scaleMode property of the stage to select your option.

  • I'm having trouble with my new iPhone.it seems it likes to turn it self off for no reason at all.i would like to know is this a hardware or software problem or just a iPhone problem i don't know.

    I'm having trouble with my new iPhone.it seems it likes to turn it self off for no reason at all.i would like to know is this a hardware or software problem or just a iPhone problem i don't know.

    basic troubleshooting steps from the User Guide are restart, reset, restore from backup, restore as new.
    Have ANY of these been tried?

  • Trouble with ipa size after changing assets

    Experiencing some really really odd issues with file size.
    Cooked a development version of our app yesterday, and the IPA file came out to 596Mb. We deemed this WAY too big to be useful, so we took every image and downsized it to 72 DPI at the exact pixel dimensions and compressed with jpg as small as we could get them.
    Next build of the app today, and the IPA file comes out to 822Mb...
    how is this even possible!?
    We reduced the file size of all our assets by almost 90% and the file size of the app INCREASES!?
    [edited]
    Anyone have any insight on why DPS seems to be defying all logic?

    Thanks very much Neil. Much appreciated.
    I am unfortunately out of the office for the night, so I can't get access to the files or DPS, but I will share the folio first thing in the AM.
    In the meantime though my team and I started doing some testing, as we were really concerned that the imagery in our app was what was causing the issues.
    As I mentioned earlier, we had swapped much of the imagery in our app for .jpgs that are rendered at the correct pixel dimensions they appear at in the app.
    We tried quickly swapping out a few of the higher res, and larger file size images for these smaller, compressed .jpgs After running the folio through DPS it seemed to impact file size very little (only dropped the file size a couple of hundred kb) - I am guessing this is due to what you were saying about DPS automatically resizing most images to 108ppi etc.
    Dropping to a single orientation definitely had a major impact on the file size. (822Mb for dual vs. 540Mb for single)
    Unfortunately the dual orientation is something we have been locked in to by our client.
    for this particular app the client is very picky about the image quality and they have made it a requirement that the app support retina display.
    Our initial tests running a 1024x768 file and upscaling on the newer iPad didn't have the best results, as the image compression and upscaling left our pixel imagery looking less than optimal.
    I finally managed to find this: http://blogs.adobe.com/digitalpublishing/files/2012/03/DPS_iPad3_bestpractice.pdf
    This PDF has a  section on file size, and describes using a 1024x768 with images at 144ppi folio for both retina and non-retina display
    Would starting with a 1024x768 file and then building a retina folio with those files drop our file size?? or would DPS scale the images up for retina and then result in a similar file size?

  • Trouble with IE and background graphics

    I developed a site with a tiled background a while back and the site viewed just fine in all browsers.  My client just got a new PC computer and the newest version of IE and when she views the site in IE the background is not showing.  It shows in Firefox, but not IE.  I would like to get this to work, but I'm not sure what the problem is.  Could someone take a look and indicate a way to fix this?  the URL is www.totaloffice.cc
    Thanks!
    graphicedge

    You have a few problems in your code.
    This is what I can work out.
    At the top of your CSS file, the very first character, you have a stray - thingy.
    In the rule:
    #contentbackground
    size:auto; doesn't belong there.  I have no  idea what that is.
    This rule needs a really good tidy up!
    #rightcolumn a {
    color:#00F;
    font-weight:bold;
    center
    ; text-align: center;
    in this rule:
    #rightcolumn a:hover
    There is a missing semi-colon;
    Here:
    #footer {width:744px; height: background-color:#FFFFFF; text-align:center; }
    You have no value for height:
    On to your HTML
    Here, in the head:
    <meta name="Mission" content="To help businesses do the things they don't want to do, don't know how to do, or have time to do without the added cost of an employee    ">
    You need to close the element employee" />
    Here:
    <p class="body_copy">To help financial advisors do the things they don't want to do, have time to do, or know how to do, without the added cost of hiring, training and maintaining an employee.</span><br />
    You have a closing </span> which isn't reauired and here:
    <span class="disclaimer">&copy; 2000 -2010 - Total Office Inc.</span></span></p></td>
    Some of those might have an adverse effect on your page in certain browsers.  You should also really use alt= text in your images.
    It pays to validate your page.
    I would be interested to know if tidying up fixes your problem?
    Martin

  • Trouble with Border Size when Printing

    I am having a great deal of difficulty with border size using PSE 9 and an Epson R800.  I have the latest driver for Windows 7, and still all of my photos come out with a .25" border (or greater if border is checked in the Adobe settings as well) when "borderless" is left unchecked.  I have tried all possible permutations of borderless with an added border, changing print size to trick the program, but cannot get the 3mm (.125") border I am accustomed to. Can anyone figure out what I am doing wrong?  Is a quarter of an inch on a 4x6 print the standard border?
    Thanks in advance
    Gregg

    You must have been using iPhoto 6 the last time as that's not available any more. There are themes now with different border options but no continuously adjustable border width.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • Trouble with header size....

    Hey,
    I am having trouble getting rid of a gap at the top of my header/banner
    The attached picture shows what i am talking about: if you look above the photo on the left, you will see a black gap that i cannot get rid of.   I want the picture to go all the way to the top of the page
    How do i do this?
    sorry for the simple question, but i just can't work it out

    You have h2 tags (head text size 2) around the image at the top of the page.
       <h2><img src="logo%20black.jpg" alt="ken logo" width="1000" height="200">
          <!-- end #header -->
    </h2>
    They are adding an extra 18px drop above the image. Header tags are block tags, which means (partly) that they come with extra space (margin) above and below). Taking the h2 tags off moves the image back up. Then you can go to the css and make the header div 200px tall (the height of the photo) instead of 218px, and the whole thing will tighten up.
    .twoColLiqLtHdr #header {
        font-family: "MS Serif", "New York", serif;
        background-color: #000;
        background-position: 0px;
        height: 200px;
        position: relative;
        padding-top: 0px;
        padding-right: 0px;
        padding-bottom: 0px;
        padding-left: 0px;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
        margin-left: 0px;
        border: medium double #300;
    Beth

  • Trouble with auto size text in a single line form field

    Hi.  I'm having an issue with filling out a form in Adobe Reader on my iPad.  The text field is single line.  The font is set to "auto" so that the line of text will not exceed a certain width.  When filling out this form on my laptop using Adobe Reader, it works fine.  As I type additional text, once the field is filled, it shrinks the text font size.  On my iPad, however, it won't let me type any more text in the field once I reach the end.  Does Adobe Reader for iPad not support the "auto" font size in form fields?  And I did check that my version of Adobe Reader is up to date on my iPad, so I do have the latest version.
    Thanks in advance for your help,
    Ashley

    Actually, nevermind.  It must be something wrong with the file.  I tried opening another file and auto resize worked perfectly on it.  Weird though that it works on one file and not another.
    Thanks!
    Ashley

  • Having trouble with image size on new HP2311x display with 4 year old MacBook. Image too small. Do I have to stay in mirror mode? I have messed with OSD and Image Control menus on display and have gotten nowhere. Help?

    Have just installed new HP 2311x display withe 4 year old MacBook. VGA cable. In mirror mode, at high resolution of 1920x1080, image size on HP display is too small. How can I get it to fill screen? If not in mirror mode, the display looks good, only I can't get the top menu bar (tried to drag it) nor the rest of the desktop. Help?

    Have just installed new HP 2311x display withe 4 year old MacBook. VGA cable. In mirror mode, at high resolution of 1920x1080, image size on HP display is too small. How can I get it to fill screen? If not in mirror mode, the display looks good, only I can't get the top menu bar (tried to drag it) nor the rest of the desktop. Help?

  • Trouble with custom sizes

    I just got an Epson 3800 and am trying to set up a custom size. I have used Aperture for several years and never used this function (used Photoshop instead). The problem is in the printing. I entered my custom size, everything looked right in the thumbnail on the print page but it doesn't print properly. Twice the photo paper came through with nothing on it (even thought the printer said "Printing") and now most recently only a portion of the picture is printed in one corner.
    Any ideas?
    Thanks, John

    It could be an orientation issue - in other words the length vs. width is screwed up. Maybe not - I have gone through some serious pain getting all of my software working correctly with 4880 printers in the past.
    RB

  • Trouble with Frame Size of AE Composition in Premiere CS6

    I'm trying to add a name-bar (name-tag) from After Effects to my sequence in Premiere Pro. I built the name-tag in Illustrator according to the frame size in Premiere.
    All of my name tags for a 640x480 frame fit perfectly. However, the tags I built for a 720x480 frame appear way, way too large. I can't figure out why. Below is an example of the issue I've been having:
    As you can see, the bar on the bottom extends beyond the frame -- but I built it to be the same 720x480 frame size as the video clip.
    So, without further adieu...help me. Please.

    Alright, (sorry for the delayed response) here are the settings for the AE composition:
    And there Sequence Settings:
    And the video properties (2 images):
    I hope this helps you help me.

  • Trouble with Playing Video Files

    I have a new macbook pro and I am having trouble playing video files.  It seems like it is having trouble with the size of the file.  I need to get this figured out because I will be doing a lot of work with video including using final cut to edit. Any suggestions for me to speed up video play?

    Any suggestions for me to speed up video play?
    Max out your ram.
    It seems like it is having trouble with the size of the file.
    Please clarify. 
    Are the videos home made, downloaded from the net, browser videos, streaming videos, etc.

  • Hi i am havin trouble with my ipad after i have downloaded a game and have been playing for a while it seems to of diapeared and the screen goes a white blank background there is nothing on the screen at all so i switch it off and back on and it is white

    hi i am having trouble with games on my ipad as i have been playing them the screen goes white and i can't play the game i go back to the game centre on the ipad and click on the icon for the game and come up to play i push play buton and the screen come up again white so any body had the same problem could they let me no thanks

    Quit the game and restart the iPad.
    To quit the game - Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    If that doesn't work try this.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • Having trouble with the move tool not working....   also I cannot seem to crop.... my cloud says I'm up to date, should I

    I seem to be having all kinds of trouble with Photoshop CC2015 and CC as well.... I cannot use the move tool.
    Also have a heck of a time cropping, will not let me select a crop, are there glitches I'm not aware of???

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

Maybe you are looking for