How to dynamically add a custom component to a JFileChooser dialog
chooser.addAncestorListener(new AncestorListener() {
public void ancestorAdded(AncestorEvent event) {
((JDialog) SwingUtilities.windowForComponent(chooser))
.getContentPane().add(checkBox, BorderLayout.SOUTH);
}
public void ancestorMoved(AncestorEvent event) {}
public void ancestorRemoved(AncestorEvent event) {}
});
public void ancestorAdded(AncestorEvent event) {
((JDialog) SwingUtilities.windowForComponent(chooser))
.getContentPane().add(checkBox, BorderLayout.SOUTH);
}
public void ancestorMoved(AncestorEvent event) {}
public void ancestorRemoved(AncestorEvent event) {}
});
0 Comments:
Post a Comment
<< Home