Jscrollpane without scrollbar

adf bc swing appilcation, jdeveloper 10.1.3
this is my form structure
this (gridbag layout)
jscrollpane(default layout)
jpane (null layout)
jpane2
jtabbedpane
jscrollpane size < jpane size
why the scroll bar of the jscrollpane doesn't appear ??

Hi,
it only appears if there are components that are placed outside of the viewport. Add a table and if this is big enough it will cause the scrollbar to show.
You can however set the vertical scrollbar property to always show the scroll bar. By default it only shows it when needed
Frank

Similar Messages

  • JScrollPane with scrollbar as needed packs to the wrong size.

    Hi!
    I just noticed a strange problem when packing a JScrollPane with scrollbar policy "as needed" and wondered if it's me or if it is a real bug in Swing.
    I create a JFrame with a JScrollPane in it and a JPanel as viewportview. The JPanel (called "stuffPanel") contains a few components which give it a preferred size, and the JScrollPane is set to grow as needed if the window grows. A button in the center of the stuffPanel will invoke pack() on the window when clicked.
    Now, if I resize the window such that the JScrollPane can't display the entire stuffPanel, I get scrollbars as expected. If I click the pack button the window correctly resizes to the preferred size (without scrollbars).
    On the other hand, if I resize the window to become larger than the preferred size and then click the pack button, the window (and the stuffPanel) is resized to include 17 pixels of extra size around the edges.
    Put simply, pack() will resize the JPanel to different sizes depending on whether the scrollbars of the JScrollPane were visible at the time. Note that this only occurs when you're using the "scrollbars as needed" scrollbar policy.
    An even more interesting situation occurs if you resize the window to include (for example) only horizontal scrollbars and then packs the window repeatedly...
    Code for a Java app which displays the strange behaviour is included below:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TestJScrollPane {
      static {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        catch (Exception e) { }
      private JFrame mainWindow;
      public TestJScrollPane() {
        mainWindow = createMainWindow();
        mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        mainWindow.pack();
        mainWindow.show();
      public JFrame createMainWindow() {
        JFrame window = new JFrame("Test of scrollpane");
        window.getContentPane().setLayout(new GridBagLayout());
        final JPanel stuffPanel = new JPanel();
        stuffPanel.setBorder(BorderFactory.createTitledBorder("Collection of stuff"));
        stuffPanel.setLayout(new GridBagLayout());
        JLabel stuffLabel = new JLabel("A label");
        JTextField stuffField = new JTextField(10);
        JButton stuffButton = new JButton("Pack the window");
        JList listOfStuff = new JList();
        listOfStuff.setListData(new String[] {"Fish", "Bird", "Mammal", "Insect", "Spider"});
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        stuffPanel.add(stuffLabel, gbc);
        gbc.gridx = 1;
        stuffPanel.add(stuffField, gbc);
        gbc.gridy = 1;
        gbc.gridx = 0;
        gbc.gridwidth = 2;
        stuffPanel.add(stuffButton, gbc);
        gbc.gridy = 2;
        gbc.fill = GridBagConstraints.BOTH;
        stuffPanel.add(listOfStuff, gbc);
        final JScrollPane scroller = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scroller.setViewportView(stuffPanel);
        gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weightx = 1;
        gbc.weighty = 1;
        window.getContentPane().add(scroller, gbc);
        stuffButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mainWindow.pack();
            System.out.println("Stuff panel size: " + stuffPanel.getSize());
            System.out.println("Stuff panel preferred size:" + stuffPanel.getPreferredSize());
            System.out.println("Scroller size: " + scroller.getSize());
            System.out.println("Scroller preferred size: " + scroller.getPreferredSize());
        return window;
      public static void main(String[] args) {
        new TestJScrollPane();
    }

    Why would the JScrollPane be as big as the entire
    frame when you added 800x600 panels on all sides of
    it? It's going to be in the center surrounded by
    huge panels. Thanks, kablair. However, if you look at the code, these panels are not 800x600 on all sides. The north and south panels only add a combined height of 100, and the east and west panels only add a combined width of 100. so the whole window, minus insets, should be 900x700.
    Anyway, i took the advice of the guy above, and that has gotten me much closer. In the bigger app that I'm trying to calculate the size, now I'm only 2 pixels away from the true size, although I can't figure out what I'm forgetting.

  • How to fit videos/imges in tilelist without scrollbars

    Hi
    How to fit and resize even or uneven no.of videos or images in tilelist without scrollbars.Any help is appreciated.
    Thanks
    Srinivas

    Hi Srinivas38,
    You cannot set the VariableRow height for each and every item in the tilelist control. You will have the same height and same width for all the items.
    You do have the variableRowHeight property for TileList as like in a List control ..but it doesn't work...The tilelist control just ignores the property.
    So if you want to fit your images/videos in  a TileList without scroll bars then you need to set the maximum height and width for each item which will remian the same for all the items in TileList.
    Set the verticalScrollPolicy and horizontalScrollPolicy to off for the item(which may be an itemRenderer file you may be using).
    Thanks,
    Bhasker Chari

  • select Tag Mozilla cuts off at 20 IE6 cuts off at 30 We are expecting 30 more lines in drop down list without scrollbar.

    <select> Tag Mozilla cuts off at 20 IE6 cuts off at 30 We are expecting 30 more lines in drop down list without scrollbar.

    it has been answered

  • BIP report using HTML view in dashboard printing without scrollbars, parts

    Have created BI Publisher report in the MS Word using Landscape page settings.The report is printing without scrollbars in the OBIEE Dashboard using HTML view.
    Could not see the whole page output...have tried using resolution property settings in the dashboard configuration...havent found any solution.
    Have tried to use MHTML but the logos are missing.
    Any quick solution for the above will be very helpful.
    Thanks
    Baddam

    Hi Venkat,
    Thanks for your quick respond.
    1.) Auto Run is enabled. And the report runs automatically as well. But then it ignores the dashboard prompt (as a regular report would do as well). But when I choose some values in the prompt and then press go. Then it says I have to press on view as well.
    2.) no that is not the case. My report is so big that it always need a scroll bar ;) also adjusting the size settings in the dashboard doesn't help. The only occurs when viewing in HTML, when previewing in excel or RTF it all just work fine.
    3.) true, but ow well this is the least importetant one ;) so if this doesn't work, than it doesn't work ;)
    4.) Ok, I will have a look on that.
    5.) I did enabled HTML and EXCEL outputs in my BIP report. But when the first point is working, then I don't want to see the control bar anymore and I want to have the output on the dashboard in HTML and then I want to build a button, or a link or something that exports the request to excel. Is that possible?

  • Translate button in CC training videos leads to site without scrollbars

    I was watching a video in CC training, when I noticed the option to let me select the video so that I can translate myself, once I clicked on the closed captioning icon.
    It loaded the Adobe TV website inside the videoframe, but without scrollbars, I was then unable to reach the area that lets me login as a translator, or to select the video to translate.
    We either need scrollbars, or a better way to select the video to be translated in my language from within the CC video player.
    I am not asking how to get the subtitles in my language, I'm already a volunteer translator, and wanted to select the video from within the training area.

    I noticed that this issue is not limited to the translate button, connecting to this tutorial gives me a picture-in picture window: https://helpx.adobe.com/creative-cloud/tutorials/video/ps-touch-overview.html

  • Dynamically scaling assignment block without scrollbar

    We call a BI report in the online fact sheet in SAP CRM 7.0 in the webclient. This BI Report is then shown in the view BIReportProxy of component BSP_DLC_FS.
    We would like to print the fact sheet, however, the BIReport is shown with a scrollbar. Is there a way to show all of the BIReport, independent of the length of the report in the assignmentblock without a scrollbar?

    Hi,
    I can't find this view you mentioned in the component BSP_DLC_FS.
    Have you enhanced the component to create a custom view?
    It looks like you will have to do something in the htm of your view for this.
    You should check the attributes of your thtmlb tags.
    Regards,
    Parul

  • How can I uses JScrollPane without use the constructor?

    This code:
    JPanel pn = new JPanel();
    pn.setPreferredSize(new Dimension(5000, 5000));
    JScrollPane jsp = new JScrollPane(pn);
    Draw a Panel with Scroll Bars.
    But if I write:
    JPanel pn = new JPanel();
    pn.setPreferredSize(new Dimension(5000, 5000));
    JScrollPane jsp = new JScrollPane();
    jsp.add(pn);
    Don�t show the scrollbars. Why? How can I do this code function?
    Thanks for any help.
    Renato

    jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    jsp.setHorizontalScrollBarPolicy(...

  • JScrollPane's scrollbar on left handside

    Is there a way to set JScrollPane's vertical scrollbar on left hand side.

    Well I believe it is more work like this... I preferd to disabled the manager for the vertical JScrollBar and keep the rest of its functionnality... and add a small manager on the extra vertical JScollBar... but we can not know until someone tryies it!!!;0)))
    JRG

  • JScrollPane's scrollbar's position

    Hi All,
    I have a problem in JscrollPane .
    In my swing application , I have used JScrollPane , now on thic pane
    the horizontal scrollbar is bydefault is on the left side of this pane ,
    I want to replace it on the middle of the pane ,
    can anybody help me
    Thanks ,
    Satya

    Your horizontal scroll bar is on the left?? Not on the bottom?
    And you want it in the middle of the scroll pane??
    I can only assume something quite important has been lost in translation here :o)

  • Controlling Content Scrolling inside HBOX without ScrollBars

    hi,
    I want to control the scrolling of the content inside the
    HBOX through a button. Any1 having idea on how i can do it. I don't
    want to use the ScrollBars.
    Thank you

    Change the HBox's horizontalScrollPosition and
    verticalScrollPosition properties. I believe the units are in
    pixels.

  • Mail Message not visible without scrollbar

    When I am typing a new message in Mail, the message goes off the right side of the screen and I can't see it without moving the scroll bar at the bottom to the right.  This just started happening.  I don't like this and want to see my whole message as I type.  What did I do?

    OK, I've had a look round the net and I've found the answer.
    It occurred to me that I'd had the WideMail plug-in installed, and that Mail 4.0 disabled it it. I wondered if that had caused the problem. Sure enough, on the site the the author of WebMail there's this:
    http://www.daneharnett.com/widemail/?p=29
    That fixed it for me.

  • Table without scrollbars

    Dear WD4A-Developer,
    I`m developing an application for mobile handheld devices with a small screen. For that reason, I need any space on the screen. So, I want to remove the vertical scrollbars in tables. Does anybody know how to remove these vertical scrollbars?
    THX
    Armin Dizdarevic

    >I`m developing an application for mobile handheld devices with a small screen>
    First, your really shouldn't use Web Dynpro for this kind of application.  Check the Platform Availability Matrix http://service.sap.com/pam
    Web Dynpro ABAP doesn't support mobile rendering nor any of the mobile versions of web browsers.
    For mobile device development you should consider BSP, ITSMobile, or Sybase tools.

  • Using JTextPane as JTextField

    Hi all!
    I need to use a JTextPane as if it was a JTextField: at first I used JTextField and everything worked fine but then I had to color the text the user types and only JTextPane allows me to do that.
    BUT I would like to use this JTextPane exactly like I use JTextField and this means that when the user types in the JTextPane I would like to "scroll" the text automatically as it happens in JTextField, with no wrapping.
    I searched the forum and I found only temporary hacks...nothing really elegant...
    Does anybody knows THE solution to this topic?
    Thank you in advance
    Gio :-)

    Hi!
    I apologize...sometimes I'm an idiot!!!
    you were right...I solved my problem with this:
                JTextPane t = new JTextPane() {
                        public boolean getScrollableTracksViewportWidth() {
                             return false;
                        public boolean getScrollableTracksViewportHeight() {
                             return false;
                };and then I put the JTextPane into a JScrollPane without scrollbars.
    This way I can use a JTextPane as JTextField (well, 95%...) but it works for my purpose!
    Gio :-)

  • 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.

Maybe you are looking for

  • Problem with logging in to apex application builder listener

    I have problem with my settings and am posting this in hope that someone else out there had similar problem and solved it! I am trying to use reverseproxy to access to our db through apex listener. It's been all set-up and I can login to the applicat

  • Purchase requisition rejection WS65400027

    Hello all, my customer has found out that after upgrade from 4.6 to 6.0 the purchase requisition rejection isnt announced to the PR creator. I have activated the WS65400027 workflow for the REJECTION_START event (connected type in SWE2 and set the WS

  • New Mac os x Leopard 10.5.6 update

    There is a new Mac os x Leoapard 10.5.6 update in the Downloads section of the Apple site dated 19-March-2009. Below is the link http://www.apple.com/downloads/macosx/apple/macosx_updates/macosx1056update.html Is there any difference to the previous

  • Lens profiles not working well

    Very disappointed here. I was looking forward to the automatic lens  correction a la DXoin PS , but unfortunately it doesnt work very well. I tried all my lenses and none gets corrected by the included profiles to a satisfactory degree. My camera is

  • Installation problems with oracle 9iAS v1.0.2.2.2a

    Dear all, i had been having a problem to install oracle 9iAS v1.0.2.2.2a on Windows 2000 Service Pack 2 edition for the past 5 days. I had read through the installation guide and follow steps by steps instructions. but the installer would just stop a