Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 58 forks source link

JXGlassBox causing render flickering #85

Open cmadsen opened 11 years ago

cmadsen commented 11 years ago

Using the code from here http://www.jarvana.com/jarvana/view/org/swinglabs/swingx/1.6.1/swingx-1.6.1-sources.jar!/org/jdesktop/swingx/JXGlassBox.java?format=ok

On a JFrame that runs with com.github.insubstantial:substance:7.1 the following causes flickering once the glassbox has been show:

public class TestGlassbox {

    public static void main(String[] args) {

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {

                try {
                    UIManager
                            .setLookAndFeel(new SubstanceCremeCoffeeLookAndFeel());
                } catch (UnsupportedLookAndFeelException e1) {
                    e1.printStackTrace();
                }

                AnimationConfigurationManager.getInstance().allowAnimations(
                        AnimationFacet.GHOSTING_ICON_ROLLOVER);

                final JFrame frame = new JFrame("Glassbox Test");
                frame.setMinimumSize(new Dimension(400, 400));
                frame.addWindowListener(new WindowAdapter() {
                    @Override
                    public void windowClosing(WindowEvent we) {
                        System.exit(1);
                    }
                });

                final JPanel p = new JPanel(new BorderLayout());
                JButton b = new JButton(new AbstractAction() {
                    @Override
                    public void actionPerformed(ActionEvent e) {                        
                        JXGlassBox jXGlassBox1 = new JXGlassBox();
                        JLabel jLabel1 = new JLabel("Hello World");
                        jXGlassBox1.setLayout(new BorderLayout());
                        jLabel1.setOpaque(true);
                        jXGlassBox1.add(jLabel1, BorderLayout.CENTER);
                        Container glassPane = (Container) frame.getRootPane()
                                .getGlassPane();
                        // Only allow one message box to be visible at a time so
                        // pop down any visible message boxes
                        Component glassPaneChildren[] = glassPane
                                .getComponents();
                        for (int i = 0; i < glassPaneChildren.length; i++) {
                            glassPaneChildren[i].setVisible(false);
                            glassPane.remove(glassPaneChildren[i]);
                        }

                        Point p = SwingUtilities.convertPoint(
                                (Component) e.getSource(), 0, 0, null);

                        jXGlassBox1.showOnGlassPane(glassPane, p.x, p.y);

                    }
                });

                p.add(b, BorderLayout.CENTER);

                JToolBar tb = new JToolBar();
                tb.add(new JButton("b1"));
                tb.add(new JButton("b2"));
                p.add(tb, BorderLayout.NORTH);

                frame.getContentPane().add(p);
                frame.pack();
                frame.setVisible(true);
            }
        });
    }
}

It works fine under substance 6.1?

disrvptor commented 11 years ago

I can't reproduce using Java 1.6.0_33 on Mac OS X (10.8), what version of Java/OS are you using?

cmadsen commented 11 years ago

I'm running Fedora 17/jdk1.6.0_23

disrvptor commented 11 years ago

One more question, what video chipset/driver version are you running? Thanks!

cmadsen commented 11 years ago

lspci -v -s lspci | awk '/VGA/{print $1}' 01:00.0 VGA compatible controller: nVidia Corporation G98M [Quadro NVS 160M](rev a1) (prog-if 00 [VGA controller]) Subsystem: Dell Device 024f Flags: bus master, fast devsel, latency 0, IRQ 16 Memory at f5000000 (32-bit, non-prefetchable) [size=16M] Memory at e0000000 (64-bit, prefetchable) [size=256M] Memory at f2000000 (64-bit, non-prefetchable) [size=32M] I/O ports at df00 [size=128] [virtual] Expansion ROM at f4000000 [disabled] [size=128K] Capabilities: [60] Power Management version 3 Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+ Capabilities: [78] Express Endpoint, MSI 00 Capabilities: [100] Virtual Channel Capabilities: [128] Power Budgeting <?> Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?> Kernel driver in use: nouveau Kernel modules: nouveau

kschaefe commented 11 years ago

See: http://java.net/jira/browse/SWINGX-1515

This is, most likely, a problem with JXPanel painting mechanisms.

Also note that JXGlassBox is no longer supported in later versions of SwingX.