hdijkema / seaglass

Automatically exported from code.google.com/p/seaglass
0 stars 0 forks source link

Strange drawing of JCheckBox, JRadioButton inside JTabbedPane #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the application
2. Move the mouse over checkbox or radio (see result in the attached 
screenshot)
3.

What is the expected output? What do you see instead?
expect: smooth rendering
result: ugly drawing of JCheckbox and JRadio. Seems like the previous 
drawing was not cleared. However, this does not occur with JLabel

What version of the product are you using? On what operating system? 
What
JRE version?
Mac OS X 10.6.2 JRE 6.0

Please provide any additional information below.
- sample code attached
-------------

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JCheckBox;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;

public class SeaglassBugDemo extends JFrame {

    public static void main(String[] args) {
        //set look and feel
        try {

UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel
"); 
            System.out.println(">> Set Seaglass look and feel");
//            
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookA
ndFeel");
//            System.out.println(">> Set Nimbus look and feel");
        } catch (Exception e) {
            System.err.println(">> Cannot set look and feel");
            e.printStackTrace();
        }

        SeaglassBugDemo demo = new SeaglassBugDemo();
        demo.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    public SeaglassBugDemo(){
        super("Seaglass");

        JTabbedPane tabPane2 = new JTabbedPane();
        JPanel testPanel = new JPanel();
        JCheckBox cb = new JCheckBox("checkbox");
        testPanel.add(cb);
        testPanel.add(new JRadioButton("radio"));
        testPanel.add(new JLabel("label"));
        tabPane2.add(testPanel,"test");
        this.getContentPane().add(tabPane2);

        this.setBounds(0,0,800,600);
        this.setResizable(true);
        this.setVisible(true);
    }

}

Original issue reported on code.google.com by Krist.Wo...@gmail.com on 3 Mar 2010 at 6:20

Attachments:

GoogleCodeExporter commented 9 years ago
Verified. I remember fixing this with JLabel, so it shouldn't be hard to find 
and fix. Probably it happens in some 
other controls as well.

Original comment by kahuxtable on 3 Mar 2010 at 10:19

GoogleCodeExporter commented 9 years ago
By the way, it doesn't have to be in a tabbed pane. Replacing the guts of your 
code with

    JPanel testPanel = new JPanel();
    JCheckBox cb = new JCheckBox("checkbox");
        testPanel.add(cb);
        testPanel.add(new JRadioButton("radio"));
        testPanel.add(new JLabel("label"));
        this.getContentPane().add(testPanel);

gives the same result.

Original comment by kahuxtable on 3 Mar 2010 at 10:30

GoogleCodeExporter commented 9 years ago
Fixed in r1351.
Changed the way we handle JPanel transparency to ensure a repaint when 
necessary.

Original comment by kahuxtable on 4 Mar 2010 at 6:28