• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting default size of a column in a Netbeans windowBuilder?

 
Dwayne Barsotta
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added A Jtable to my GUI design.  It has 2 Columns {"Date", "Note Summary"}.  I want to set the width of the Date column to something smaller then the 50% of the table width.  I have tried to Right click table -> Choose "table Content" -> under "column" tab set the "Pref.Width to 15 from default.  This seems to not work, It keeps showing as default when I run the window.

I have also added the following to an event I set up by in properties "Events" tab -> select the ".." beside the "componentShown" -> adding a handler "tblNotesComponentShown" -> finally in the code for that even I added the following line.



There is some generated code that looks like this:



I wanted to add tblNotes.getColumnModel().getColumn(0).setWidth(20); under  tblNotes.getColumnModel().getColumn(1).setPreferredWidth(10);  But it wouldn't allow me to adjust edit the generated code.

Does anyone have any better idea??  I am really new in NetBeans GUI and would really love to be able to complete the GUI with it.

Thank You
 
Lexi Turgeon
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you create your GUI through the drag and drop GUI builder? If so I believe you can drag the windows to make them whatever size you would like. Let me know if this works.
 
Dwayne Barsotta
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did create the table drag and drop.  I have no problem resizing the table itself, the problem is resizing the width of the first (date) column.  At this point I'm going to move onto other aspects of the application and move back to the table later.  I might have to complete the project, then go back in another editor and edit the code directly.  Not sure how to approach this problem yet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic