question on JscrollPane

Hi

I have a table which i want to put in a jscrollpane, below is my code snippet. By this way nothing shows up in the scroll pane. If I just add the table to the tempPanel, like

tempPanel.add(colorTable, BorderLayout.SOUTH);

values are there. Could anyone please let me know why this could happen. Any help is greatly appreciated.

colorTable = new JTable(screenColorModel);

colorTable.setShowGrid(false);

colorTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

colorTable.setBackground(getBackground());

colorTable.setDefaultRenderer(Object[].class, new ScreenColorRenderer());

colorTable.setRowSelectionAllowed(false);

colorTable.setColumnSelectionAllowed(false);

colorTable.setCellSelectionEnabled(false);

colorTable.getColumnModel().getColumn(0).setMaxWidth(30);

colorScroll = new JScrollPane(colorTable);

tempPanel = new JPanel(new BorderLayout());

tempPanel.add(colorScroll, BorderLayout.SOUTH);

Thanks

[1016 byte] By [radsata] at [2007-11-27 11:06:02]
# 1

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",

see http://homepage1.nifty.com/algafield/sscce.html,

that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the "Code Formatting Tags",

see http://forum.java.sun.com/help.jspa?sec=formatting,

so the posted code retains its original formatting.

camickra at 2007-7-29 13:12:41 > top of Java-index,Desktop,Core GUI APIs...