Since you have a large Jpanel, it is possible that you have already added it to a Jscrollpane, so you can "see" the entire Jpanel, according to the bar, if you have not done this, do a search in Jscrollpanes, but basically you will do the following:
Container cp=getContentPane();
JPanel pnJogo=new JPanel();//aqui vai ficar a interface do jogo
JScrollPane sc=new JScrollPane(pnJogo);//adicionando o painel ao ScrollPane
After this, you can set the value of your Scroll as you add, but from this point, the criterion of setValue is with you!
final JScrollBar bar1 = seuScroll.getHorizontalScrollBar();
bar1.setValue(10);//isso pode estar dentro de um for, ou um ActionListener também, por exemplo.
And, it would be a good idea too, you block the Scrollpane, so that the user can not "analyze" the phase before going forward, because then, take the "emotion" of the game, I apologize, but this is an idea, I do not know how to "block" the bar (if anyone knows, feel free to edit the answer)
an example of how you can do this, then comfort the character while walking, you will increase the value of the scrollbar
Hello. Please provide more details. What is the "end of the panel"? You are using a
panel
to simulate a horizontal scrolling, is that it? Edit the question to provide more information so someone can help you, such as adding images of the screen you have and want and the relevant code snippet.– Luiz Vieira