Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by Mihey ( 15 years ago )
package mihey.test.swing.debug;

import java.awt.Color;
import java.awt.Container;
import javax.swing.BorderFactory;
import javax.swing.DebugGraphics;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.RepaintManager;

/**
 * @author Mihey
 */
public class DebugGraphicsExample {

    public static void main(String[] args) {
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.setVisible(true);

        final Container contentPane = frame.getContentPane();

        final JPanel panel = new JPanel();
        contentPane.add(panel);

        panel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
        panel.add(new JLabel("This label was created for debug proposes."));
        panel.add(new JButton("This button was created for debug proposes."));

        RepaintManager.currentManager(panel).
                setDoubleBufferingEnabled(false);

        panel.setDebugGraphicsOptions(
                DebugGraphics.LOG_OPTION | DebugGraphics.FLASH_OPTION);

        DebugGraphics.setFlashTime(100);
        DebugGraphics.setFlashCount(1);

        frame.pack();
    }

}

 

Revise this Paste

Your Name: Code Language: