JDK-4130812 : Motif JToggleButton: painting focus is not handled well
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1998-04-20
  • Updated: 2006-11-14
  • Resolved: 2006-11-14
Related Reports
Relates :  
Relates :  
Relates :  
Description
JToggleButtonUI:

When isBorderPainted is false and isFocusPainted is true, focus is not painted. This is different from metal/window JToggleButton. This is because painting focus is handled by its border. When isBorderPainted is false, painting focus logic should be handled by its UI, MotifToggleButtonUI's paintFocus that does nothing currently.

For its fix, please see Bug#4129691(JButton) and Bug#4130798(JRadioButton).
bae-chul.kim@eng 1998-04-20

Comments
EVALUATION Motif L&F is very out of date and not very useful any more. As such, there's little benefit to doing anything with this bug. Closing as "Will Not Fix".
14-11-2006

EVALUATION Verified. This should be fixed. MotifToggleButtonUI.paintFocus() method assumes that border is painting focus. But if borderPainted is false, nothing is painted. ###@###.### 2000-02-23 Name: ibR10256 Date: 05/08/2004 This bug is the same as 4915509 (and its duplicate 4129691) but reported for JToggleButton and it can be fixed in the same way. ###@###.### 2003-10-27 ======================================================================
27-10-2003

SUGGESTED FIX This can be fixed the same way as 4129691, i.e. UI's paintFocus() method paints focus if borderPainted is false: ------- MotifToggleButtonUI.java ------- *** /tmp/d6zj7L_ Thu Feb 17 19:30:05 2000 --- MotifToggleButtonUI.java Thu Feb 17 19:22:10 2000 *************** *** 92,98 **** g.setColor(oldColor); } } ! public Insets getInsets(JComponent c) { Border border = c.getBorder(); Insets i = border != null? border.getBorderInsets(c) : new Insets(0,0,0,0); --- 92,109 ---- g.setColor(oldColor); } } ! ! protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, ! Rectangle textRect, Rectangle iconRect) { ! // focus painting is handled by the border, unless it is not painted ! ! if (!b.isBorderPainted()) { ! Dimension size = b.getSize(); ! g.setColor(UIManager.getColor("activeCaptionBorder")); ! g.drawRect(0, 0, size.width-1, size.height-1); ! } ! } ! public Insets getInsets(JComponent c) { Border border = c.getBorder(); Insets i = border != null? border.getBorderInsets(c) : new Insets(0,0,0,0); ###@###.### 2000-02-23
23-02-2000