Example usage for javax.swing JInternalFrame setOpaque

List of usage examples for javax.swing JInternalFrame setOpaque

Introduction

In this page you can find the example usage for javax.swing JInternalFrame setOpaque.

Prototype

@BeanProperty(expert = true, description = "The component's opacity")
public void setOpaque(boolean isOpaque) 

Source Link

Document

If true the component paints every pixel within its bounds.

Usage

From source file:Main.java

public Main() {
    JMenuBar bar = new JMenuBar();
    JMenu addMenu = new JMenu("Add");
    JMenuItem newFrame = new JMenuItem("Internal Frame");
    addMenu.add(newFrame);//from w  ww .  ja v  a2  s  .  c  om
    bar.add(addMenu);
    setJMenuBar(bar);

    final JDesktopPane theDesktop = new JDesktopPane();
    getContentPane().add(theDesktop);

    newFrame.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, true);

            Container c = frame.getContentPane();
            MyJPanel panel = new MyJPanel();

            c.add(panel, BorderLayout.CENTER);
            frame.setSize(200, 200);
            frame.setOpaque(true);
            theDesktop.add(frame);
        }
    });

    setSize(500, 400);
    setVisible(true);
}