0

Im currently using the following code

tableModel.setDataVector(data, columnNames);
jTable2 = new JTable(tableModel);        
JOptionPane.showMessageDialog(null, new JScrollPane(jTable2));

and when I execute it, the resulting size looks like below

enter image description here

How can I make message dialog bigger, so that we can see the column headings? I want to remove those '...'

Thanks!

mKorbel
  • 109,525
  • 20
  • 134
  • 319
vvavepacket
  • 1,882
  • 4
  • 25
  • 38

1 Answers1

0

Set a preferredSize to the JScrollPane ?

Javier92
  • 773
  • 6
  • 12
  • yes its working now... why is that setSize is not working? but if I use setPreferredSize, its working? Thanks! – vvavepacket Sep 26 '14 at 14:15
  • 1
    @IvanMatala See [here](http://stackoverflow.com/questions/1783793/java-difference-between-the-setpreferredsize-and-setsize-methods-in-compone) for example/ – user1803551 Sep 26 '14 at 14:17
  • Thanks for sharing the link. This is basically the ONE question every beginner will have someday with Swing. – Javier92 Sep 26 '14 at 14:19
  • 2
    [Don't use `setPreferredSize()` when you really mean to override `getPreferredSize()`](http://stackoverflow.com/q/7229226/230513) or [`getPreferredScrollableViewportSize()`](http://stackoverflow.com/a/14429388/230513). – trashgod Sep 26 '14 at 15:58