80 size.height += insets.top + insets.bottom;
81 int buttonSize = iconAreaWidth();
82 size.width += insets.left + insets.right + buttonSize;
83
84 cachedMinimumSize.setSize( size.width, size.height );
85 isMinimumSizeDirty = false;
86
87 return size;
88 }
89
90 protected ComboPopup createPopup() {
91 return new MotifComboPopup( comboBox );
92 }
93
94 /**
95 * Overriden to empty the MouseMotionListener.
96 */
97 @SuppressWarnings("serial") // Superclass is not serializable across versions
98 protected class MotifComboPopup extends BasicComboPopup {
99
100 public MotifComboPopup( JComboBox comboBox ) {
101 super( comboBox );
102 }
103
104 /**
105 * Motif combo popup should not track the mouse in the list.
106 */
107 public MouseMotionListener createListMouseMotionListener() {
108 return new MouseMotionAdapter() {};
109 }
110
111 public KeyListener createKeyListener() {
112 return super.createKeyListener();
113 }
114
115 protected class InvocationKeyHandler extends BasicComboPopup.InvocationKeyHandler {
116 protected InvocationKeyHandler() {
117 MotifComboPopup.this.super();
118 }
119 }
120 }
160 }
161 // Draw the separation
162 if(MotifGraphicsUtils.isLeftToRight(comboBox)) {
163 r.x -= (HORIZ_MARGIN + 2);
164 }
165 else {
166 r.x += r.width + HORIZ_MARGIN + 1;
167 }
168 r.y = in.top;
169 r.width = 1;
170 r.height = comboBox.getBounds().height - in.bottom - in.top;
171 g.setColor(UIManager.getColor("controlShadow"));
172 g.fillRect(r.x,r.y,r.width,r.height);
173 r.x++;
174 g.setColor(UIManager.getColor("controlHighlight"));
175 g.fillRect(r.x,r.y,r.width,r.height);
176 }
177 }
178
179 public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
180 ListCellRenderer renderer = comboBox.getRenderer();
181 Component c;
182 Dimension d;
183 c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false);
184 c.setFont(comboBox.getFont());
185 if ( comboBox.isEnabled() ) {
186 c.setForeground(comboBox.getForeground());
187 c.setBackground(comboBox.getBackground());
188 }
189 else {
190 c.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
191 c.setBackground(UIManager.getColor("ComboBox.disabledBackground"));
192 }
193 d = c.getPreferredSize();
194 currentValuePane.paintComponent(g,c,comboBox,bounds.x,bounds.y,
195 bounds.width,d.height);
196 }
197
198 protected Rectangle rectangleForArrowIcon() {
199 Rectangle b = comboBox.getBounds();
200 Border border = comboBox.getBorder();
|
80 size.height += insets.top + insets.bottom;
81 int buttonSize = iconAreaWidth();
82 size.width += insets.left + insets.right + buttonSize;
83
84 cachedMinimumSize.setSize( size.width, size.height );
85 isMinimumSizeDirty = false;
86
87 return size;
88 }
89
90 protected ComboPopup createPopup() {
91 return new MotifComboPopup( comboBox );
92 }
93
94 /**
95 * Overriden to empty the MouseMotionListener.
96 */
97 @SuppressWarnings("serial") // Superclass is not serializable across versions
98 protected class MotifComboPopup extends BasicComboPopup {
99
100 public MotifComboPopup( JComboBox<Object> comboBox ) {
101 super( comboBox );
102 }
103
104 /**
105 * Motif combo popup should not track the mouse in the list.
106 */
107 public MouseMotionListener createListMouseMotionListener() {
108 return new MouseMotionAdapter() {};
109 }
110
111 public KeyListener createKeyListener() {
112 return super.createKeyListener();
113 }
114
115 protected class InvocationKeyHandler extends BasicComboPopup.InvocationKeyHandler {
116 protected InvocationKeyHandler() {
117 MotifComboPopup.this.super();
118 }
119 }
120 }
160 }
161 // Draw the separation
162 if(MotifGraphicsUtils.isLeftToRight(comboBox)) {
163 r.x -= (HORIZ_MARGIN + 2);
164 }
165 else {
166 r.x += r.width + HORIZ_MARGIN + 1;
167 }
168 r.y = in.top;
169 r.width = 1;
170 r.height = comboBox.getBounds().height - in.bottom - in.top;
171 g.setColor(UIManager.getColor("controlShadow"));
172 g.fillRect(r.x,r.y,r.width,r.height);
173 r.x++;
174 g.setColor(UIManager.getColor("controlHighlight"));
175 g.fillRect(r.x,r.y,r.width,r.height);
176 }
177 }
178
179 public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
180 ListCellRenderer<Object> renderer = comboBox.getRenderer();
181 Component c;
182 Dimension d;
183 c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false);
184 c.setFont(comboBox.getFont());
185 if ( comboBox.isEnabled() ) {
186 c.setForeground(comboBox.getForeground());
187 c.setBackground(comboBox.getBackground());
188 }
189 else {
190 c.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
191 c.setBackground(UIManager.getColor("ComboBox.disabledBackground"));
192 }
193 d = c.getPreferredSize();
194 currentValuePane.paintComponent(g,c,comboBox,bounds.x,bounds.y,
195 bounds.width,d.height);
196 }
197
198 protected Rectangle rectangleForArrowIcon() {
199 Rectangle b = comboBox.getBounds();
200 Border border = comboBox.getBorder();
|