JDK-4105163 : JTable does not show the scroller in horizontal scrollbar
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: solaris_2.5.1
  • CPU: generic
  • Submitted: 1998-01-20
  • Updated: 1998-01-28
  • Resolved: 1998-01-28
Related Reports
Relates :  
Description
You can easily reproduce the problem by using my sample program. Let's name
it SimpleTableDemo.java. After generating the byte code, you are able to bring
it up. Please try to shrink the SimpleTableDemo widnow size a little bit and
you will see the bug. There is NO scroller on the horizontal scrollbar. 

import com.sun.java.swing.JTable;
import com.sun.java.swing.JScrollPane;
import com.sun.java.swing.JPanel;
import com.sun.java.swing.JFrame;
import java.awt.GridLayout;
import java.awt.Dimension;
import java.awt.event.WindowListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class SimpleTableDemo extends JPanel {
    final Object[][] data = {
	{"Mary", "Campione", "ooooooooooooooooooooooooooo", "5"},
	{"Alison", "Huml", "Rowing", "3"},
	{"Kathy", "Walrath", "Chasing toddlers", "2"},
	{"Mark", "Andrews", "Speed reading", "20"},
	{"Angela", "Lih", "Teaching high school", "4"}
    };
    final Object[] columnNames = {"First Name",
	                          "Last Name",
	                          "Sport",
	                          "Est. Years Experience"};
    public SimpleTableDemo() {
	JTable table = new JTable(data, columnNames);

        //Create the scroll pane and add the table to it.
	JScrollPane scrollPane = JTable.createScrollPaneForTable(table);
	scrollPane.setPreferredSize(new Dimension(400, 100));

	//Add the scroll pane to this panel.
	setLayout(new GridLayout(1, 0));
        add(scrollPane);
    }

    public static void main(String[] args) {
	JFrame frame = new JFrame("SimpleTableDemo");

	frame.addWindowListener(new WindowAdapter() {
	        public void windowClosing(WindowEvent e) {
		    System.exit(0);
		}
	    });

	frame.getContentPane().add("Center", new SimpleTableDemo());
	//frame.setSize(400, 125);
	frame.pack();
	frame.setVisible(true);
    }
}

nasser.nouri@Corp 1998-01-20

Comments
EVALUATION Not a bug.
11-06-2004

PUBLIC COMMENTS The problem here is setAutoResizeMode which need to have the value AUTO_RESIZE_OFF before horizontal scrollers are used. The new example in the SwingSet demo may help to explain this feature.
10-06-2004