Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:44:42+00:00 2026-05-28T18:44:42+00:00

I have a Component that uses MigLayout as its LayoutManager. It is set to

  • 0

I have a Component that uses MigLayout as its LayoutManager. It is set to grow inside the JScrollPane to occupy the whole available width. So if I resize the appliation’s frame, the JScrollPane is as wide as the frame is and the inside component is as well.

However, when I shrink the frame, the grown component inside the JScrollPane just keeps its width and does not shrink, so horizontal scrollbars are displayed.

I am aware of JScrollpane needs to shrink its width and implemented the Scrollable-Interface with getScrollableTracksViewportWidth=true but MigLayout does not seem to honor it.

Any advice? thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:44:43+00:00Added an answer on May 28, 2026 at 6:44 pm

    I solved it with following scala-snippet. Scala’s Scrollable is just a fake wrapper, you are supposed to implement the Java-Scrollable…

    import javax.swing.JPanel
    import javax.swing.{Scrollable => JScrollable}
    import javax.swing.BoxLayout
    import java.awt.Dimension
    import java.awt.Rectangle
    import scala.swing.SequentialContainer
    import scala.swing.Orientation
    import scala.swing.Scrollable
    import scala.swing.Panel
    
    class ScrollablePanel extends Panel with SequentialContainer.Wrapper with Scrollable.Wrapper {
    
      var scrollIncrement: Int = 10
      var blockScrollIncrement: Int = 50
    
      val allowVerticalScrolling: Boolean   = true
      val allowHorizontalScrolling: Boolean = false
    
      override lazy val peer = new JPanel with SuperMixin with JScrollable {
        def getPreferredScrollableViewportSize: Dimension =
          getPreferredSize
    
        def getScrollableTracksViewportHeight: Boolean =
          !allowVerticalScrolling
    
        def getScrollableTracksViewportWidth: Boolean =
          !allowHorizontalScrolling
    
        def getScrollableBlockIncrement(visibleRect: Rectangle, orientation: Int, direction: Int): Int =
          scrollIncrement
    
        def getScrollableUnitIncrement(visibleRect: Rectangle, orientation: Int, direction: Int): Int =
          blockScrollIncrement
      }
    
      final protected def scrollablePeer: JScrollable = peer
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a web component that uses jQuery and I want to distribute
I have a managed Windows application that loads a managed C++ component that uses
I have installed my windows application that uses TeeChart ActiveX (a COM Component for
I have a web application that uses Ext-JS 2.2. In a certain component, we
We have a WinForms application written in C# that uses the AxAcroPDFLib.AxAcroPDF component to
I am creating C# application that uses OCX component. I have this component from
I have an event in a component (VCLZip) that uses the comp type, but
I have a web application that uses an ActiveX COM component, for example: <OBJECT
I have a rather simple CakePHP app that uses the Auth component to restrict
I have a Joomla 1.5 component that uses a call to the editor class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.