Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSScrollPane Vertical scrollbar covers some of the right side of text of XHTMLPanel #469

Open
renfrow opened this issue Feb 1, 2025 · 4 comments

Comments

@renfrow
Copy link

renfrow commented Feb 1, 2025

I read an html file from my jarfile and display it in an XHTMLPanel that is within an FSScrollPane. The right scroll bar obscures the rightmost part of the text.

Image

@asolntsev
Copy link
Contributor

@renfrow Maybe you should specify FS version and show your code?

@renfrow
Copy link
Author

renfrow commented Feb 8, 2025

flying-saucer-core-9.1.20.jar

NOTE: this is in the init to a class that subclasses JFrame

    XHTMLPanel pane = new XHTMLPanel();
    if(helpUrl != null)
      pane.setDocument(helpUrl.toString());
    FSScrollPane scrollPane = new FSScrollPane(pane);
    // Create an empty border with desired insets
    // Tried to add a border that was inset the width of the vertical scrollbar, had zero effect
    Border border = BorderFactory.createEmptyBorder(0, 0, 0, scrollPane.getVerticalScrollBar().getWidth()); // top, left, bottom, right
    pane.setBorder(border);

    add(scrollPane, BorderLayout.CENTER);

@asolntsev
Copy link
Contributor

@renfrow Sorry, but I cannot reproduce this problem.
Here is my full code:

/**
 * https://github.com/flyingsaucerproject/flyingsaucer/issues/469
 */
public class Issue469Test {
    public static void main(String[] args) {
        new JFrame() {{
            setSize(200, 400);
            XHTMLPanel pane = new XHTMLPanel();
            pane.setDocument("https://raw.githubusercontent.com/flyingsaucerproject/flyingsaucer/refs/heads/main/tests/diff/background/inline/01.xhtml");
            FSScrollPane scrollPane = new FSScrollPane(pane);
            // Create an empty border with desired insets
            // Tried to add a border that was inset the width of the vertical scrollbar, had zero effect
            Border border = BorderFactory.createEmptyBorder(0, 0, 0, scrollPane.getVerticalScrollBar().getWidth()); // top, left, bottom, right
            pane.setBorder(border);

            add(scrollPane, BorderLayout.CENTER);
        }}.show();
    }
}

If you want to get help, please provide a full reproducible example. Ideally, a simple project on github.

issue-469.mp4

@renfrow
Copy link
Author

renfrow commented Feb 13, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants