Open noamsuissa opened 3 years ago
So I was able to get that to work with scrollLines(...)
however the text gets erased at it passes though the window's boundaries until eventually there is nothing left. Any ideas on how to preserve all the printed text?
Here is my code:
TerminalFactory factory = new DefaultTerminalFactory();
screen = new TerminalScreen(factory.createTerminal());
if ( screen instanceof TerminalScreen ) {
final Terminal terminal = ((TerminalScreen) screen).getTerminal();
if ( terminal instanceof SwingTerminalFrame ) {
final SwingTerminalFrame swingTerm = (SwingTerminalFrame) terminal;
swingTerm.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int dir = (int) e.getWheelRotation();
screen.scrollLines(0, screen.getTerminalSize().getRows(), dir);
try {
screen.refresh();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
}
}
Right, so when you are using the Screen, it's like a double-buffered bitmap so there is no scrollback history. If you want to be able to scroll, I think you need to stay in pure Terminal mode (so don't create the TerminalScreen).
Hi,
I am new to this library and was wondering if someone can point me in the right direction for being able to scroll up or down in a Screen with a mouse wheel. Is this feature supported?
Thanks