41 |
import java.awt.Container; |
import java.awt.Container; |
42 |
import java.awt.Dimension; |
import java.awt.Dimension; |
43 |
import java.awt.Graphics; |
import java.awt.Graphics; |
44 |
|
import java.awt.Insets; |
45 |
import java.awt.LayoutManager; |
import java.awt.LayoutManager; |
46 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
47 |
import java.awt.event.MouseEvent; |
import java.awt.event.MouseEvent; |
50 |
|
|
51 |
import javax.swing.CellRendererPane; |
import javax.swing.CellRendererPane; |
52 |
import javax.swing.ComboBoxEditor; |
import javax.swing.ComboBoxEditor; |
53 |
|
import javax.swing.Icon; |
54 |
import javax.swing.JButton; |
import javax.swing.JButton; |
55 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
56 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
212 |
*/ |
*/ |
213 |
protected JButton createArrowButton() |
protected JButton createArrowButton() |
214 |
{ |
{ |
215 |
return new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), |
JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), |
216 |
new CellRendererPane(), listBox); |
new CellRendererPane(), listBox); |
217 |
|
button.setMargin(new Insets(0, 1, 1, 3)); |
218 |
|
return button; |
219 |
} |
} |
220 |
|
|
221 |
/** |
/** |
295 |
*/ |
*/ |
296 |
public Dimension getMinimumSize(JComponent c) |
public Dimension getMinimumSize(JComponent c) |
297 |
{ |
{ |
298 |
// FIXME: this needs work |
MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; |
299 |
Dimension result = super.getMinimumSize(c); |
Icon icon = b.getComboIcon(); |
300 |
result.height = result.height + 9; |
Insets insets = b.getInsets(); |
301 |
return result; |
Dimension d = getDisplaySize(); |
302 |
|
int insetsH = insets.top + insets.bottom; |
303 |
|
int insetsW = insets.left + insets.right; |
304 |
|
int iconWidth = icon.getIconWidth() + 6; |
305 |
|
return new Dimension(d.width + insetsW + iconWidth, |
306 |
|
d.height + insetsH); |
307 |
} |
} |
308 |
|
|
309 |
} |
} |