Given
import javax.swing.*;
public class TestCornerComponent {
public static void main(String args[]) {
JTable table = new JTable();
final JScrollPane scrollPane = new JScrollPane(table);
/* button to put in corner */
JButton cornerButton = new JButton("#");
scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER,
cornerButton);
scrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("Test corner component");
frame.getContentPane().add(scrollPane);
frame.setVisible(true);
}
});
}
}
how might one make the cornerButton always visible, irrespective of whether the JTable is empty or not?
I see that the JXTable in SwingX accomplishes this however, I wasn't able to decipher from the source code how it was done.
Thanks