JScrollPane packs in a wrong way.

I've an JInternalFrame in wich I've a JScrollPane wich contains a JPanel, wich contains something.
When I finished to create all , I pack() the JInternalFrame in order to make it as big as it contains all ..
Doing that I see something wich is smaller then I need and then I see scrollbars.
In normal situations this is not what I want..
I used scrollPane in order to leave the user free to resize the IFrame and when the screen is not enough for all contents but in the normal situation I dont want it.
Why pack does that "error".
Did I miss something ?
Tks
Tullio

Code? You presume that the scrollpane's perferred size will reflect the preferred size of the panel? I'm not sure that's the case. How about doing this?
Dimension dim = new Dimension(500, 400);
JPanel panel = new JPanel();
panel.setPreferredSize(dim.width, dim.height);
JScrollPanel scroll = new JScrollPane(panel);
JInternalFrame jif = new JInternalFrame("frame 1", true, true, true, true);
jif.getContentPane().add(scroll, BorderLayout.CENTER);
jif.pack();
Insets insets = jif.getInsets();
jif.setSize(dim.width + insets.left + insets.right, dim.height + insets.top + insets.bottom);
jif.setVisible(true);
desktop.add(jif);

Similar Messages

  • Smart quotes sometimes wrong way round after a question mark or comma

    I'm finding that Pages frequently puts the direction of the final smart quote in a piece of dialogue the wrong way round.  I use a single speech mark (apostrophe) at start and finish of speech.  This seems to happen most after a question mark or comma.  Anyone know why, or how to fix it?  Doesn't happen in Word!  Thanks.

    Which language is your computer set to?
    Have you set the system preferences for smart quotes?
    System preferences > Language and text > Text
    Here is what it looks like on my computer with Snow Leopard

  • Photos keep appearing the wrong way round in slideshow!

    Photos which I imported from my old macbook (running 10.4) onto my new imac (10.5.8) keep appearing the wrong way round or stretched out when I play them as part of a slideshow even though in the library they appear fine. Can anyone tell me how to fix this please?
    Thanks

    Yes the plist file is important, but next time you start iPhoto it will create a brand new one.
    This file records various user settings - like the background colour, for instance. If you trash it then when iPhoto re-creates it it simply returns things to the factory default settings.
    Trashing the plist file is troubleshooting 101.
    Also don't understand what you mean by "If you've moved your library you'll need to point iPhoto at it again"
    By default, your iPhoto Library lives in your Pictures Folder. That's where iPhoto looks for it. If you've moved the Library - and I'm guessing you haven't - then you need to tell iphoto where you moved it to. Why? Because that's a setting recorded in the plist file.
    Regards
    TD

  • PDF colour shows in Acrobat X1 in wrong way

    When comparing the Printed Magazine with the dokument in Indesign (CC 2014), Photoshop (CC 2014) and Acrobat (X1) the colours is not the same. Its all been setup from Bridge. Everything is matched except Acrobat that shows the PDF i wrong way. Why?

    Maybe it lost your serial number?  Re-enter it (or log in with your Adobe ID).

  • I charge my account in free phone call by wrong way 4 time and my balance only 100 mint.

    I charge my account in free phone call by wrong way 4 time and my balance only 100 mint.
    <Email Edited by Host>

    These are user-to-user forums, you are not talking to Apple here - I've asked the hosts to remove your email address from your post.
    If you want to contact iTunes support then you can do so here : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • I took all my video with my iPhone turned the wrong way. When I view it on my pc it's turned on its side. How can I rotate the video and crop it?

    I took all my video with my iPhone turned the wrong way. When I view it on my pc it's turned on its side. How can I rotate the video and crop it?

    Try plugging it into a computer with iTunes opened. If you see anything that says restore, say no.
    Sometimes these issues resolve themselves when you connect the device to iTunes.
    What happens when you hold the home and sleep/wake button? I know it doesn't work, but does it shut off at all?

  • HT4111 Logitech K810 UK layout problem with @ and " being the wrong way round.

    I have tried this keyboard on Windows 7 devices and they work just fine, but on IOS7, either the first version or the version released today, it remains the wrong way around - i.e. US spec.

    Hi,
    I have a problem with the same keyboard when I start up and hold the ALT key you can select a startup disk this is not working by my keyboard when I use a old keyboard I'ts working again do you have that problem also.
    Best regards Garry

  • I want to install window7 on my macbook pro but i do the wrong way

    I want to install window7 on my macbook pro but i do the wrong way
    my gf she use macbook pro then she want to use windows program so she just put window7 cd then she restart and boot from cd rom and she just format all drive from window7 installer after install mac can start up and can use window7 but cant connect to network or wifi also windows can not find driver
    what should i do now can any1 tell me please or any1 have been same problem ...

    To install Windows you can use Boot Camp Assistant or use a virtual machine like Parallels, Fusion, or VirtualBox. You can't install Windows as you described in your post.

  • Macbook Pro Retina Trackpad scrolls wrong way

    IR and yellow screen issues aside !...
    my new macbook pro retina (with Mountain Lion already installed) has an issue with scrolling. It came with 'reverse' scrolling i.e. moving your fingers down the trackpad makes the screen move upwards and vice-versa. I find this confusing so I went to the system prefs to change it. Under the 'Scroll and Zoom' tab the first option is 'Scroll direction: natural - content tracks finger movement'. This is what I wanted. But curiously, this option was already checked, and giving me the reverse scroll direction! I unchecked it, so technically I should now have the reverse direction, but then I had the natural direction?!
    Ok, so it's not so much of a problem, as I can change the direction. But obviously it is the wrong way around. Just wondered if anyone else had discovered this on their MBPr and if so, can it be corrected?
    Thanks!

    Un check that setting. What Apple thinks is Natural is Backwards from what every other person in the world thinks and Knows it is.

  • Sharepoint Arabic indexed in wrong way

    I am facing the problem that all pdfs written in arabic is indexed in  a wrong way in Sharepoint 2007. Arabic is right to left language. so I expect the indexing will happen from right to left. but this is not the case. the indexing is happening from left to right.
    For example if the word is read as "مصر" it should be indexed to "م ص ر". But what happens the index will show it as "ر م ص"ز
    In English, if we have the word "ABC" the index should be "A B C", But this is not the case, it display as "C B A".
    I think this is a problem with the IFilter 6.
    Do you have any suggestions ??
    Thanks,
    Mohamed Shoukry
    Sharepoint developer

    Just as a follow-up, here (why didn't I think of this
    earlier?) is how to reverse the letter order of a word using
    ActionScript only: (1)Convert the word string to an array.
    (2)Reverse the array. (3)Convert the array back to a string.

  • Little problem, the skip button is facing the wrong way!

    as you can see, on the quick access thing in windows 7, the skip button is facing the wrong way. an unusual problem, doesn't affect the funtion of the button. dont know if anyone else is having this problem, might just require a new install.
    let me know if this is just me! or any suggestions?

    WRT the skipping crashes,  there was some posts, that the earlier iPod Classic do crash, when playing song of this format
    mp3/mono/96kbps
    Check if your iPod contains these MP3 format.

  • Dialog box: "you removed the device the wrong way"

    iMac + 30 gig iPod. New Mac user here.
    Everytime I start iTunes (by plugging in my iPod), I get the dialog box telling me that I removed my iPod the wrong way and may have lost data. How can I get that dialog box to stop showing up?
    By the way, I always hit the little eject button next to my iPod's name before unplugging it from my computer. Not sure why this keeps popping up. It started after I updated to the latest iTunes software.
    Thanks in advance!

    Well, at the time I was leaving for college. There, I met a girl who inconveniently dragged me around the country for fifteen years. But we're moving to Boston this summer, so we're getting closer.
    I had a similar issue a while ago, and fixed it by just wiping my iPod, doing a Software Restore, and re-syncing it with my library. It wasn't exactly the same (iTunes thought the iPod was connected even when it wasn't), but if something on the iPod is stuck in "I was disconnected improperly!" mode it might help.

  • How to mirror/flip a photo? (were scanned from slides wrong way round)

    How to horizontal flip a picture? Some 50 slides were scanned from dias and were scanned wrong way up. so now my pictures are lef-right mirrored.
    Thanks, Mark

    That is not a feature of iPhoto - suggest to Apple - iPhoto Menu ==> provide iPhoto feedback.
    You can do it in preview (in your applications folder) before you import the scans, by exporting the scans or by setting Preview as the external editor for iPhoto
    LN

  • HT201269 Is there a right, and wrong way to plug the lightning connector into the phone?

    The lightning connector dosen't want to plug into the slot and I don't want to force it, ... is there a right and wrong way to do this bisic and simple step?  Thanks

    No, it is a reversible plug. Either way is fine.
    Just make sure you plug it in straight until it "clicks" into place. It may take a bit of force if new, but check there's nothing in the port first.

  • Keyboard symbols wrong way round

    My " and @ are the wrong way round. When I opened keyboard prefs I had an option to change keyboard so I did it then asked me to press the button next to shift then offered three types, I picked european as thats where I am but still no go. And now the option tot change the keyboard has gone from system prefs entirely.
    Its a basic logitech keyboard and the awesomely bad logitech software does not even see the keyboard.
    Any ideas?

    Go to system prefs/language & text/input sources and see if there is a box to check for Logitech UK.
    Which key do you want the @ to be on exactly? Mac and PC Brtish keyboards are different.

Maybe you are looking for

  • How to view Retrieved file in DMS Archiving.

    Dear All, My client is specific about DIR Archiving. Now the scenario is DIR has been marked for Deletion and archived and Stored in a repository successfully. After Archiving DIR has been deleted from the Database. Now using SARA Transaction using "

  • Diagnostics Agent 7.11 on iSeries

    I"ve gone and got the installation master DVD and the Kernel DVD but cannot find the standalone Diagnostics Agent. Following You can download Diagnostics Agent installation DVDs from SAP Service Marketplace at: http://service.sap.com/swdc Download SA

  • HT201210 My Ipad is locked with a Itunes icon and a usb plug. This happened during charging

    Earlier today I bought a new app which I played for a while.  I noticed my battery was low so I hooked it up to charge. When I came back there was a Itunes icon along with a picture of a usb cord. I hooked it up to my computer and it said I needed to

  • IPhoto Does Not Recognize File

    No search. I have a file that iPhoto will not recognize. I made a jpeg and tiff, and it will open in Preview and Photoshop, but not iPhoto. Says it doesn't exist, or is corrupt. Neither is true. Any help is appreciated.

  • ?? appear on My Album/Photo Pages

    I have 2 ?? appear on my Album and photo pages. When I visit the published site, they aren't there, but show up when I view online. I've tried for a week to figure out the glitch, but haven't found it. What am I missing? It's at: http://www.ohlsencla