Class TextPaneResizer

  • All Implemented Interfaces:
    LegendSizeListener, ComponentListener, EventListener

    public class TextPaneResizer
    extends ComponentAdapter
    implements LegendSizeListener
    A Listener that adapts a JTextPane according to the Scrollpane enclosing the pane. Without this listener, the TextPane would always try to assume the maximal extension, which would make the Scrollpane have an extremely large viewport.
    Author:
    Thomas Pfau
    • Constructor Detail

      • TextPaneResizer

        public TextPaneResizer​(JTextPane pane,
                               int minsize,
                               int offset)
        Default constructor with a provided minimal width, an offset to adjust the width coming in and the Pane to resize.
        Parameters:
        pane - The textpane this resizer will be added to
        minsize - The minimal size to use
        offset - The remaining space between this component and the width
      • TextPaneResizer

        public TextPaneResizer​(JTextPane pane)
        Default parameters will be used for the given pane (300 width, 2 offset)
        Parameters:
        pane - The pane to use this Resizer for