Visible panel Size : cannot get it

Hi,
I'm trying to get the visible size of a JPanel (which is contained in a JScrollPane) but I cannot get the correct values.
I want to know what is the visible size (not the total size I can view by scrolling the pane, just the visible when the window is openned), in order to decide how will place the components inside panel. If you see at the image , I want to know what is the size of the orange panel, assuming there is not scroll bar.
If I use getSize, getPreferred size for this panel or for the viewport of the JScrollPane which contains the orange pane, width and height I get are the total width of buttonPanels (>3000px) plus some more pixels and the height of one buttonPanel (120px) plus some more pixels. The same if I use the size, preferredSize of viewPort of the JScrollPane.
I need to know the value of the panels height and width without scrollbars in order to decide how will show these buttonPanels on that panel. I'm trying to get these values after the JFrame.setVisible(true) but get the values I mentioned above. In case I write it this way
        setExtendedState(NORMAL);
        setVisible(true);
        setExtendedState(MAXIMIZED_BOTH);
        redrawMainPanel(getContentPane());the windowState changes two times and the properties size, preferredSize have been updated, so I get the total width of all buttonPanels and the height ~600 wich is the actual height of that panel for my screen. Even that is not enought because firstly I don't want the total width of the panel, but just that I see on the screen when it opens, not by scrolling it. Same for height. By using twice the setExtendedState I can get the correct height but I think if there were many controls so as vertical scroll bar to be shown, I would get a height greater than that of ~600 px I get now.
Is there any way to have just the size of the orange panel you see on the image?
Thanks in advance!
Edited by: ChristosKorakidis on Aug 1, 2009 2:18 AM

Andre thanks for your help but didn't succeed to get the values
In the constructor of my class there is
       setExtendedState(MAXIMIZED_BOTH);
       setVisible(true);
       redrawMainPanel(getContentPane());The redrawMainPanel is
    private void redrawMainPanel(Container container) {
           for (int i=0;i<container.getComponentCount();i++)
                     if ((container.getComponent(i) instanceof JPanel) && (((JPanel)container.getComponent(i)).getName() == "mainPanel")){
                          redrawPanel((JPanel)container.getComponent(i));
                     else if (container.getComponent(i) instanceof Container){
                          redrawMainPanel(((Container)container.getComponent(i)));
     }and the first line of the redrawPanel() is
System.out.println(((JViewport)component.getParent()).getViewRect().getWidth() + " - " + ((JViewport)component.getParent()).getViewRect().getHeight());I get 0 - 0
I havent implement Scrollable, is that necessary?

Similar Messages

  • Email content exceeds screen size; cannot get to top to click on View

    Incoming e mail content is too large to fit 17" MacBook Pro screen.
    Unable to get to top of page to click on View where may (?) be able to make size adjustment for screen.
    To do?

    Post a screen shot please.

  • In Firefox 3.6.13, the Tree Style Tabs ver. 0.11.2011011301 has stuck me with a screen-hogging, multi-line Navigation bar icons panel I cannot get rid of.

    This panel is located in the upper right part of the screen.

    moetunes wrote:Maybe start reading from here.
    Yeah thats... the guide I was reading.
    hadrons123 wrote:Another thread possibly due to not adding required dameons  in /etc/rc.conf.
    And those are?  I installed dbus as that's the only daemon the beginners guide mentions, and I added alsa and a few others to rc.conf for good measure but saw no change and removed them.  So right now I only have:
    $ grep DAEMONS /etc/rc.conf
    # DAEMONS
    DAEMONS=(syslog-ng network crond dbus)

  • Cannot get MacPro to allow me to boot to an alternative boot disk. Can choose in control panel but will not use the disk to boot. Also won't boot using disk selected using option key

    My primary boot disk is encrypted as is a secondary boot disk (backup) but I cannot boot using any other disk. System 10.8.5, MacPro 4.1.
    All disks mount using primary boot disk. All disks check out as OK and I have repaired permissions.
    When I choose in the control panel the Mac boots but will always use my original boot disk.
    When I select the disk using the option key at startup, the boot process stalls with a grey screen and a spinning cursor.
    Thanks,
    Dave

    Still trying to figure this out. I erased the drive, did a format using disk util and then re-installed the system but I still cannot get the disk used as a startup drive. I also tried an external firewire drive and it won't allow me to boot from it either.
    I can choose it starting up with the option key but it just gives me a blue screen and the spinning cursor.
    If I select it in the startup pref pane it boots into my other startup drive only.
    DaveLon

  • HT4759 i downloaded the icloud to my pc it says to login with apple id and it says it is a valid apple id but not cloud but i cannot get the control panel for icloud to come up to set it up on my pc which runs windows 8

    i downloaded the icloud to my pc it says to login with apple id and it says it is a valid apple id but not cloud but i cannot get the control panel for icloud to come up to set it up on my pc which runs windows 8

    An update.
    From iCloud Control Panel 2.1.1 for Windows
    "iCloud Control Panel 2.1 and later includes support for Windows 8"
    but you still need to set it up on a Mac or iOS device, "Note: To create an iCloud account you need an iPhone, iPad, or iPod touch with iOS 5 or later, or a Mac with OS X Lion v10.7.5 or later."

  • I have two faults! 1, an error comes up in Ps CC 2014 "could not apply the saved panel configuration, restring to default and my tools have disappeared completely and anything ive tried I cannot get them back not even the drop down menu in 'window' helps

    I have two faults! 1, an error comes up in Ps CC 2014 "could not apply the saved panel configuration, restring to default and my tools have disappeared completely and anything ive tried I cannot get them back not even the drop down menu in 'window' helps at all. And 2, Lr everytime I load it up it gives me the option to retry or switch to and it takes a while for me to even get anywhere with it I think it has something to do with the catalogs? I've been using these programs for a few years now on a Mac...no problem but when I use a PC when I'm away coz it's the (only) comp available these happen PC's are so useless! Please can anyone help??...

    I can give a few suggestions on Photoshop CC 2014, but Lightroom is a separate forum and you should ask Lr questions there.
    First close Photoshop.
    Then start Photoshop by double-clicking on it's icon and very quickly after that, hold down the ctrl-alt-shift keys until you see the reset dialog. answer "Yes" to delete settings, and let Photoshop continue to load.
    It's tricky to do and may take a few tries, but at least it should reset Photoshop CC 2014 to defaults.
    Gene

  • I cannot get my MacBook Pro to print greyscale on my Canon MG6450. I cannot access the printer driver panel on the Macbook. So I am stuck printing everything in colour and cannot specify which pages I want printed.

    I cannot get my MacBook Pro to print greyscale on my Canon MG6450. I cannot access the printer driver panel on the Macbook. So I am stuck printing everything in colour and cannot specify which pages I want printed.

    Try resetting the printing system:
    OS X Mavericks: Reset the printing system
    Next try deleting the system and reinstall the printer..
    BTW this is Mac Pro desktop forum

  • Cannot get display to work on I pad 2. No visible damage

    I Pad 2. Cannot get display working?  No visible damage

    Try to reset it. Hold down the sleep and home keys for about 20 seconds. If you see the silver apple, let it reboot and that may help.

  • HT4623 cannot get air-play logo on my ontrol panel, even after following troubleshotting instructions

    Cannot get air-play logo on my control panel, even after following trouble shooting instructions

    http://support.apple.com/kb/ht5209
    http://support.apple.com/kb/ht4437
    http://support.apple.com/kb/TS4215
    http://ipad.about.com/od/iPad_Troubleshooting/a/How-To-Fix-Airplay-Icon-Missing. htm
     Cheers, Tom

  • Cannot get pdf file to print actual size

    I recently had to reinstall my printer and now when printing PDF files I cannot get the page to print in full size.  This is necessary because I am printing a pattern and the size has to be accurate.  I am not even given the option anymore to be able to do this.  I did have the option before the reinstall.  BTW the reinstall is because the computer crashed and I had to take back to factory settings.  I appreciate any help given.  Thanks.

    pamw523
    Welcome back to the HP Community Forum.
    This may be helpful:
    Manage Print Output with Print Preview
    Assuming you have installed the Full Feature Software for the printer
    and
    Assuming that you have at least a recent version of Adobe Reader or Adobe software installed so you can download and open PDF files,
    then
    it may only be that the PDF print setup needs to be adjusted for the file prior to printing
    See pages 5 and 6
    You can also check
       Print PDFs
    ===========================================================
    Click the Kudos Thumbs-Up to say Thank You!
    And...Click Accept as Solution when my Answer provides a Fix or Workaround!
    I am pleased to provide assistance on behalf of HP. I do not work for HP. 
    Kind Regards,
    Dragon-Fur

  • Growfs: cannot get partition size

    Hi,
    I am running Sunos v5.9 and am trying to extend a soft partition from 30gb to 44gb. The slice of disk it is on does not appear to be mirrored and is labelled d2. I ran metattach d2 10g and this completed ok but when I ran the growfs, I got the above error. I have read countless reports of having to use the raw device name and I am doing so, but to no avail. I am running:-
    growfs -M /u04 /dev/md/dsk/d2 and get:-
    devinfo: /dev/md/dsk/d2: Inappropriate ioctl for device
    growfs: cannot get partition size
    Can anyone point out what I am doing wrong please?
    regards
    Carl
    Info
    /dev/md/dsk/d2 32G 30G 2.4G 93% /u04
    metastat d2
    d2: Soft Partition
    Device: d0
    State: Okay
    Size: 92274688 blocks (44 GB)
    Extent Start Block Block count
    0 20987842 20971520
    1 182468555 6291456
    2 192954317 41943040
    3 239091684 23068672
    Device Relocation Information:
    Device Reloc Device ID
    c6t40d0 Yes id1,ssd@w600c0ff00000000007ea4a22e5b3f300

    looking at the response you got an error message for d38, either your have increased the size of the wrong metadevice or you may have forgotten to increase the size of the opposing sub mirror plex, if d37 and d38 form a mirror, you need to post a metastat and a df -k, to allow us to see what your config is.

  • Growfs: cannot get partition size, Inappropriate ioctl for device

    Hi ,
    I am trying to increase the filesystem. I did first
    #metattach d37 1G
    d37: Soft Partition has been grown
    and then
    # growfs -M <mount point> d37
    devinfo: /dev/md/dsk/d38: Inappropriate ioctl for device
    growfs: cannot get partition size
    What is the problem, can anyone help me?
    Thanks in advance,

    looking at the response you got an error message for d38, either your have increased the size of the wrong metadevice or you may have forgotten to increase the size of the opposing sub mirror plex, if d37 and d38 form a mirror, you need to post a metastat and a df -k, to allow us to see what your config is.

  • My Panel cannot get focus

    Hi! I created a panel with Adobe Configurator2.0. Within the panel I used a HTML widget. But when I run the panel in Photoshop, the webpage in the panel cannot get the focus. Is it the way or I did something wrong? Thanks!
    James

    Do you mean the web page displays but you can't navigate in the page or.....?
    Have you enable allow extensions to connect to the internet under plug-ins in the photoshop preferences?
    Here's a test panel of this web page so it can work.
    ,MTSTUNER

  • Cannot adjust side panel size in iMovie 13

    I have a brand new MacBook Pro 13' with Maverick and iMovie 13. I am not able to adjust the width of the side panel (library panel). I get the right cursor when I hoover over the border between the library panel and clip panel, but nothing happens when I click and drag.

    You can use keyframes to selectively alter the volume of a clip. Select the clip and then place your cursor over the volume line, then option click and a keyframe will appear. You can move the keyframe vertically and horizontally by dragging. Add multiple keyframes where you like and you can adjust the volume line between keyframes. Right click a keyframe to delete it.

  • Downloaded a wallpaper pic, wanted to see how it would look full size, so clicked off my tool bars, but also clicked off nav bar in error. now cannot get any of them back . HELP PlEASE.

    am able to download other tool bars, but cannot get the nav bar, or home button back

    Firefox 3.6+ versions have a feature to allow the user to hide the Menu bar.
    Hit the '''Alt''' key to temporarily show the Menu bar, then open View > Toolbars and select Menu bar, so it has a check-mark. <br />
    The F10 can also be used on most PC's to temporarily reveal the Menu bar.
    https://support.mozilla.com/en-US/kb/Menu+bar+is+missing

Maybe you are looking for

  • Error in Closing a Project .

    Hi Guru's I am facing a situation where the system is throwing an error msg when attempting to close a project. We have checked the AUC and noted that no value exist there. However the GL account (assigned to AUC) shows a balance in local currency 2.

  • Images will not display on Export to PDF

    I have a BOXi Web Intelligence Document that displays two images that are 7kb each. The Text for one of the objects is set to: http://cpolrhp.belvoir.army.mil/eur/images/CHRA_Logo.gif That object is set to read the text as: Image URL The images displ

  • Calling Sysdate in JSP

    Hi, i have a Textfield in BC4J JSP component. if i add a new record to the table means i have to display current SYSDATE in the current date column text field. i should not allow the user to enter (or) modify the date value. how can i do it. Thanks i

  • BI Beans Portal sample cache error

    Hi, I have tried to implement the BI Beans Portal sample, I have followed the instructions and everything has worked, however if I try and display a Portlet, I get the message "This view has not been cached yet". I have cached all the Dataviews with

  • Unable to open MOST Pages documents

    Help! I use Pages to create invoices; I went to create an invoice today and Pages just sits there, not responding. I've had to Force-quit everytime I try to open one of my previous invoice documents or almost any other document (please note-there is