Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8050249

Dirty painting in dialogs with JRadioButton and JCheckBox (black lines)

    XMLWordPrintable

    Details

    • OS:
      windows_8

      Description

      FULL PRODUCT VERSION :
      Java 1.6.0_39 and also Java 1.7.0_13

      ADDITIONAL OS VERSION INFORMATION :
      Windows 8 6.2

      A DESCRIPTION OF THE PROBLEM :
      In a JDialog with JRadioButton and JCheckBox dirty regions (black lines) are remaining after they are touched with the mouse cursor. The JRadioButton shows always a dirty black line at the top and a white dirty region inside the black circle if it is selected.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start the added application and move the mouse over the shown dialog.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no dirty lines remaining in a dialog, if JRadioButton and JCheckBox is touched by the mouse cursor and a proper painted JRadioButton.
      ACTUAL -
      dirty lines remaining in a dialog, if JRadioButton and JCheckBox is touched by the mouse cursor and a dirty painted JRadioButton with a black line on top and white dirty region inside the black circle if it is selected..

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.classwizard.cw;


      import java.awt.BorderLayout;
      import java.awt.Container;
      import java.awt.Dimension;
      import java.awt.GridBagConstraints;
      import java.awt.GridBagLayout;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import javax.swing.Box;
      import javax.swing.ButtonGroup;
      import javax.swing.JCheckBox;
      import javax.swing.JDesktopPane;
      import javax.swing.JDialog;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JRadioButton;
      import javax.swing.WindowConstants;


      public class ClassWizard extends Object{
          public static void main(String args[]) throws Exception{
              try{
                  DialogTest ket = new DialogTest();
                  GJApp.launch(ket, " ButtonTest " ,0,0,700,700,null);
              }
              catch (Exception e){
                  System.out.println(e.getMessage());
                  e.printStackTrace();
              }
          }
      }
      class GJApp extends WindowAdapter{
          public static void launch(final DialogTest f, String title,final int x, final int y,final int w, int h,String propertiesFilename){
              f.setTitle(title);
              f.setBounds(x,y,w,h);
              f.setVisible(true);
              f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              f.addWindowListener(new WindowAdapter(){
                  public void windowClosed(WindowEvent e){
                      System.exit(0);
                  }
              });
          }
      }

      class DialogTest extends JFrame{
          protected JDesktopPane desktopPane = new JDesktopPane();
          ButtonDialog _buttondlg = null;
          
          public DialogTest() throws Exception{
              String osname = System.getProperty( " os.name " );
              String osversion = System.getProperty( " os.version " );
              String java_version = System.getProperty( " java.version " );
              System.out.println(osname + " " + osversion + " java: " + java_version + "
       " );
              
              // make a dialog with radio button and checkbox
              _buttondlg = new ButtonDialog(this, " buttons and checkboxes " , false);
              _buttondlg.init();
              _buttondlg.setVisible(true);
              _buttondlg.setLocation(300, 100);

          }
      }

      class ButtonDialog extends JDialog{
          ButtonDialog _dlg = null;
          DialogTest _owner = null;
          JRadioButton oneButton = null;
          JRadioButton twoButton = null;
          JCheckBox oneBox = null;
          JCheckBox twoBox = null;
          
          public ButtonDialog(DialogTest owner, String title, boolean modal){
              super(owner,title,modal);
              _owner = owner;
              _dlg = this;
          }

          public JPanel makeButtonsPanel(){
              GridBagLayout gbl = new GridBagLayout();
              GridBagConstraints gbc = new GridBagConstraints();
              oneButton = new JRadioButton( " button 1 " );
              twoButton = new JRadioButton( " button 2 " );
              oneButton.setSelected(true);
              ButtonGroup group = new ButtonGroup();
              group.add(oneButton);
              group.add(twoButton);

              oneBox = new JCheckBox( " check 1 " );
              twoBox = new JCheckBox( " check 2 " );
              JPanel paraPanel = new JPanel();
              paraPanel.setPreferredSize(new Dimension(150, 150));

              paraPanel.add(Box.createHorizontalStrut(10));
              gbc.gridwidth = 1;
              paraPanel.add(oneButton, gbc);
              paraPanel.add(Box.createHorizontalStrut(10));
              gbc.gridwidth = GridBagConstraints.REMAINDER;
              paraPanel.add(oneBox, gbc);
              
              paraPanel.add(Box.createHorizontalStrut(10));
              gbc.gridwidth = 1;
              paraPanel.add(twoButton, gbc);
              paraPanel.add(Box.createHorizontalStrut(10));
              gbc.gridwidth = GridBagConstraints.REMAINDER;
              paraPanel.add(twoBox, gbc);
              
              return(paraPanel);
          }
          public void init(){
              JPanel paraPanel2 = makeButtonsPanel();
              Container diacontent = this.getContentPane();
              diacontent.add(paraPanel2, BorderLayout.NORTH);
              setPreferredSize(new Dimension(280, 150));
              setResizable(true);
              pack();
          }
      }
          

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              scfitch Stephen Fitch
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: