Is it somehow possible to make the vertical scrollbar scroll horizontally?
vertical scrollbar to scroll horizontally
Collapse
X
-
Are you talking about a JScrollBar? It has an orientation property ...Originally posted by jlgenfIs it somehow possible to make the vertical scrollbar scroll horizontally? -
I don't think that's it; the orientation simply tells the JScrollBar how to display:Originally posted by r035198xAre you talking about a JScrollBar? It has an orientation property ...
horizontally or vertically. Just a scrollbar fires events when it has been moved
and the user is free to interpret those events. I'm a bit curious though what the
OP has in mind ...
kind regards,
JosComment
-
What is it like a joke or something? You want to make a program where you click on a vertical scroll bar and it scrolls it horizontally?
I once say an application that looked like a simple dialog box, it asked the question "Do you approve of the job Bill Clinton is doing?" It had two buttons, one said "Yes, I do." the other said "No, I don't." The funny part was when you moved your mouse toward the "No" button it would move away from your mouse. You could never click on it because it would move away. It was obviously a joke program but still pretty clever.Comment
-
Hah!
[CODE=Java]import java.awt.*;
import java.io.*;
import javax.swing.*;
class HackedScrollpan e extends JScrollPane {
public HackedScrollpan e(Component view) {
super(view);
}
public void twist() {
JScrollBar vert = this.verticalSc rollBar;
JScrollBar horz = this.horizontal ScrollBar;
this.verticalSc rollBar = horz;
this.horizontal ScrollBar = vert;
}
}
public class TextAreaExample implements Runnable {
public static void main(String[] args) throws IOException {
SwingUtilities. invokeLater(new TextAreaExample ());
}
public void run() {
JTextArea textArea= new JTextArea(20, 30);
textArea.setFon t(new Font("serif", Font.PLAIN, 16));
try {
textArea.read(n ew FileReader("Tex tAreaExample.ja va"), null);
} catch (IOException e) {
throw new RuntimeExceptio n(e);
}
JFrame f = new JFrame("TextAre aExample");
f.setDefaultClo seOperation(Win dowConstants.EX IT_ON_CLOSE);
HackedScrollpan e sp = new HackedScrollpan e(textArea);
sp.twist();
f.getContentPan e().add(sp);
f.pack();
f.setLocationRe lativeTo(null);
f.setVisible(tr ue);
}
}[/CODE]Comment
-
it's for a friend of mine, who wants to have a photo gallery of his works on his homepage (he is a painter) and he wants to use the vertical scrollbar for the horizontal scrolling (the horizontal scrollbar is hidden). I know, this is a little bit strange, but I can't figure out, how it could be done.Originally posted by r035198xAre you talking about a JScrollBar? It has an orientation property ...
Thanks for all your answers!Comment
-
Web page? Then why use Java? This is starting to sound like JavaScript hacking, now. How is Java involved?Originally posted by jlgenfit's for a friend of mine, who wants to have a photo gallery of his works on his homepage (he is a painter) and he wants to use the vertical scrollbar for the horizontal scrolling (the horizontal scrollbar is hidden). I know, this is a little bit strange, but I can't figure out, how it could be done.
Thanks for all your answers!Comment
-
<embarrassed>Originally posted by RedSon... twist() ROFL!
Please don't tell anyone you saw me write that hack!
</embarrassed/>Comment
-
Java is involved because i don't see any other ways to make it work. If you think there're other options fot that - i'd appreciate your help.Originally posted by BigDaddyLHWeb page? Then why use Java? This is starting to sound like JavaScript hacking, now. How is Java involved?
And of course this is not a JavaScript hacking.
P.S. sorry for not answering so longComment
Comment