Disappearing Scrollbars

Hi,
I have a problem with the JScrollPane.
When adding some components to a panel inside a JScrollPane whereby most components are invisible at the start and made visible by user actions, the scrollbars disappear when making components visible.
More precisely, I always resize the whole frame when making a component visible. If the frame is too big to fit on the screen, they first appear, but when making one more component visible, they disappear again.
Very strange is also, that when I minimize the dialog and then maximize it again, they reappear again. This sounds like a bug for me...
Any help would be appreciated. BTW, I'm using Java 1.6.0.
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JToolBar;
public class ScrollBarTest
     public static void main(String[] args)
          final JFrame frame = new JFrame("ScrollBar Test");
          frame.setLayout(new BorderLayout());
          Font font = new Font(Font.DIALOG, Font.PLAIN, 80);
          JPanel panel = new JPanel(new GridBagLayout());
          GridBagConstraints cons = new GridBagConstraints();
          cons.gridwidth = GridBagConstraints.REMAINDER;
          final List<JLabel> labels = new ArrayList<JLabel>(20);
          for (int i = 0; i < 20; i++)
               JLabel label = new JLabel("Label " + i);
               label.setFont(font);
               labels.add(label);
               if (i > 0)
                    label.setVisible(false);
               panel.add(label, cons);
          frame.add(new JScrollPane(panel), BorderLayout.CENTER);
          JToolBar toolbar = new JToolBar();
          JButton button = new JButton("Klick");
          button.addActionListener(new ActionListener()
               int     firstInvisible     = 1;
               @Override
               public void actionPerformed(ActionEvent e)
                    labels.get(firstInvisible).setVisible(true);
                    firstInvisible++;
                    frame.pack();
          toolbar.add(button);
          frame.add(toolbar, BorderLayout.NORTH);
          frame.pack();
          frame.setVisible(true);
}

If the frame is too big to fit on the screen, they first appear, but when making one more component visible, they disappear again.I reset the maximum frame height and it works the way I would expect it to. That is the frame height doesn't change and scrollbars appear.
frame.pack();
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle bounds = env.getMaximumWindowBounds();
int height = bounds.height;
Dimension d = frame.getSize();
if (d.height > height)
     d.height = height;
     frame.setSize(d);
}

Similar Messages

  • Disappearing scrollbar in Mac OS 10.8

    I recently upgraded my Mac operating system from OS 10.6 to OS 10.8. After doing so I found that the scrollbar on my Verizon email page had disappeared so it was impossible to click on messages at the bottom of the page. This was the case whether I accessed my email using Firefox or Safari. The problem turned out to be with the scrollbar default setting in OS 10.8: you need to go into Mac Preferences, and in the General>Show Scrollbars check the "Always" box. 

    hmm it may be a possible bug related to 10.5, I only have
    10.4 and it works for me. Do you know anyone else who has 10.5 and
    Flash CS3?

  • Disappearing Scrollbar

    Hi Experts,
    As part of our upgrade process from 4.6c to ECC6 we're moving our ESS/MSS to Portal.
    We've noticed that within MSS->Manager's Desktop, when you're within the Report 'Leave Balances' for an Employee and the user tries to navigate to a different page (via the page number text box in the bottom right corner of the report) or, tries to sort a column in ascending or descending order - the vertical scroll bar on the right of the report disappears.
    The user can still navigate through that page of the report via the mouse scroll-wheel, up/down keys or page-up/page-down keys, the issue is just the absence of the scroll bar.
    Any assistance or direction to information that will help me solve this would be greatly appreciated.
    Thanks in advance,
    Cal

    Hi,
    Pls check the OSS note 925679.
    Regards
    Sat

  • Lion Finder active window display problem

    I'm running 10.7.3 on my MB Pro.  I have all the latest-and-greatest updates.  However, this quirk only started to appear with Lion and has appeared in all versions to date.  I'm wondering if I'm the only one who has this problem.
    Here it is:  Whichever Finder window that is active used to pop to the front (or "on top of") of all other windows, but often I find that this is no longer the case.
    Example #1:  If I have two windows open and I'm dragging a file from one to another, the dialog box that asks if I want to copy the file often stays buried beneath one/both other windows.
    Example #2:  If I go to drag a file from one window to another window hidden/buried under the first one, it used to be that if I held the file to be dragged over the buried window that it would become "active" and thus move to the front, but now this is often not the case. 
    Example #3:  If I go to cycle through open windows using Cmd ` in order to find a buried window, often the buried window will not move to the top.
    In all these instances, even using Expose to show open windows will not bring the desired window to the front.  I was hoping that this bug would be noticed in 10.7.0 and be corrected by now, so either it's a bug or maybe I've got something set up wrong.  Somebody enlighten me!

    I've had the exact same problem with Lion.  Telephone support told me to reinstall OS X Lion, which didn't help. The genius at the Genius bar told me it was my 3rd party (Kingston) RAM.  He demonstated the display was fine without the extra RAM, but he was using a USB mouse with a scrollwheel.  At home, my bluetooh magic mouse continued to cause the same problem, and so did my trackpad.  So I determined it had to do with the faster (and different type of) scrolling that these newer devices perform.  I then saw that if I use the slider on the right side of the finder window instead of gesturing with the mouse or trackpad it works fine.
    So I played with my settings a bit to see if I could overcome this problem, and found a solution.  I went to "Preferences-General-Show scroll bars" and changed from "Automatically based on input device" to "Always".  This nearly fixes the problem!  At least so far.  I get an occasional glitch if I scroll up and down a lot, but way less frequently than when its set to the default "Automatically based on input device".  This must be due to the new disappearing scrollbar "feature" in Lion.  Nicely done, Apple!

  • Display problem when scrolling in Finder OS X Lion.

    Hi,
    Last week i bought a new iMac, i7, AMD Radeon 6970M.
    Sometimes, when scrolling in the Finder, the text is displayed weird.
    See screendump. Is anyone known with this issue?

    I've had the exact same problem with Lion.  Telephone support told me to reinstall OS X Lion, which didn't help. The genius at the Genius bar told me it was my 3rd party (Kingston) RAM.  He demonstated the display was fine without the extra RAM, but he was using a USB mouse with a scrollwheel.  At home, my bluetooh magic mouse continued to cause the same problem, and so did my trackpad.  So I determined it had to do with the faster (and different type of) scrolling that these newer devices perform.  I then saw that if I use the slider on the right side of the finder window instead of gesturing with the mouse or trackpad it works fine.
    So I played with my settings a bit to see if I could overcome this problem, and found a solution.  I went to "Preferences-General-Show scroll bars" and changed from "Automatically based on input device" to "Always".  This nearly fixes the problem!  At least so far.  I get an occasional glitch if I scroll up and down a lot, but way less frequently than when its set to the default "Automatically based on input device".  This must be due to the new disappearing scrollbar "feature" in Lion.  Nicely done, Apple!

  • Hard to use new scrolling system

    On Mail and on pages I open online the scrolling bar disappears.  I'm not sure what it's called. On this communitity page it's grey and fatter than in Mail and it stays in place.

    I think they are moving away from the ancient scrollbar technology.
    With all due respect, just because Apple says its out-dated doesn't mean it is. Scroll bars are usability aids. A disappearing scrollbar hinders navigation — you can't see as easily how much of the page you've still got to read or where about you are in it. This is a schoolboy usability error. Luckily, they at least left the option for users to put them back (unlike some of the other design flaws in Lion).

  • Why does the scrollbar sometimes appear then disappear?

    Why does the scrollbar sometimes appear but then disappear? When I open a window the scrollbar is sometimes there for a just few seconds. If I select it within a few seconds and use it everything works fine. If I don't use it, it disappears and I can't get it back. How do I get the scroll bar back? Why won't the scrollbar show up at all on web pages?

    It's a feature which is supposed to enhance your interface with your Mac and its operating system on screen. It is a "visual aid" that is meant to remove on screen clutter.
    You can go to 'system prefs/ click general/ click 'Show scroll "Always button"
    There you go
    Cheers

  • When you scroll to the bottom of the list of files in Finder, the left to right scrollbar doesn't let you click the last file and it covers the file for a while until it disappears. Is this a bug? How do I not make that happen?

    When you scroll to the bottom of the list of files in Finder, the left to right scrollbar doesn't let you click the last file and it covers the file for a while until it disappears. Is this a bug? How do I not make that happen?

    An odd workaround: click "Always" in System Preferences/General/Show scroll bars. The scroll bars will always show, but they won't cover your last file.
    See this other post: https://discussions.apple.com/message/20572471#20572471

  • Vertical ScrollBar for JTable disappears when trying to scroll!

    Hi!
    I have 2 JTables and these are in a JScrollPane. I need to add a Vertical ScrollBar in such a way that when the number of rows increases, the scrollbar will scroll both the table's data.
    I am not using the Vertical ScrollBar of the ScrollPane instead i have added a JScrollBar to the two Panes( i.e. scrollPane.setVerticalScrollBar() ). This works fine.
    But when I remove the columns from the right JTable , i.e. I have only one JTable left, the Vertical scrollbar disappears inspite of the number of rows being the same.
    I have tried setting ViewPortView etc. but nothing works.
    Please help!

    Remember that was a test. It tells us the iPhoto is essentially sound and the issue is within that main Library.
    Next move is to try repair that library.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • My scrollbars disappear when resizing my LabView8.6 Block Diagram window

    My design can't be seen in it's entirety within the Block Diagram window so I need to use the vertical and horizontal scrollbars to navigate the design.  The scrollbars disappear if I resize the Block Diagram window past "some point".  If I shrink the window very small, the scrollbars reappear.  Other programs I've generated don't seem to have this problem.  Any suggestions?

    Hi,
    Check the scrollbars settings, right click on vertical/horizontal scrollbars and change the settings. If the problem still exists, U can send me ur vi, let me have a look to know the exact problem.
    regards
    sunil 

  • Scrollbar has disappeared with Yosemite update

    HI
    I updated my mac to Yosemite and my itunes to the current update.
    Now I have scrollbars in iTunes and iPhoto which is making updating my mobile phone impossible.
    I have followed all the advice listed on here and nothing works.
    When I resize my screen, the scroll bar becomes visible for a moment or two. But it completely disappears the moment I touch my magic pad.
    Any help would be greatly appreciated,
    Mish

    Same problem with upgrade to Mavericks and iPhoto 9.6.  When I resize my screen, the scroll bar becomes visible for a moment or two. But it completely disappears when I try to grab the scrolling button with my mouse.

  • Scrollbar disappears; error messages when quitting

    This latest version (3.0.4) of Safari is buggy. I'd appreciate any suggestions:
    1) My scrollbar periodically disappears. I have to quit Safari to have it reappear again. Someone suggested that it might be because I have Acrobat Reader installed on my machine. But I never had this problem before this version emerged from buggysville.
    2) When I quit this version of Safari, I sometimes get an error message saying it quit "unexpectedly." It doesn't interfere with my functionality, since I already quit Safari, but it's annoying nonetheless. Any suggestions?

    If you are updating Safari (or just have):
    Input Managers and other plug-ins from third parties can do as much harm as good. They use a security loophole to reach right into your applications' code and change that code as the application starts up. If you have installed 10.4.11 and Safari is crashing, the very first thing to do is clear out your InputManagers folders (both in your own Library and in the top-level Library), log out and log back in, and try again.
    So, disable all third party add-ons before updating Safari, as they may not have been updated yet for the new version. Add them back one by one. If something goes awry, remove it again and check on the software manufacturer's website for news of an update to match your version of Safari. Remember: Tiger up to 10.4.10 used Safari 2.0.4 or, if you downloaded it, Safari 3.0.3 beta. Safari 10.4.11 uses Safari 3.0.4 which is not a beta. If Safari 3.0.4 on 10.4.11 is not the fastest browser you have ever used, then something is wrong!
    Moreover, trying to revert to Safari 2 when running 10.4.11 can have repercussions, as Safari 3.0.4 uses a completely different webkit on which other applications like iChat, Mail, Dashboard widgets etc also rely.
    Most errors reported here after an update are due to an unrepaired or undetected inherent fault in the system, and/or a third party ad-on. Two such add-on that have been frequently mentioned here, among others, for causing such problems are Piclens and Pithhelmet. If you have them, trash them and go the developer's sites to see if new versions are available for Safari 3.0.4.
    You should also ensure, if you are running Tiger 10.4.11 or Leopard, that you have downloaded and installed the correct version for your Mac of Security Update 2007-009.1.1, which also deals with the latest Java update.

  • The horizontal scrollbar on the timeline in Premiere Pro 5.5 has disappeared.

    The horizontal scrollbar on the timeline in Premiere Pro 5.5 has disappeared.

    Restart computer, hold down alt+shift while opening Premiere until welcome screen.
    See if that will help.
    Otherwise reinstall and use cleanertool
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6 

  • I have the latestversion of Firefox and my vertical scrollbar keeps disappearing.

    The vertical scrollbar keeps disappearing, how do I fix it? Please don't be too technical or I won't understand you.

    Hi chrisbondi,
    You may see that message below the Google search box on www.google.com/firefox which is the old Firefox default home page. That page is no longer being maintained by Google.
    You should try changing your home page to:
    about:home
    If you don't know how to change the home page, you should take a look at the Knowledge Base article [[How to set the home page]].
    Hopefully this helps

  • Scrollbar on imac disappeared

    I use Safari on an iMac that is about 2 years old and runs OSX 8.2.  The scrollbar on the right has disappeared and does not reappear when I move the cursor to the edge of the window. Sometimes I can get it to reappear if I have list of items on the screen -- if I can select one and then move the down arrow, the scrollbar reappears for a short time and I can grab it and move the page down. Otherwise, I cannot navigate lower on the page. How can I ge the scrollbar back?

    Mountain Lion hides automatically scrollbars and they only appears when you're scrolling. To modify it, open System Preferences > General and select Always on Show scroll bars

Maybe you are looking for

  • Lag analytical function and controlling the offset

    Can you help me on that? Small challenge. At least I gave up in half a day. Data ACCOUNT_NUMBER     BATCH_ID     TRANSACTION_DATE     TRANSACTION_TYPE     TRANSACTION_NUMBER     PARENT_TRANSACTION_NUMBER 124680     ZY000489     1/11/2011     62     3

  • Screen Info

    How do you erase icons from the screen?  Some are no longer needed.

  • Merging for Exam: 1Z0-147 and 1Z0-007 and get OCA certification

    Hi, I want to merge my two certification examination that I have successfully passed 1Z0-007 (Introduction to Oracle9i: SQL) from PROMERIC, and 1Z0-147 (Program with PL/SQL) from Pearson VUE. What is the procedure to get both cretification merged and

  • Mirror Image Printing - Photosmart Premium C410A

    How can I print the mirror image on a Photosmart Premium C410A for a t-shirt transfer?

  • IO difference

    Hi all, we are currently having some strange problem. We are running a Oracle 10.2.0.4 Database on Solaris Sparc 10 which is writing constantly with 10 MB/s and about 2000 IOPS to the zpool. Thats what our Sysadmin told me and is the result from "zpo