JDK-4915509 : Focus not painted in JButton with no border in motif LAF
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0,1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic,windows_nt
  • CPU: generic,x86
  • Submitted: 2003-09-01
  • Updated: 2006-11-14
  • Resolved: 2006-11-14
Related Reports
Duplicate :  
Relates :  
Description
Name: dk106046			Date: 09/01/2003

In motif look and feel, when a JButton's border is not painted(button.setBorderPainted(false);),
its focus is also not painted. The saqme does not happen with a jcheckbox ot a jradiobutton.

Expected Result
Even if the border of a JButton is not painted, its focus should be painted.

Test suite:
1. SwingSet2 demo program
2. Below is a crude program to illustrate this defect.

import java.awt.*;
import javax.swing.JButton;
import javax.swing.*;

class test extends JFrame{
       public test() throws Exception{
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
              this.getContentPane().setLayout(new FlowLayout());
              JButton button=new JButton("Test");
              JButton button1=new JButton("Test1");
              this.getContentPane().add(button);
              this.getContentPane().add(button1);
              button.setBorderPainted(false);
              this.setSize(100,100);
       }

       public static void main(String[] args){
              try{
              test test1=new test();
              test1.show();
              }catch(Exception e){}
       }
}

Steps to Recreate:
1. Run the above program. 
or
2. Run SwingSet2 demo. Change Look and feel to motif.
Select Button demo. Deselect 'Paint border' and select 'Paint focus' .
Click on the buttons and observe that the focus is not painted.

[This bug is being submitted as a courtesy, in order to maintain uniformity between Sun & IBM JDKs.  It has been fixed in IBM JDKs.  
Please contact ###@###.### if you have questions.]
======================================================================

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

SUGGESTED FIX Name: ibR10256 Date: 09/18/2003 MotifButtonUI.paintFocus() does nothing but is always called from BasicButtonUI.paint() if the button has focus. Here the focus can be painted in case if the button's borderPainted property is set to false. ###@###.### 2003-09-18 ======================================================================
18-09-2003

EVALUATION Name: ibR10256 Date: 09/18/2003 In Motif JButton focus indicator painting is handled by the border (namely MotifBorders.ButtonBorder) so when the borderPainted property is set to false focus is not painted along with the border. ###@###.### 2003-09-18 ======================================================================
18-09-2003