JTable horizontal fit into JScrollPane

Hi,
I am having problems with a JTable that has too many columns so it is not possible to see them all at once. So I am trying to put the table in a JScrollPane that can display the right ends of the table when scrolled, with the correct column widths... This scrollpane will eventually be placed inside a JPanel.
However it always shrinks the table to fit it the panel size, and squeezes the column width. I tried to play with setPreferredScrollableViewportSize but did not work out. Anyone knows that to do? Thanks in advance!

set
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);this should work.
Olek

Similar Messages

  • Table does not fit into JScrollPane...

    Hello,
    I created a JTable and want to put this table into a JScrollPane, because the table is larger than the screen-size. The problem is that I never get the horizontal ScrollBar displayed, and the columns of my table are pressed together.
    Just try yourself, here's a piece of my source code:
    JTable table = new JTable(100,100);
    JScrollPane pane = new JScrollPane(table);
    I tried different constructor-versions of the JScrollPane-object, but the result was always the same: very very small columns and no horizontal ScrollBar.
    Who can tell me how to do so...? I'd be very pleased about any kind of
    advision because this problem really drives me crazy...
    Thanx, Findus

    Hi,
    The reason that the horizontal scrollbar is not appearing is because you have the columns as resizeable. By default the column are automatically resizeable. You have to switch off the resizing.
    The code should be something like this (an example)
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.JScrollPane;
    public class MyFrame extends JFrame {
    private JTable table = null;
    public MyFrame() {
    try{
    GUI();
    catch(Exception ex) {
    ex.printStackTrace();
    private void GUI() throws Exception {
    table = new JTable(100, 100);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    this.getContentPane().add(new JScrollPane(table);
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.setSize(400, 400);
    this.setVisible(true);
    public static void main(String[] args) {
    MyFrame app = new MyFrame();
    I hope this helps

  • Is there a way to modify Incase Mini Car Charger so it will fit into iPhone 5s in a case?

    I should have read the reviews in the Apple Store before buying the Incase Mini Car Charger before I bought it: the material around the lightning connector is much thicker than that in the Apple cable (which broke after not much use) and won't fit into the 5s with the case I have on the phone. Is there a way to "shave" the rubbery material to make this work?

    dumdidadida: Thanks for your reply, but it doesn't address the problem. HSTS is designed to FORCE the use of https, this is a good thing in most cases. However, HSTS is problematic in that it incorrectly assumes that all users trust the default list of CAs and makes the adding of exceptions impossible even by advanced users.
    torprojec.org is just an example, this effects every HSTS site. You can reproduce this problem yourself in version 17 or later if you temporary disable "DigiCert High Assurance EV Root CA" in your certificate store and then visit torproject.org. You will notice the ability to add exceptions has been removed and that the cert_override.txt file found in the user's profile is also ignored.

  • My Olympic camera SD card doesn't fit into the SD card camera reader. Apple advised me to purchase the product in order to import photos to my IPad.

    My Olympic camera SD card doesn't fit into the SD card camera reader. Apple advised me to purchase the product in order to import photos to my IPad. How do I over ride this problem. How do I import photos from an Olympus FE-340 directly to my IPad?

    Your camera uses an OLympic XD picture card http://www.amazon.com/Olympus-xD-Picture-Memory-202332-package/dp/B002LC2DQ4/ref =pd_sim_sbs_p_1 This card has different dimensions compared to an SD card.
    You should be able to plug the cable that came with your camera into the camera connection kit to import the pics.
     Cheers, Tom

  • What's the best way to detect that text fits into ContainerControllers without scrolling?

    Hi.
    Question
    What's the best way to detect that text typed by user (or added programmatically) exceeds available container space and find out where starts truncated part? Is there available some other (than described bellow) easy way to detect it or disallow set of controllers to receive more characters that can be displayed in given composition area?
    My partialy failed attempt (simplified)
    For example lets say that I've got an editable textflow with attached two instances of ContainerController.
    var flow:TextFlow = createSomeFlowFromGivenString(sampleText),
        firstController = new ContainerController(firstSprite, 100, 30),
        lastController = new ContainerController(secondSprite, 600, 30);
    flow.interactionManager = new EditManager(new UndoManager());
    flow.flowComposer.addController(firstController);
    flow.flowComposer.addController(lastController);
    flow.flowComposer.updateAllControllers();
    With enabled vertical scroll policy I can compare height of the composition in last controller with height of the content:
    var bounds:Rectangle = lastController.getContentBounds(),
        overflow:Boolean =  lastController.compositionHeight < bounds.height;
    trace('Content does not fit into given area?', overflow)
    But when I switch vertical scroll policy off (lastController.verticalScrollPolicy = ScrollPolicy.OFF) - unfortunately this no longer works...(In my case scrolling should be dissabled, since text areas might have only one line with restricted width)
    Use case
    I want to create fillable form. Field might have a single or multiple lines. One field might start in the middle of the page, continue in the next line where it spreads through whole page and end in the - quarter of page width long  - third line. Text typed by the user can't exceed given area since it might cover some static text that sits right after/below field.
    Something like ascii image bellow:
    |                <PAGE>                    |
    |                                          |
    |                                          |
    |                                          |
    |               [Field starts here........ | 
    | ........................................ |
    | ........................................ |
    | Ends here..]                             |
    |                                          |
    |                                          |
    | [Another field] xxxx  xxxx xxxxxxxx x xx |
    | xxxxxxxxxxxxxxxxxxx                      |
    |                                          |
    |                              [One more.. |
    | .....]                                   |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    Info:
    [......]  <-- form fields starts with '[' character, and ends with ']'
    xxx       <-- sample, static text
    | and _   <-- page borders

    I've tried something like that previously, but it didn't work because then I've got vertical scroll policy to set to 'auto'. After changing verticalScrollPolicy to ScrollPolicy.OFF  in the last container it worked like a charm.
    Thanks zhen bian

  • Ipod doesn't fit into dock.....

    Hi,
    My daughter just bought herself an 4GB Ipod Nano. She tried to connect the ipod to her dock but the ipod doesn't line up with the connection.
    There seems to be an adapter for the dock to make the slot bigger, which does fit the ipod, but we can't get this to fit into the dock either.
    The instructions don't tell you what to do, nor does anything on Apples web site....these are all Apple accessories and came with the ipod.
    Can someone please help?
    Thanks
    Lynn

    The dock is the Ipod Dock
    There are three iPod docks. Actually, there are more than that.
    You can only use the iPod Universal dock or the 2G iPod Nano dock.
    The adapter that comes with the iPod fits in the Universal dock.
    The iPod will ONLY fit one way. If it does not fit, you have the wrong dock.
    The USB cable plugsd into your computer and then the back of the dock. You put your iPod in as shown below.
    This is the iPod 2G Nano dock.

  • I am having difficulty including text with iPhotos I want to share through email.  I get a red exclamation mark along with a statement stating that the text doesn't fit into the designated text area.  This is so frustrating.

    I am having difficulty including text with iPhotos I want to share through email.  I get a red exclamation mark along with a statement stating that the text doesn't fit into the designated text area.  This is so frustrating. Before iLire11 I was easily able to share photos with email messages.  Arghhhh!

    In the iPhoto preferences you can set Apple Mail as your e-mail client and then it will work exactly as before
    LN

  • I purchased Adobe Acrobat Pro XI via email download via the Dell Store yesterday. The product key doesn't work/fit into any of the "Registration" templates I've look through on the Adobe website. Manufacturer Part # 65195473.

    I purchased Adobe Acrobat Pro XI via email download code via the Dell Store yesterday. The product key given doesn't work/fit into the boxes on any of the "Register" pages on the Adobe website. Therefore, although I paid for the product and it is downloaded, it is not "installed" and will not work to print documents from emails, etc.

    Hi williamc48321229,
    You must have received redemption code via email from the reseller.
    Please ensure that you are entering the right code as that would be needed to obtain the serial number for activating the product.
    For more details on this, please refer:
    Find your serial number quickly
    Hope this helps.
    regards,
    Anubha

  • JavaFX 2.0 : How to make a stage fit into browser view area?

    Invoking a JavaFX 2.0 applet from browser results in white spaces on the right and bottom area of the browser. This happens when the JavaFX stage resolutions is lesser than that of browsing desktop resolution. In a client/server model, usually server components doesn't know about the client resolutions. So how to make a stage fit into browser view area?
    Also I think, setting the primary stage to full screen mode is not what I want to achieve, as this mode overlays the browser window.

    Try typing 100% into the width and height fields. Alternatively, you could use Javascript (no connection to Java in spite of the name) to create an event to resize the applet to the window's size.

  • Some of the pictures I am trying to use don't quite fit into the pre-set frames... Is there a way to move just the photo with-in the frame so to use the best part of the picture?

    Some of the pictures I am trying to use in Idvd don't quite fit into the specified frame... Is there a way to just move the picture itself within the frame to use the best part of the pic... For example I'm trying to use a picture of my son..but his head gets cut off when I drag the picture into the place holder....

    When trying to troubleshoot my problem I discovered a forum that was saying certain NTFS drives work just fine
    Apple support says that an NTFS or exFAT drive cannot be used when connected to the AirPort Extreme.
    I suppose it is possible that someone might have been using some type of special software on the drive that might perform a "conversion", but without more details, it is hard to know.
    Note: ExFAT and NTFS formats aren't supported.
    http://support.apple.com/kb/HT2426

  • Will my iPhone 4S with a bumper fit into the iPhone 3G dock?

    My iPhone with the bumper on doesn't fit it the iPhone 4 dock. Was wondering if it will fit in the iPhone 3G dock?? If it won't fit in the iPhone 3G dock is there any other one that it will fit into??

    looks like this
    http://cdn.macworld.co.uk/cmsdata/news/27271/XtremeMac%20Incharge%20Duox535.jpg
    from a company called extrememac

  • Can my macbook 4, 1 handle a 2tb hard drive if it fits into the hard drive bay?

    Can my macbook 4, 1 handle a 2tb hard drive if it fits into the hard drive bay?
    Does the hard drive brand matter as lon as the har drive fits in the slot?
    I want to put a 2tb hard drive in my macbook 4, 1 but I am not sure if the hard drive will work.
    Can my computer handle that big of a hard drive?

    "If it fits" will be the limiting factor. The largest capacity that I know of that will fit is 1.5 TB.
    OWC sold this 1 TB 12.5 mm WD hard disk a while ago that allegedly fit your MacBook4,1 so it stands to reason you won't be limited to a 9.5 mm dimension. The only 2 TB drives that I know of are 15 mm thick and will definitely not fit your MacBook. If and when you can find a 2 TB HDD in the required form factor it will work.

  • X60 1706-CTO: Does this WWAN Card - MC8775 - FRU 42T0931 Sierra Wireless fit into my laptop?

    Does the above described wwan card fit into my computer?
    The card is not recognized by the system and I have no idea what the problem is.
    Cheers,
    Nick

  • Kensington Security Locks don't Fit into Kensington Security Slot

    Hello all, I'm just about to go back to college and I have this new MBP. Considering my dorm is in an uptown manhattan brownstone, I'm kinda worried about my MBP's security. So I decided to use a cable lock as a mild theft deterrent when I leave to shower, etc. But the problem is, after all the Kensington security cables I've tried, none would fit, even though on the MBP's specs page, it says "Kensington cable lock slot" for security.
    As you can read in these reviews, it seems that many people w/ MBPs can't get their cable locks to work:
    http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?spart=T7229LL%2FA#re v
    I have tried their keyed and combo locks, as well as trying a display port screw lock (but due to the design of the MBP's DVI port, the screw lock cannot mount), to no avail. Nothing will work.
    So besides from ordering a locked down metal case or a safe (which will be quite tedious every time I need to go somewhere), what should I do? (And yes, I will have the software anti-theft things installed)

    No, the lock comes with three seperate spacers that fit around the head of the lock where it fits into the computer, thus preventing the lock from moving on the computer and scratching the casing. The lock also included a 'base plate' which allows you to screw it into a desk, table, wall etc. if you have nothing that you could securely put the cable around.
    John

  • Will a Macbook Pro HD fit into my Macbook?

    I have a friend that is exchanging his internal HD from his Macbook Pro. He offered me an excelent deal on his old 250Gb HD. Will it fit into my Macbook?
    Thanks for your inputs!

    The only reason it would not fit would be physical size of the drive. Go to one of the online stores, look for a hard drive of the same capacity for both the MacBook and the Pro. If they are the same then it should fit.
    Once you are ready to install the drive back up your entire existing drive with time machine. Install the new drive (its easy I replaced mine with a 250 gb) the instructions are on the internet. Then boot from your OSX disk. Repartition the new drive then restore your drive from the time machine backup and reboot. When I did this the only thing that happened when I rebooted is that OSX wanted me to reregister. Otherwise everything looked and worked the same.

Maybe you are looking for

  • How can I connect my G5 iMac to Telefonica ADSL?

    I just moved to Spain. The ADSL connection offered by telefonica seems to be set up with just PCs in mind. I do not know how I can connect my iMAc and my extreme Airport Base Station to that ADSL system. Do I need any special configuration in the Bas

  • Changing video type to tv show stops working

    Hi guys. When i copy a show to my iPad it plays fine when categorised as Home Video.  However, when i set the show to TV Show and give it a Show Name, it stops working and will not play on my iPad or in iTunes.  I have to delete the show and copy it

  • Map Viewer spatial data

    Hi , How can we  integrate MapViewer in OBIEE for a country that is not included in Oracle Spatial Data ? Thx

  • Windows XP - no icons, no taskbar, cannot right click

    Hello TechNet Support - Wasn't able to view all forums, am hoping this question will appear in the correct one. Helping a friend with his Dell desktop - Windows XP SP3. When we try to start up, the desktop background picture appears, but that's it. N

  • Weird DNS Traffic Help Please

    Close Port 53 on the inbound. They are sucking up your juice. This port should never be opened.