Like many modern mice and trackpad, my laptop supports vertical and horizontal scrolling. This is a addictive feature when you use it. I just want to support horizontal scrolling through my trackpad / mousewill of Java applications, but everywhere I find it seems it is not possible in Java.
I must really tell anyone that I am doing something in some way is wrong, this facility has already requested behavior:
It is easy to do the job Actually, the app I'm working on is a deal breaker. In fact, for any app I can imagine! I've invested some time in the Java backend, so I really want to find a solution to this simple thing.
The question is, what can I do to implement this behavior? Are raw OS level events also being in contact with Java, would I have to write it from scratch?
import java.awt. *; Public Square ScrollExample Spreads In Canvas {Public Zero Color (Graphics G) {g.setColor (Color.green); Jiffil (0, 4, 400, 400); } Public static zero main (string [] args) {ScrollExample b = New ScrollExample (); Frame F = new frame ("scroll down the example"); ScrollPane scroller = New ScrollPane (ScrollPane.CROLLBARS_ALWAYS); Scroller.add (b, "center"); F.setPreferredSize (new dimension (500,500)); F.add ("center", scroller); F.pack (); F.show (); }}
Swing example works with both horizontal and vertical scrolling
import java.awt. *; Import javax.swing *; Public Square ScrollExample, JPanel {Public Zero Color (Graphics G) {SuperPaint (G); G.setColor (Color.green); Jiffil (0, 4, 400, 400); } Public static zero main (string [] args) {JFrame f = new JFrame ("example scroll"); ScrollExample p = new ScrollExample (); P.setPreferredSize (new dimension (1000, 1000)); JScrollPane scroller = New JScrollPane (P, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); Scroller.getHorizontalScrollBar () setUnitIncrement (10) Scroller.getVerticalScrollBar () setUnitIncrement (10). F.setPreferredSize (new dimension (500,500)); F.add (Scroller, Border Layout. CA); F.pack (); F.show (); }}
This is supported by default in swing though horizontal scrolling of vertical scoring The priority is when both scrollbar are visible.
I think there is no new development needed in Swing Abt. Edit:
You should be able to use it to customize scroll speed.