Results 1 to 5 of 5
- 11-12-2008, 01:10 AM #1
Member
- Join Date
- Nov 2008
- Posts
- 19
- Rep Power
- 0
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.
-
In my SSCCE the scroll position seems to persist. Are you doing something different than I'm doing here?
Java 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(); } }); } }
- 11-12-2008, 09:59 AM #3
Member
- Join Date
- Nov 2008
- Posts
- 19
- Rep Power
- 0
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.
- 11-12-2008, 10:16 AM #4
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
- 11-12-2008, 11:16 AM #5
Member
- Join Date
- Nov 2008
- Posts
- 19
- Rep Power
- 0
Similar Threads
-
Regd the scrollbar in a table in JSP
By itmani2020 in forum Advanced JavaReplies: 4Last Post: 08-13-2008, 01:26 PM -
How to use vertical and horizontal sliders in SWT
By Java Tip in forum SWTReplies: 0Last Post: 07-02-2008, 08:06 PM -
Need JFileChooser Help
By Wraithier in forum New To JavaReplies: 4Last Post: 06-18-2008, 05:40 PM -
Using java.awt.Scrollbar
By Java Tip in forum Java TipReplies: 0Last Post: 01-03-2008, 09:19 AM -
how to use JFileChooser
By tommy in forum New To JavaReplies: 1Last Post: 08-06-2007, 08:49 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks