@@ -215,13 +215,6 @@ protected void paintFocus(
215
215
Graphics g , AbstractButton b , Rectangle viewRect , Rectangle textRect , Rectangle iconRect ) {
216
216
if (!button .isEnabled ()) return ;
217
217
paintFocusRing (g , (JButton ) b );
218
- // paintFocusBorder(g, (JButton) b);
219
- }
220
-
221
- @ Override
222
- public void update (Graphics g , JComponent c ) {
223
- super .update (g , c );
224
- if (!button .isFocusOwner ()) paintBorderButton (g , c );
225
218
}
226
219
227
220
@ Override
@@ -277,37 +270,21 @@ protected void paintFocusRing(Graphics g, JButton b) {
277
270
g2 .dispose ();
278
271
}
279
272
280
- @ Deprecated
281
- protected void paintFocusBorder (Graphics graphics , JButton b ) {
282
- if (!b .isEnabled () || !borderEnabled ) {
283
- return ;
284
- }
285
- Color color ;
286
- if (defaultButton != null && defaultButton ) {
287
- color = UIManager .getColor ("Button[Default][focus].color" );
288
- } else {
289
- color = UIManager .getColor ("Button[focus].color" );
290
- }
291
- Graphics2D graphics2D = (Graphics2D ) graphics .create ();
292
- graphics2D .setStroke (new BasicStroke (2f ));
293
-
294
- graphics2D .setRenderingHint (RenderingHints .KEY_ANTIALIASING , RenderingHints .VALUE_ANTIALIAS_ON );
295
- int w = b .getWidth () - 1 ;
296
- int h = b .getHeight () - 1 ;
297
-
298
- graphics2D .setColor (color );
299
- graphics2D .drawRoundRect (0 , 0 , w , h , arch + 2 , arch + 2 );
300
- graphics2D .dispose ();
301
- }
302
-
303
273
protected void paintBorderButton (Graphics graphics , JComponent b ) {
274
+ // the button is disabled or the user don't want the borders
275
+ // enables on your hand
304
276
if (!b .isEnabled () || !borderEnabled ) {
305
277
return ;
306
278
} else if (!buttonBorderToAll && ((JButton ) b ).getIcon () != null ) {
279
+ // If the user don't want the border on all the buttons, we
280
+ // don't set the border on the button with an icon
307
281
return ;
308
282
} else if (this .isDefaultButton () && !buttonBorderToAll ) {
283
+ // if a button is a default button, and the user don't want
284
+ // the border on all the buttons we avoid set it on default buttons
309
285
return ;
310
286
}
287
+ // otherwise, we set the border to the buttons
311
288
Graphics2D graphics2D = (Graphics2D ) graphics .create ();
312
289
graphics2D .setStroke (new BasicStroke (2f ));
313
290
0 commit comments