[Java] Specifying the column widths of a JTable as percentages

The widths of the columns of a JTable are specified through TableColumn.setWidth. To set the widths of the columns as percentage, set the widths of column in proportion to each other. For example:

Read more of this post


[Java] Swing Preview Popups

Sometimes in a JTabbedPane, it is nice to show a preview of the contents of tab in the background. This is similar to the windows preview that is available in a number of modern desktop environemnts (such as Windows and Gnome with Compiz). However, the preview popup is not a standard feature in Swing. Here, we look at how this feature may be added to the JTabbedPane.
Read more of this post

[Java] Making Fields Focusable in a JPopupMenu

Custom Swing popups are often created using a JPopupMenu. Some custom popups may contain input fields, such as a JTextField or a JSpinner. For these fields to be able to gain focus when the popup (or popup menu) is displayed, the invoker should be set prior to making it visible with setVisible. The invoker is usually the component that the user has to interact with in order to cause the popup to show. The invoker is set by calling the popup menu’s setInvoker.

Read more of this post