JScrollPane in a JFrame scrollbars visible but not functional no thumbtabs

Here is the code that I compiled and run on J2SE v. 1.4.2 (runtime b28). I looked through the various related articles and nothing seems to help with this issue. The scrollbars appear along with the panel but the thumbtabs are not present. Any help would be appreciated.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test {
  public static void main(String[] args){
    Test rce = new Test();
    JFrame frame = new JFrame("Test Scroll");
    JScrollPane scrollBar = new JScrollPane();
    scrollBar.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollBar.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    Component  rcePage = rce.createComponents();
    scrollBar.getViewport().add(rcePage, null);
    frame.getContentPane().add(scrollBar, null);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setSize(400, 400);
    frame.setVisible(true);
  public Component createComponents() {
    JPanel pan = new JPanel();
    JLabel label = new JLabel("This is a Test!");
    pan.setBorder(BorderFactory.createEmptyBorder(
        0, //top
        0, //left
        0, //bottom
        0) //right
    pan.setLayout(null);
    label.setBounds(100, 100, 80, 20);
    pan.add(label);
    return pan;
}

This is a very common mistake. When you put a JPanel in a scrollpane, the scrollpane will use the panel's preferred size to determine if scrolling is needed or not. If the panel is using a LayoutManager this is generally done for you automatically. But in your case you set the layout to null, and then it is your responsibility to make sure that the getPreferredSize() method of the panel returns the correct size.
One way to fix this in the code you posted would be to override the getPreferredSize() of the panel, like so:
    public Component createComponents() {
        JPanel pan = new JPanel() {
            public Dimension getPreferredSize() {
                return getSize();
    }Then the scrollbars will appear if you make the frame smaller.
But what I really suggest is that you use a LayoutManager.

Similar Messages

  • How do i make the back and forward buttons function? they are visible but not functional.

    I have firefox 8.0.1 and my back and forward button are not working. They are visible but not functioning. I have tried starting in safemode and without any add-ons and the back and forward buttons are still not functioning. What do I need to do to make the buttons functional?

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    *https://support.mozilla.com/kb/Bookmarks+not+saved#w_places-database-file

  • After loading FF4 the back/forth buttons are visible but not functional. Have tried to reset tool bar etc. no luck. fix please

    After upgrading to the new version everything seems to work well except my back/forth button on the browser are visible but grayed out and not functional. I have tried all of the suggestions in help and am unable to bring them to life. Very frustrating to use a browser with out these functions. I run 4 websites and it is maddening to have to keep reloading the sites just for simple work.
    I have to have these working or will be forced to use another browser. I liked the old FF much better. I can not tolerate this much longer.

    I notice from your system specs that you're running a very old version of Flash. Could you try updating to the latest one which is 10.2.159.1 It also contains a patch to fix a recently discovered [http://www.h-online.com/security/news/item/Adobe-releases-security-update-for-Flash-Player-1228930.html Zero Day exploit]. You can get it from here: http://get.adobe.com/flashplayer/
    Have you experienced any unusual events watching Flash videos lately? It's possible that you may have been a victim of just such an attack. It might be worth doing a malware scan using this well-known scanner from http://www.malwarebytes.org/ The free version is more than adequate to eliminate any current threats.

  • The Menu bar is visible but not functional, I have to force-quit Firefox 4.0 every time I want to close the application.

    This is a recurring but not constant problem I encounter while running Firefox 4.0 on my MacBook OSX10.6.7. The Menu bar across the very top of the screen will be visible, but none of the menus will work if I click on them (File, Edit, View, History, etc.) I have to force-quit Firefox and restart it to get it to work again.
    Also, my pinned tabs have disappeared, for no apparent reason. And to be honest, this version is way slower and buggier than my old Firefox, and it's driving me nuts.

    Hello DRAnderson100, try to delete the [http://kb.mozillazine.org/Localstore.rdf localstore.rdf] in [http://kb.mozillazine.org/Profile_folder_-_Firefox profile folder] and check it again.
    see for more info : [http://kb.mozillazine.org/Corrupt_localstore.rdf Corrupt localstore.rdf]
    thank you

  • I cannot turn on the wifi for my 4g. The button is visible but non functional. suggestions?

    I cannot turn on the wifi for my 4G. The button is visible but non functional. Suggestions?

    Hello! Does the wifi button look greyed out? Here is a link regarding this issue: http://support.apple.com/kb/ts1559
    What you will need to do is to first to reset network settings by going to Settings>General>Reset>Reset Network Settings, NOTE: When you do this all bluetooth/wifi passwords will be forgotten. If the issue persists then we need to do a simple backup and restore.
    Follow http://support.apple.com/kb/ht1766 and http://support.apple.com/kb/ht1414 on how to backup and restore, when you restore please restore as new, do not restore the backup just yet if the Wifi is greyed out then there is a hardware issue and the device needs to be serviced. Please check your local Apple Store or call into Apple regarding service options and warranty status. Hope this helps!

  • HP Photoprinter C7280 printer. The wireless radio is on but not functioning - so no wifi conection.

    HP Photoprinter C7280 printer. The wireless radio is on but not functioning  - so am unable to gain wifi connection and print! - Why?   How do I fix, Thanks

    I would guess that the printer's wireless radio has died.  Have you tried plugging the printer into your wireless router with an Ethernet cable?  It should work and give you the same functions as wireless.  Your computer or router will not care how the printer is connected.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Apple RAID Card after System Disk Failure: Volume visible but not mountable

    Hi,
    Im running a Mac Pro with 10.5.8. Server has a workgroup server. The Mac Pro is equipped with a Apple RAID Card running three 1TB SATA Drives and a SAS drive for the System. The three 1TB drives are used by a RAID5 to store the data the SAS drive was used for the system. After a power failure the SAS drive was dead and I installed a new drive and reinstalled the system with the DVDs that were in the box. After that the RAID5 is not mounted by the system anymore although I can sea it in the RAID Utility but not with its volume name but with the name R2V1.
    What can I do to save the data on that RAID?
    Thanks
    Phil

    It's tough to find info on your specific model but the Raid card listed in the Apple Store (http://store.apple.com/us/product/MB845Z/A?mco=MTY3ODQ5OTY) states you must use all SAS drives or all SATA drives with the card. Are you sure that the drive that died was a SAS drive?

  • Access points are directly connected to 2016 wlc but not functional

    Hello All,
    access points are directly connected to 2016 wlc.
    Event log from the wlc
    AP event log download completed.
    ======================= AP Event log Contents =====================
    *Mar 1 00:00:30.157: %LINK-3-UPDOWN: Interface Dot11Radio0, changed state to up
    *Mar 1 00:00:30.161: %LINK-5-CHANGED: Interface Dot11Radio1, changed state to reset
    *Mar 1 00:00:30.190: %LINK-3-UPDOWN: Interface Dot11Radio1, changed state to up
    *Mar 1 00:00:30.191: %LINK-5-CHANGED: Interface Dot11Radio0, changed state to reset
    *Mar 1 00:00:30.204: %LINK-3-UPDOWN: Interface Dot11Radio0, changed state to up
    *Mar 1 00:00:31.190: %LINEPROTO-5-UPDOWN: Line protocol on Interface Dot11Radio1, changed state to up
    *Mar 1 00:01:00.088: %LWAPP-3-CLIENTEVENTLOG: Did not get vendor specific options from DHCP.
    *Mar 1 00:01:00.088: %LWAPP-3-CLIENTEVENTLOG: Did not get log server settings from DHCP.
    *Mar 1 00:01:00.089: %LWAPP-3-CLIENTEVENTLOG: Did not get any DNS options from DHCP.
    *Mar 1 00:01:00.089: %LWAPP-3-CLIENTEVENTLOG: Performing DNS resolution for CISCO-LWAPP-CONTROLLER
    *Mar 1 00:01:00.089: %LWAPP-3-CLIENTERRORLOG: DNS Name Lookup: could not resolve CISCO-LWAPP-CONTROLLER
    *Mar 1 00:01:12.094: %LWAPP-5-CHANGED: LWAPP changed state to JOIN
    *Mar 1 00:01:12.094: %LINK-5-CHANGED: Interface Dot11Radio0, changed state to administratively down
    *Mar 1 00:01:12.094: %LINK-5-CHANGED: Interface Dot11Radio1, changed state to administratively down
    *Mar 1 00:01:12.094: %LINEPROTO-5-UPDOWN: Line protocol on Interface Dot11Radio0, changed state to down
    *Mar 1 00:01:12.095: %LINEPROTO-5-UPDOWN: Line protocol on Interface Dot11Radio1, changed state to down
    (Cisco Controller) >show port summary
               STP   Admin   Physical   Physical   Link   Link
    Pr  Type   Stat   Mode     Mode      Status   Status  Trap     POE
    1  Normal  Forw Enable  Auto       100 Full   Up     Enable  N/A
    2  Normal  Disa Disable Auto       Auto       Down   Enable  N/A
    3  Normal  Disa Disable Auto       Auto       Down   Enable  N/A
    4  Normal  Disa Disable Auto       Auto       Down   Enable  N/A
    5  Normal  Disa Disable Auto       Auto       Down   Enable  N/A
    6  Normal  Disa Disable Auto       Auto       Down   Enable  N/A
    7  Normal  Forw Enable  Auto       100 Full   Up     Enable  Enable  (Power On )
    8  Normal  Forw Enable  Auto       100 Full   Up     Enable  Enable  (Power On )
    but still access points are not functional ????
    any idea ??
    Regards

    Your AP-manager and management interfaces is mapped to port 1:
    ap-manager                       1    80       10.41.80.2      Static  Yes    No
    only APs connected to port 1 will work.
    You need to either use a switch and keep port 1 connected to it while APs join through the switch or you need to create a new ap-manager interface. not even sure if you can map it to the same port or different port! not even sure about the management interface!! it is mapped to port 1 and should be reachable anyway. it is a mess!!! have you read the best practice document that I put the link for earlier?
    So you need eventually a switch to fix your issue. direclty connected APs are not recommended.
    I am still not knowing how Cisco provided such swtich that is supposed to handle direclty connected Aps while it does not provide a smooth way to do so.
    Use a switch and everything supposed to be fine.
    HTH
    Amjad

  • Scroll bar visible but not able to scroll in custom screen for IW21

    Hi,
    We are using custom tab (screen exit) in transaction for creating notifications (TCode IW21). Two subscreens are configured to be embedded in the tab, combined area of which is exceeding screen size vertically. The scroll bar is visible in the tab but is not able to scroll using mouse scroll, but can be dragged up and down.
    Does anyone know how to make it scrollable or make the scroll bar visible at application level (not in tab) and make it working?
    Thank you,
    Deepak

    Hello,
    Would you please implement the Methods GET_DATA to get th data from Databas to screen fields and SET_dATA to update thedata from custom screen fields to Data base table in u r case LFB1.
    Regards,

  • What could make a JOptionPane visible but not showing?

    Hello,
    I use FEST-swing to implement automated validation tests of a GUI application.
    At one point the conversation being tested involves a modal dialog implemented using one of JOptionPane.showXxxDialog(...) methods.
    When I automate cancelling the dialog (clicking the cancel button), I also check that the dismissed dialog is now hiding (FEST's dialogFixture.requiresNotVisible() , which in the end calls theDialog.isVisible() ).
    My problem is that sometimes (I haven't identified any correlation so far), the dialog is still visible ( isVisible==true ), which fails my test, whereas on eye-witness inspection, the dialog is indeed not shown on the screen, and on code-tracing, it is not showing ( showing==false ).
    - One trail to investigate could be improper usage of the EDT, but FEST-swing is supposed to issue Fixture checks on the EDT. I'll report that to the apporpriate mailing list.
    - Another trail is, do you see a reason why the JOptionPane's dialog, could have visible=true and showing=false?
    I'm sorry, I cannot produce an SSCCE (it works in simpler cases, plus it would require using the FEST-swing library).
    Thanks in advance, and regards.
    J.

    I should add that I use a something.waitForIdle() method in the testing lib API that supposedly wait until there are no more event in the EDT, and I also put manual Thread sleeps to let stuff happen. So I don't think it's related to e.g. the "bringing down" not having finished to processed when I check the visibility. But of course, you are encouraged to question my assumptions :o)

  • If I put audio in my video the blocks are visible but not the waves?

    I can't get the wave visible by using moderation under clip, but it cost a lot of time to do them all that way and it isn't music but spoken word. My video's are mostly one and a half hour or longer. But on the end I have a tune, and after use it by two or three video's the music disappears, unless there is music in it. How is this possible? Do I have everytime to restart the program to undo it?
    Is it possible that this can be repaired, because this way it cost loads of time and I do have a lot of video's to work out with.
    I ask this question also in my own language(Dutch), but this seems to be an English spoken-forum.

    Hans
    Thanks for the reply. I think that I am losing something in the details going between Dutch and English and Dutch. We may be using different terms for the same feature.
    About Time Lapse....you can still create Time Lapse video in Premiere Elements 13....the essentials are images in series that you drag to the Timeline and take the file duration of each image down to 5 to 1 frame. (0.2 second to 0.04 second).
    See ATR Premiere Elements Troubleshooting: PE: Time Lapse Video Basics
    I think that I have figured out what you meant by "moderation" and the rest of that. Are you trying to create Narration clips to go along with your videos and photos on the Timeline? Is that your "spoken word" .mp3? If you create narration clips with the Premiere Elements Narration Tool (Tools Menu/Narration), the narration clip is created as .wav file, and it gets automatically placed at the position of the Timeline Indicator on the Timeline. See screenshot for the Narration dialog that you see after clicking on Tools Menu/Narration.
    Look to the left in the Narration Track to where it says Narration. To the left of that is a microphone. If you click on that, one tap at a time, you bring up the waveform that you see in the screenshot or just a view of straight black line. Those choices are called audio track display styles.
    Please review and consider the above, and then let me know if I have targeted the information you are seeking. If we are not in sync yet, please let me know.
    Thank you.
    ATR

  • Airport Express USB Printer Visible, but Not Printing

    I've connected my printer (HPc7260) to my Airport Express. It is visible on the network. But print jobs get stopped and the print utility says the printer is offline.
    Any thoughts?
    +This question is also posted in follow up to a thread I started earlier, which was answered helpfully by Duane (thread: How Setup Airport Express for Wireless Printing to HP Photosmart C7280) Sorry for redundancy and clutter. I hadn't followed up on the old thread for a few days. Thought it might not get another response.+

    Solved.
    A restart, followed by reselecting the printer in the print dialog got the job done.

  • Lost shared network visibility but not internet connection

    4 days ago I brought my i-mac osx 10.6.8 to the office, plugged in the network cable and was immediately connected to the shared network. This morning the network showed up but was not accessible. It showed an error when I tried to access a network folder. I restarted the computer and the shared network disappeared but I am still connected to the internet. Noone else is having problems. Any ideas? 

    If it's not you, have you checked with the folks that are maintaining the local network?
    What was the error that was reported when trying to access a network folder?
    If you're connecting to a server of some sort, your client may have to be added and reconfigured to allow access to the server(s) and the local security, or potentially to the network itself.  (If this is a moderate- or larger-sized office, virtual LANs and the managed switches are fairly common, and can cause your system to be treated as a guest system, for instance.)

  • Display Audio - USB setting visible, but not selectable.

    I have my 24" hooked up via USB, the mic pick up works fine. But when I go to the Output and click on "Display Audio - USB" the selection *jumps back* to what I had before, in my case headphones. What am I doing wrong?

    Okay, I had to unplug the headphones from the headphone jack on the front of my tower for the Display Audio Output to work.
    So my next question is, how do I keep my headphones jacked in without them usurping control of the audio output?

  • Itunes syncing photos to Ipad - Tab visible but not loading

    Hello
    having an issue syncing photos from Itunes to my Ipad.
    I have a MacBook Pro and Ipad Air, latest version of maverick, IOS7 and Itunes.
    When i connect my Ipad to my Macbook everything is working fine, except the tab for the photos.
    I can access it. But from there I only see the loading icon. For hours, I even let it run for a whole night, nothing.
    Every other tab is working (apps, music, books, etc.)
    I'm using Aperture and Iphoto on the macbook.
    Any idea? I talked my gf into buying an Ipad because it's sooo cool to watch pictures. Now I have a problem
    Thx
    Dominik

    I've had this issue myself and it was annoying. The only way I could get it to work again was Reset my iPad and start it as new.  Full discussion here:
    iTunes shows deleted videos/songs etc on iPad when connected
    I think you'll find the screenshots match what you see pretty much perfectly.
    Regards,
    Steve

Maybe you are looking for