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