0

Like in HTML we can scroll to the specific part of the page using the id of that section, detailed explanation. Is it possible to implement the same in Java desktop application where I have a scroll pane. I could not find any such functionality. Any suggestions would be helpful.

Vishrant
  • 15,456
  • 11
  • 71
  • 120
  • What is your specific problem? Sounds like you already know what you want to do and how to do it: Create a JTabbedPane, add a help section to the last Pane and show it when certain conditions are met. – Ben May 15 '18 at 14:15
  • 1
    Welcome to Stack Overflow! It appears that you have not taken the [tour](https://stackoverflow.com/tour). You should consider doing that and reviewing [How to Ask](https://stackoverflow.com/help/how-to-ask). As it stands this question is pretty broad and doesn't demonstrate a lot of effort on your part. – rmlan May 15 '18 at 14:16

2 Answers2

0

There are a couple of options:

  1. You can programmatically scroll the scroll pane, but this will create issues as the resolution changes from screen to screen.
  2. You can have a WebView and write HTML inside it. Example.
Vishrant
  • 15,456
  • 11
  • 71
  • 120
-1

where I have a scroll pane

You can control the positioning of the viewport of the scroll pane by using:

scrollPane.getViewport().setViewPosition(...);

So if you know the component you want at the top of the viewport you can get the location of the component and then use that as the Point for the view position.

camickr
  • 321,443
  • 19
  • 166
  • 288