Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-12-2008, 03:10 AM
Member
 
Join Date: Nov 2008
Posts: 5
nenadm is on a distinguished road
JFileChooser horizontal scrollbar problem
Hi,
I use JFileChooser to make possible to user to navigate among great number of files and folders. However it is desirable that file chooser always stay positioned on the position of last selected file.
But for some reason horizontal scroll bar don't stay at last position but always stay centered. Moreover it have desirable behaviour only if user dont scroll horizontaly at all (remember position), but if user scroll to the end, close and again open file chooser, it dont remember last position.
I am interested is it possible in some way to work upon on position of JFileChooser scroll bar or handle this situation.
Thanks alot.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-12-2008, 05:56 AM
Fubarable's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 1,289
Fubarable is on a distinguished road
In my SSCCE the scroll position seems to persist. Are you doing something different than I'm doing here?
Code:
import java.awt.event.*; import javax.swing.*; public class JFCTest { private JPanel mainPanel = new JPanel(); private JFileChooser jfc = new JFileChooser(); public JFCTest() { JButton openJfcBtn = new JButton("Open JFileChooser"); mainPanel.add(openJfcBtn); openJfcBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jfc.showDialog(mainPanel, "Go For It!"); } }); } public JComponent getComponent() { return mainPanel; } private static void createAndShowUI() { JFrame frame = new JFrame("JFCTest"); frame.getContentPane().add(new JFCTest().getComponent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { createAndShowUI(); } }); } }
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-12-2008, 11:59 AM
Member
 
Join Date: Nov 2008
Posts: 5
nenadm is on a distinguished road
Well just one thing and i think there is a problem, i set preferred position of my JFileChooser. When i use default window dimensions all works fine.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-12-2008, 12:16 PM
Senior Member
 
Join Date: Sep 2008
Posts: 317
Darryl.Burke is on a distinguished road
Off hand I'd say that shouldn't be a problem either provided you set the position just once, before you display the chooser for the first time.

db
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 11-12-2008, 01:16 PM
Member
 
Join Date: Nov 2008
Posts: 5
nenadm is on a distinguished road
Thank you guys,
i find out that problem is in centering my file chooser.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regd the scrollbar in a table in JSP itmani2020 Advanced Java 4 08-13-2008 03:26 PM
How to use vertical and horizontal sliders in SWT Java Tip SWT 0 07-02-2008 10:06 PM
Need JFileChooser Help Wraithier New To Java 4 06-18-2008 07:40 PM
Using java.awt.Scrollbar Java Tip Java Tips 0 01-03-2008 11:19 AM
how to use JFileChooser tommy New To Java 1 08-06-2007 10:49 PM


All times are GMT +3. The time now is 11:39 AM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org