{"id":1062,"date":"2021-01-13T15:23:24","date_gmt":"2021-01-13T15:23:24","guid":{"rendered":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/?page_id=1062"},"modified":"2021-01-13T15:41:21","modified_gmt":"2021-01-13T15:41:21","slug":"scroll-bars-scroll-panes","status":"publish","type":"page","link":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/swing-gui-components\/scroll-bars-scroll-panes\/","title":{"rendered":"Scroll Bars &#038; Scroll Panes"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a21c36e5e001\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a21c36e5e001\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/swing-gui-components\/scroll-bars-scroll-panes\/#Scroll_Bars\" >Scroll Bars<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/swing-gui-components\/scroll-bars-scroll-panes\/#Scroll_Panes\" >Scroll Panes<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"wp-block-paragraph\">Whenever the information in a GUI component cannot be conveniently stored in the area available, it is conventional to place that component in a scrolling region, with scroll bars to move the data into and out of the visible area.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Java components that support this are&nbsp;<strong><em>scroll bars<\/em><\/strong>&nbsp;and&nbsp;<strong><em>scroll panes<\/em><\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Scroll_Bars\"><\/span>Scroll Bars<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can use a scroll bar as a slider control, specifying the range it slides between.&nbsp;You can orient the slide horizontally or vertically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You use&nbsp;<strong><em>adjustment events<\/em><\/strong>&nbsp;to detect changes to the position of the scroll bar.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; highlight: [3,9,10,16,17,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,70,71,72,73,74,78,79,80,81,82,83,84,85,98,99,100,101,102,103]; title: ; quick-code: false; notranslate\" title=\"\">\npackage swingExamples;\n\nimport java.awt.Adjustable;\nimport java.awt.BorderLayout;\nimport java.awt.Color;\nimport java.awt.Container;\nimport java.awt.GridLayout;\n\nimport java.awt.event.AdjustmentEvent;\nimport java.awt.event.AdjustmentListener;\n\nimport javax.swing.BorderFactory;\nimport javax.swing.JFrame;\nimport javax.swing.JLabel;\nimport javax.swing.JPanel;\nimport javax.swing.JScrollBar;\nimport javax.swing.SwingConstants;\n\nclass ColorSelectPanel extends JPanel\n{\n  public ColorSelectPanel()\n  {\n    setLayout(new BorderLayout());\n    m_colorPanel = new ColorPanel();\n    add(m_colorPanel, BorderLayout.CENTER);\n    add(new ScrollPanel(), BorderLayout.SOUTH);\n  }\n  \n  \/\/\/\/\/\/ Private data \/\/\/\/\/\/\n  private ColorPanel m_colorPanel;\n  \n  \/\/\/\/\/\/ Inner classes \/\/\/\/\/\n  class ColorPanel extends JPanel\n  {\n    ColorPanel()\n    {\n      setBorder(\n          BorderFactory.createLineBorder(Color.BLACK));\n    }\n  }\n  \n  class ScrollPanel extends JPanel \n      implements AdjustmentListener\n  {\n    public ScrollPanel()\n    {\n      setLayout(new GridLayout(3, 2));\n      \n      add(m_redLabel);\n      m_redScroll.setBackground(Color.RED);\n      m_redScroll.setBlockIncrement(BLOCK_INCREMENT);\n      m_redScroll.addAdjustmentListener(this);\n      add(m_redScroll);\n      \n      add(m_greenLabel);\n      m_greenScroll.setBackground(Color.GREEN);\n      m_greenScroll.setBlockIncrement(BLOCK_INCREMENT);\n      m_greenScroll.addAdjustmentListener(this);\n      add(m_greenScroll);\n      \n      add(m_blueLabel);\n      m_blueScroll.setBackground(Color.BLUE);\n      m_blueScroll.setBlockIncrement(BLOCK_INCREMENT);\n      m_blueScroll.addAdjustmentListener(this);\n      add(m_blueScroll);\n      \n      changeColor();\n    }\n    \n    \/\/ AdjustmentListener required methods\n    public void adjustmentValueChanged(AdjustmentEvent evt)\n    {\n      changeColor();\n    }\n    \n    private void changeColor()\n    {\n      int red = m_redScroll.getValue();\n      int green = m_greenScroll.getValue();\n      int blue = m_blueScroll.getValue();\n      m_redLabel.setText(&quot;&quot; + red);\n      m_greenLabel.setText(&quot;&quot; + green);\n      m_blueLabel.setText(&quot;&quot; + blue);\n      m_colorPanel.setBackground(\n          new Color(red, green, blue));\n    }\n    \n    \/\/\/\/\/\/\/\/\/\/\/\/\/\/ Private Data \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n    private static final int BLOCK_INCREMENT = 16;\n    \n    private JLabel m_redLabel = \n        new JLabel(&quot;0&quot;, SwingConstants.CENTER);\n    private JLabel m_greenLabel = \n        new JLabel(&quot;0&quot;, SwingConstants.CENTER);\n    private JLabel m_blueLabel = \n        new JLabel(&quot;0&quot;, SwingConstants.CENTER);\n    \n    private JScrollBar m_redScroll =\n        new JScrollBar(Adjustable.HORIZONTAL, 0, 0, 0, 255);\n    private JScrollBar m_greenScroll =\n        new JScrollBar(Adjustable.HORIZONTAL, 0, 0, 0, 255);\n    private JScrollBar m_blueScroll =\n        new JScrollBar(Adjustable.HORIZONTAL, 0, 0, 0, 255);\n  }\n}\n\nclass ColorSelectFrame extends JFrame\n{\n  public ColorSelectFrame()\n  {\n    setTitle(&quot;Scrollbars&quot;);\n    setSize(300, 200);\n    setDefaultCloseOperation(EXIT_ON_CLOSE);\n    Container contentPane = getContentPane();\n    contentPane.add( new ColorSelectPanel() );\n  }\n}\n\npublic class Scrollbars\n{\n  public static void main(String&#x5B;] args)\n  {\n    ColorSelectFrame frame = new ColorSelectFrame();\n    frame.setVisible(true);\n  }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">which produces:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/Scrollbars.gif\" alt=\"\" class=\"wp-image-1066\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As each scrollbar is dragged to some new value, the background color of the top panel changes to correspond, and the labels to the left show the component value for each color.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Scroll_Panes\"><\/span>Scroll Panes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A more common use for scrolling is <em>to scroll a large area in a small window.&nbsp;&nbsp;&nbsp;<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; highlight: [24,80,81,82,83,84,85,86,87,88,122,123,124,125,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,291,292,293,294]; title: ; quick-code: false; notranslate\" title=\"\">\npackage swingExamples;\n\nimport java.awt.Adjustable;\nimport java.awt.BorderLayout;\nimport java.awt.Color;\nimport java.awt.Container;\nimport java.awt.Cursor;\nimport java.awt.Dimension;\nimport java.awt.Graphics;\nimport java.awt.Point;\n\nimport java.awt.event.AdjustmentEvent;\nimport java.awt.event.AdjustmentListener;\nimport java.awt.event.ComponentAdapter;\nimport java.awt.event.ComponentEvent;\nimport java.awt.event.MouseAdapter;\nimport java.awt.event.MouseEvent;\nimport java.awt.event.MouseListener;\nimport java.awt.event.MouseMotionListener;\nimport java.util.ArrayList;\n\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\nimport javax.swing.JScrollBar;\n\nclass PanelScrollerPanel extends JPanel \n{\n  public PanelScrollerPanel()\n  {\n    \/\/ Set up the mouse event handling\n    MouseHandler handler = new MouseHandler();\n    addMouseListener(handler);\n    addMouseMotionListener(handler);\n  }\n  \n  \/**\n   *   Adds a new square at x, y\n   *\/\n  public void add(int x, int y)\n  {\n    m_squares.add( new Point(x, y) );\n    repaint();\n  }\n  \n  \/**\n   * Finds the square that corresponds to the \n   * coordinates x,y.  If there is no square at \n   * these coordinates, returns null;\n   *\/\n  public Point find(int x, int y)\n  {\n    for (Point point : m_squares)\n    {\n      \/\/ Do these coordinates match somewhere\n      \/\/ within this square?\n      int xlo = point.x - SQUARE_LENGTH \/ 2;\n      int xhi = point.x + SQUARE_LENGTH \/ 2;\n      int ylo = point.y - SQUARE_LENGTH \/ 2;\n      int yhi = point.y + SQUARE_LENGTH \/ 2;\n      if ( (xlo &lt;= x) &amp;&amp; (x &lt;= xhi)\n        &amp;&amp; (ylo &lt;= y) &amp;&amp; (y &lt;= yhi)\n      )\n        return point; \/\/ Yes\n    }\n    return null; \/\/ No match\n  }\n  \n  \/**\n   *   Removes the specified square.\n   *\/\n  public void remove(Point point)\n  {\n    if (point != null)\n    {\n      m_squares.remove(point);\n      repaint();\n    }\n  }\n  \n  \/**\n   *   Stores scroll offsets, and then repaints.\n   *\/\n  public void translate(int x, int y)\n  {\n    m_dx = x;\n    m_dy = y;\n    repaint();\n  }\n  \n  \/**\n   * Paints the panel, drawing the current \n   * set of squares.\n   *\/\n  public void paintComponent(Graphics g)\n  {\n    super.paintComponent(g);\n    \/\/ Translate to appropriate coordinates\n    g.translate(-m_dx, -m_dy);\n    \/\/ Draw the outer rectangle in red.\n    g.setColor(Color.RED);\n    g.drawRect(0, 0, MAX_WIDTH - 1, MAX_HEIGHT - 1);\n    \/\/ Draw each square\n    g.setColor(Color.BLACK);\n    for (Point square : m_squares)\n    {\n      draw(g, square);\n    }\n  }\n  \n  \/**\n   *   Draws the ith square in the Graphics context.\n   *\/\n  private void draw(Graphics g, Point square)\n  {\n    g.drawRect(square.x - SQUARE_LENGTH \/ 2,\n               square.y - SQUARE_LENGTH \/ 2,\n               SQUARE_LENGTH, SQUARE_LENGTH);\n  }\n  \n  \/\/\/\/\/\/ Private data \/\/\/\/\/\/\n  \n  \/\/ The maximum size of the area\n  \/\/ (mouse clicks outside this area have no effect)\n  static final int MAX_WIDTH = 300;\n  static final int MAX_HEIGHT = 200;\n  \n  private static final int SQUARE_LENGTH = 10; \n                            \/\/ Size of a square\n  \n  \/\/ The set of squares\n  private ArrayList&lt;Point&gt; m_squares = \n                          new ArrayList&lt;Point&gt;();\n  \/\/ Scroll offsets.\n  private int m_dx = 0;\n  private int m_dy = 0;\n  \n  \/\/\/\/\/\/\/\/ Inner classes \/\/\/\/\/\/\n  \n  \/**\n   * Hamdler for mouse events and mouse motion.\n   *\/\n  class MouseHandler extends MouseAdapter\n  {\n    \/\/\/\/\/ MouseListener required methods\n\n    \/**\n     * If the mouse was pressed outside an \n     * existing square, adds a new square at \n     * these coordinates.\n     *\/\n    public void mousePressed(MouseEvent evt)\n    {\n      int x = evt.getX() + m_dx;\n      int y = evt.getY() + m_dy;\n      Point point = find(x, y);\n      if (point == null)\n      {\n        \/\/ Not inside an existing square, \n        \/\/ so add a square to the panel\n        if ( (x &lt; MAX_WIDTH) &amp;&amp; (y &lt; MAX_HEIGHT))\n        {\n          add(x, y);\n        }\n      }\n    }\n\n    \/**\n     * If the mouse double-clicks on a aquare, \n     * removes the square.\n     *\/\n    public void mouseClicked(MouseEvent evt)\n    {\n      if (evt.getClickCount() &gt;= 2)\n      {\n        int x = evt.getX();\n        int y = evt.getY();\n        remove( find(x, y) );\n      }\n    }\n\n    \/\/\/\/\/ MouseMotionListener required methods\n  \n    \/**\n     * Causes the mouse cursor to change to a \n     * crosshairs when over a square, and to a\n     * normal cursor when not.\n     *\/\n    public void mouseMoved(MouseEvent evt)\n    {\n      int x = evt.getX();\n      int y = evt.getY();\n      Cursor cursor = null;\n      if (find(x, y) != null)\n      {\n        cursor = Cursor.getPredefinedCursor(\n                          Cursor.CROSSHAIR_CURSOR);\n      }\n      else\n      {\n        cursor = Cursor.getDefaultCursor();\n      }\n      setCursor(cursor);\n    }\n\n    \/**\n     * When the mouse is over a square, \n     * and is dragged, moves the square with it.\n     *\/\n    public void mouseDragged(MouseEvent evt)\n    {\n      int x = evt.getX();\n      int y = evt.getY();\n      \/\/ Find the corresponding square\n      Point square = find(x, y);\n      if (square != null)\n      {\n        Graphics g = getGraphics();\n        g.setXORMode(getBackground());\n        draw(g, square);\n        square.x = x;\n        square.y = y;\n        draw(g, square);\n        g.dispose();\n      }\n    }    \n  }\n}\n\nclass PanelScrollerFrame extends JFrame \n    implements AdjustmentListener\n{\n  public PanelScrollerFrame()\n  {\n    setTitle(&quot;PanelScroller&quot;);\n    setSize(300, 200);\n    setDefaultCloseOperation(EXIT_ON_CLOSE);\n    Container contentPane = getContentPane();\n    contentPane.add(m_panel, BorderLayout.CENTER);\n    \n    \/\/ Add the vertical scrollbar to the east\n    contentPane.add(\n        m_verticalScroller, BorderLayout.EAST);\n    m_verticalScroller.addAdjustmentListener(this);\n    m_verticalScroller.setValues(\n        m_verticalScroller.getValue(),\n        0, 0, PanelScrollerPanel.MAX_HEIGHT);\n    \n    \/\/ Add the horizontal scrollbar to the south\n    contentPane.add(\n        m_horizontalScroller, BorderLayout.SOUTH);\n    m_horizontalScroller.addAdjustmentListener(this);\n    m_horizontalScroller.setValues(\n        m_horizontalScroller.getValue(),\n        0, 0, PanelScrollerPanel.MAX_WIDTH);\n    \n    \/\/ Add a component listener to the frame,\n    \/\/ to cause the scrollbars to display correctly \n    \/\/ on show and resize.\n    addComponentListener( new ComponentAdapter()\n      {\n        public void componentShown(ComponentEvent evt)\n        {\n          setVisibleAmounts();\n        }\n\n        public void componentResized(ComponentEvent evt)\n        {\n          setVisibleAmounts();\n        }\n      }\n    );\n  }\n  \n  public void adjustmentValueChanged(AdjustmentEvent evt)\n  {\n    m_panel.translate(\n        m_horizontalScroller.getValue(),\n        m_verticalScroller.getValue());\n  }\n  \n  private void setVisibleAmounts()\n  {\n    Dimension dim = m_panel.getSize();\n    m_horizontalScroller.setVisibleAmount(dim.width);\n    m_verticalScroller.setVisibleAmount(dim.height);\n  }\n  \n  \/\/\/\/\/ Private data \/\/\/\/\/\n  private PanelScrollerPanel m_panel = \n      new PanelScrollerPanel();\n  private JScrollBar m_horizontalScroller =\n      new JScrollBar(Adjustable.HORIZONTAL);\n  private JScrollBar m_verticalScroller =\n      new JScrollBar(Adjustable.VERTICAL);\n}\n\npublic class PanelScroller\n{\n  public static void main(String&#x5B;] args)\n  {\n    PanelScrollerFrame frame = new PanelScrollerFrame();\n    frame.setVisible(true);\n  }\n}\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">which produces:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/Scroll5.jpg\" alt=\"\" class=\"wp-image-1073\"\/><figcaption>Initial state, after squares added<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img decoding=\"async\" width=\"389\" height=\"288\" src=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/Scroll6.jpg\" alt=\"\" class=\"wp-image-1074\" srcset=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/Scroll6.jpg 389w, https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/Scroll6-300x222.jpg 300w\" sizes=\"(max-width: 389px) 100vw, 389px\" \/><figcaption>and when the window is expanded.<\/figcaption><\/figure><\/div>\n\n\n\n<div style=\"height:18px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Notice that there are no squares outside the red rectangular area. This is because the scrollbars are defined only on that area.&nbsp; This results in mouse clicks not having any effect outside the red rectangular area.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever the information in a GUI component cannot be conveniently stored in the area available, it is conventional to place that component in a scrolling region, with scroll bars to move the data into and out of the visible area. The Java components that support this are&nbsp;scroll bars&nbsp;and&nbsp;scroll panes. Scroll Bars You can use a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":71,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","_uag_custom_page_level_css":"","ocean_post_layout":"left-sidebar","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"ocs-course-topics-sidebar","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","footnotes":""},"class_list":["post-1062","page","type-page","status-publish","hentry","entry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"ocean-thumb-m":false,"ocean-thumb-ml":false,"ocean-thumb-l":false},"uagb_author_info":{"display_name":"Bryan Higgs","author_link":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/author\/bryan\/"},"uagb_comment_info":0,"uagb_excerpt":"Whenever the information in a GUI component cannot be conveniently stored in the area available, it is conventional to place that component in a scrolling region, with scroll bars to move the data into and out of the visible area. The Java components that support this are&nbsp;scroll bars&nbsp;and&nbsp;scroll panes. Scroll Bars You can use a&hellip;","_links":{"self":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/1062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/comments?post=1062"}],"version-history":[{"count":12,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/1062\/revisions"}],"predecessor-version":[{"id":1080,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/1062\/revisions\/1080"}],"up":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/71"}],"wp:attachment":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/media?parent=1062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}