295 focusRect.width = size.width-(focusInsets.left+focusInsets.right)-1; |
295 focusRect.width = size.width-(focusInsets.left+focusInsets.right)-1; |
296 focusRect.height = size.height-(focusInsets.top+focusInsets.bottom)-1; |
296 focusRect.height = size.height-(focusInsets.top+focusInsets.bottom)-1; |
297 |
297 |
298 double fsize = (double) checkBoxSize; |
298 double fsize = (double) checkBoxSize; |
299 myCheckMark = AffineTransform.getScaleInstance(fsize / MASTER_SIZE, fsize / MASTER_SIZE).createTransformedShape(MASTER_CHECKMARK); |
299 myCheckMark = AffineTransform.getScaleInstance(fsize / MASTER_SIZE, fsize / MASTER_SIZE).createTransformedShape(MASTER_CHECKMARK); |
300 |
300 } |
301 } |
301 @Override |
302 |
302 void paintPeer(final Graphics g) { |
303 public void paint(Graphics g) { |
303 //layout(); |
304 if (g != null) { |
304 Dimension size = getPeerSize(); |
305 //layout(); |
305 Font f = getPeerFont(); |
306 Dimension size = getPeerSize(); |
306 flush(); |
307 Font f = getPeerFont(); |
307 g.setColor(getPeerBackground()); // erase the existing button |
308 |
308 g.fillRect(0,0, size.width, size.height); |
309 flush(); |
309 if (label != null) { |
310 g.setColor(getPeerBackground()); // erase the existing button |
310 g.setFont(f); |
311 g.fillRect(0,0, size.width, size.height); |
311 paintText(g, textRect, label); |
312 |
312 } |
313 if (label != null) { |
313 |
314 g.setFont(f); |
314 if (hasFocus()) { |
315 paintText(g, textRect, label); |
315 paintFocus(g, |
316 } |
316 focusRect.x, |
317 |
317 focusRect.y, |
318 if (hasFocus()) { |
318 focusRect.width, |
319 paintFocus(g, |
319 focusRect.height); |
320 focusRect.x, |
320 } |
321 focusRect.y, |
321 // Paint the checkbox or radio button |
322 focusRect.width, |
322 if (checkBoxGroup == null) { |
323 focusRect.height); |
323 paintCheckbox(g, cbX, cbY, checkBoxSize, checkBoxSize); |
324 } |
324 } |
325 |
325 else { |
326 // Paint the checkbox or radio button |
326 paintRadioButton(g, cbX, cbY, checkBoxSize, checkBoxSize); |
327 if (checkBoxGroup == null) { |
|
328 paintCheckbox(g, cbX, cbY, checkBoxSize, checkBoxSize); |
|
329 } |
|
330 else { |
|
331 paintRadioButton(g, cbX, cbY, checkBoxSize, checkBoxSize); |
|
332 } |
|
333 |
|
334 } |
327 } |
335 flush(); |
328 flush(); |
336 } |
329 } |
337 |
330 |
338 // You'll note this looks suspiciously like paintBorder |
331 // You'll note this looks suspiciously like paintBorder |