473,388 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

vertical scrollbar to scroll horizontally

3
Is it somehow possible to make the vertical scrollbar scroll horizontally?
Jan 29 '08 #1
10 2087
r035198x
13,262 8TB
Is it somehow possible to make the vertical scrollbar scroll horizontally?
Are you talking about a JScrollBar? It has an orientation property ...
Jan 29 '08 #2
JosAH
11,448 Expert 8TB
Are you talking about a JScrollBar? It has an orientation property ...
I don't think that's it; the orientation simply tells the JScrollBar how to display:
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,

Jos
Jan 29 '08 #3
RedSon
5,000 Expert 4TB
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.
Jan 29 '08 #4
BigDaddyLH
1,216 Expert 1GB
Hah!

Expand|Select|Wrap|Line Numbers
  1. import java.awt.*;
  2. import java.io.*;
  3. import javax.swing.*;
  4.  
  5. class HackedScrollpane extends JScrollPane {
  6.     public HackedScrollpane(Component view) {
  7.         super(view);
  8.     }
  9.  
  10.     public void twist() {
  11.         JScrollBar vert = this.verticalScrollBar;
  12.         JScrollBar horz = this.horizontalScrollBar;
  13.         this.verticalScrollBar = horz;
  14.         this.horizontalScrollBar = vert;
  15.     }
  16. }
  17.  
  18. public class TextAreaExample implements Runnable {
  19.     public static void main(String[] args) throws IOException {
  20.         SwingUtilities.invokeLater(new TextAreaExample());
  21.     }
  22.  
  23.     public void run() {
  24.         JTextArea textArea= new JTextArea(20, 30);
  25.         textArea.setFont(new Font("serif", Font.PLAIN, 16));
  26.         try {
  27.             textArea.read(new FileReader("TextAreaExample.java"), null);
  28.         } catch (IOException e) {
  29.             throw new RuntimeException(e);
  30.         }
  31.         JFrame f = new JFrame("TextAreaExample");
  32.         f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  33.         HackedScrollpane sp  = new HackedScrollpane(textArea);
  34.         sp.twist();
  35.         f.getContentPane().add(sp);
  36.         f.pack();
  37.         f.setLocationRelativeTo(null);
  38.         f.setVisible(true);
  39.     }
  40. }
Jan 29 '08 #5
jlgenf
3
Are you talking about a JScrollBar? It has an orientation property ...
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.
Thanks for all your answers!
Jan 29 '08 #6
BigDaddyLH
1,216 Expert 1GB
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.
Thanks for all your answers!
Web page? Then why use Java? This is starting to sound like JavaScript hacking, now. How is Java involved?
Jan 29 '08 #7
RedSon
5,000 Expert 4TB
... twist() ROFL!
Jan 29 '08 #8
BigDaddyLH
1,216 Expert 1GB
... twist() ROFL!
<embarrassed>
Please don't tell anyone you saw me write that hack!
</embarrassed/>
Jan 29 '08 #9
r035198x
13,262 8TB
<embarrassed>
Please don't tell anyone you saw me write that hack!
</embarrassed/>
giggle

note: I didn't hear it from RedSon.
Jan 29 '08 #10
jlgenf
3
Web page? Then why use Java? This is starting to sound like JavaScript hacking, now. How is Java involved?
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.
And of course this is not a JavaScript hacking.

P.S. sorry for not answering so long
Feb 3 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David Pratt | last post by:
Hi. I am putting together a database application on Zope. I have built a pager for my records (20 per page) but do not want the browser scroll bars to reset to the top of the browser each time the...
2
by: Don Schneider | last post by:
I tried to setup a frameset which consists of 4 different subframes. Each of these subframes should fetch a different web page from the internet and display it completely (!). BUT: the vertical...
7
by: Pachydermitis | last post by:
Hi all you Experts, I need to scroll a listbox horizontally. For the life of me I cannot get it to move. I can successfully scroll it vertically. I have the handle for the listbox and the scroll...
3
by: lolo | last post by:
hello. happy new year. I'm trying to build a website for my wife and she is adament on having a horizontal thumbnail scrolling div. great. I have a good vertical scrolling thing, but can't...
2
by: alwayssmiling | last post by:
hi, In my application for the panel control im adding seperate vertical scroll control, if i manually scrolls it, then its working fine i.e im able to scroll. But how to scroll with the mouse...
0
by: jazeelkm | last post by:
hi, i am a beginer in the world of C# 1. I want to hide the vertical scrollbar of a listbox . In properties i can hide the horizontal scrollbar , but there s no option for vertical scroll...
1
by: platoon1sc | last post by:
Hi guys.I have a problem with Internet Explorer in my web-application. I have a vertical scrollbar into my jsps but firefox show the vertical srollbar, but IE doesn't. IE show a blank space where...
1
by: bai | last post by:
In my page, I have both horizontal and vertical scroll bars. I want to to some action on Vertical scrollbar click/move and some other action on horizontal scrollbar move/click. How to know whether...
8
by: ayamopamo | last post by:
Hi- I am trying to center a web page. It seems like this should be very simple to do, but apparently it isn't my day. I have successfully centered the background by calling it in the css body tag:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.