Showing posts with label swing. Show all posts
Showing posts with label swing. Show all posts

Saturday, March 7, 2015

Autocomplete JTextField

http://stackabuse.com/article/example-code/example-adding-autocomplete-to-jtextfield

Autocomplete can be very useful in just about any application, but its not trivial to implement. So here is a quick example of how you might do it in Java's Swing framework with JTextField (it should also work with JTextArea with only a few modifications). This example is a modified version of Oracle's example.

Monday, October 24, 2011

Java Swing MVC

It is said that the MVC in SWING is really MV/C. What this means it that most SWING components (Views) are pre-coupled with a default Model. The programmer only needs to add a Controller (EventListener) to it, to get it to a workable state.

While this is true for most cases, but usually only for simpler components, like JButton etc. The more complex components, like JTable, JTree or JList, require you to provide them with your own custom Model to get them to a fully functional state.

Reference: http://compsci.ca/v3/viewtopic.php?t=11199

Saturday, October 9, 2010

Disabled JSplitPane causes the resize cursor not working in JTable

I just found that whenever I disable a JSplitPane with setEnabled(false) then all the JTable in the pane will stop showing the resize cursor on the table header even though they are still resizable. So if you have to disable JSplitPane (make it not resizable) but still want the JTable in it be resizable then you need to provide your own resizer as below and apply it to your JTable this way new TableHeaderCursorResizer(jTable);