Hi all, I am experiencing problem with JTable while displaying the results. If records are more than to fit in the size of frame, scrollpane is showing vertical scrollbar. It's fine. But in that situation only one column is occupying the whole frame. I am not able to see the other colums unless I adjust the column headers or by maximizing the frame size. Moreover, scrollpane not showing the Horizontal scrollbar even if I reduce the width of frame. If the displayed records fit in the size of frame(I mean no need of vertical scrollbar in this case..to dispaly 10 to 15 records), in this case I can see all columns and it is working fine. I am getting problem only when Vertical Scrollbar comes in the frame.. Please help me in this regard.. what might be the reason for this problem?? and did anyone face this problem?? Thanks in advance.. [ October 31, 2002: Message edited by: jyothi sunke ]
Joined: Sep 11, 2002
Hello!!! please go through my post and help me!!! Thank you..
hi, I did the following. Added this ... JScrollPane scrollPane = new JScrollPane(table); scrollPane.setSize(600, 300); this.getContentPane().add(scrollPane, BorderLayout.CENTER); to my JFrame. Thats all. Works great. I did not experience such behaviour. Maybe this helps... jay
JTable table = new JTable(new MyDataModel()); JScrollPanel scroller = new JScrollPane(); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // In this way the column header of the table doens't scroll. scroller.setColumnHeaderView(table.getTableHeader()); scroller.setViewportView(table); Hope it helps.
Thank you Jay and Andrea.. Are u allowing the user to resize the frame or not?? Ofcourse I am allowing the user to resize the frame..But I just wanted to know. If I set that setResizable property false, will it come in violation of the reqirementS?
It will not violate the requirements, no. Some people here told they did use the setResizable(false) and succeeded in their exam. However, the general trends is to allow resizing, as it is more close to reality. No application nowadays forbids resizing. But of course, FBN is just an exercise. Hope it helps Stephane