As a way of helping to organize this website, here is a collection of links to my current JScrollPane tutorials and examples:
MVC Controller - our MainController class
As its name implies, the MainController is the main controller/coordinator of our MVC application. It creates the other controllers, and in many ways then turns control over to these other controllers. One of the controllers it creates is the ProcessController.
Whew, getting all the images together for the Tame Swing sample applications is taking a little time and a lot of effort. I hadn't thought about how to organize it, and now that I have a better feel for what I want to do it's just a matter of time.
If you want to see the images of the running applications I do have them on a temporary page here. Please note that this page may change at any time.
In a heavy day of JFormDesigner use, I just learned how to create a JComboBox in a column in a JTable, using only JFormDesigner.
First, create your JTable in JFormDesigner. I'll skip the details here, hoping that process is easy enough. Then, click the ellipsis button for the model property in the Properties list. This brings up the JTable model editor.
I just noticed that you can set the preferred size of a column in a JTable using JFormDesigner. If you're looking at a JTable in the normal JFormDesigner view, click the ellipsis button for the model property in the Properties list. This brings up the JTable model editor.
Next, click a cell in the column you want to modify. Then on the bottom-right of this dialog you'll see a few fields labeled "Pref. Width", "Min. Width", and "Max. Width". Just type in a value you want for the preferred width of your column.
JTable popup menu introduction
Here's a copy of a class file I created to demonstrate how to put a popup menu (JPopupMenu) on a JTable in a Java application. Actually, the intent of this particular class was to see if I could get the popup menu to work on the header cell of a JTable, but that ended up being a no-brainer.
Here's an example of how to add a JPopupMenu to a JTable. The purpose of the popup menu is to let the user right-click on contents in the table and work directly with those contents.
In the code below I've taken a real class and trimmed it down considerably for these demo purposes. I hope the code remaining is useful enough to help you implement your own JPopupMenu on a JTable, or perhaps in other components as well.
Here is a quick example of how to set JTable column widths. I don't know if this is a perfect solution, but it is one possible solution:
Ouch ... here's a quick little ditty on how to properly size a JDialog to fit the size of a wide/large JTable that it contains.
(From a recent email.) Help, I have a 13-column JTable, inside of a jscroll pane, inside of a borderlayout, inside a JDialog. Ideally, I would like the dialog to initially open up to the correct width needed to display the 13 columns without horizontal scrolling.
Setting the preferred width of each column (only) does not work very well. Setting the minWidth gets the columns to open up to the correct width, but then the last 7 or so columns fall off the right hand side of the dialog.