Re: how to refresh jComboBox in popupMenuWillBecomeVisible
- From: "Trufel" <trufflecider@xxxxxxxxx>
- Date: 30 Aug 2006 02:38:09 -0700
Rui napisal(a):
NB: I added a setSize() method after adding the ComponentListener to
insure that combo size will be calculated before the frame is made visible.
Thanks! It works. I do it finally in this way:
contentPane.addComponentListener(new
java.awt.event.ComponentAdapter() {
public void componentResized(ComponentEvent e) {
contentPane_componentResized(e);
}
});
void contentPane_componentResized(ComponentEvent e) {
System.out.println("content resized");
int frameCurrentHeight = contentPane.getHeight();
double comboYPosition = myCombo.getBounds().getY();
int fontSize = (int)myCombo.getFont().getSize() + 6;
myCombo.setFixedCellHeight(fontSize);
int rowCount = (int)((frameCurrentHeight - comboYPosition) /
fontSize) - 5;
myCombo.setMaximumRowCount(rowCount);
}
thanks
T.
.
- References:
- Prev by Date: JScrollPane & the scroll speed ?
- Next by Date: Re: JScrollPane & the scroll speed ?
- Previous by thread: Re: how to refresh jComboBox in popupMenuWillBecomeVisible
- Next by thread: hibernate i bytea
- Index(es):
Relevant Pages
|