Example usage for javax.swing JComponent setOpaque

List of usage examples for javax.swing JComponent setOpaque

Introduction

In this page you can find the example usage for javax.swing JComponent 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 static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);

    frame.pack();//from w w  w. j a  v  a 2  s .co m
    frame.setVisible(true);
}

From source file:Main.java

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

    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);

    frame.pack();//from   www .j  a v a  2  s  .c  o m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("FocusEventDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);
    frame.pack();//from w w  w  . j  av  a  2 s .co m
    frame.setVisible(true);

}

From source file:GrayModel.java

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

    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);

    frame.add(new JLabel("Shade of Gray:"), "North");
    frame.add(new JSpinner(new GrayModel(170)));

    frame.pack();// w  ww .  j  a v  a  2s  . c  o  m
    frame.setVisible(true);
}

From source file:GrayModel.java

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

    JComponent newContentPane = new SpinnerDemo4();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);

    frame.add(new JLabel("Shade of Gray:"), "North");
    frame.add(new JSpinner(new GrayModel(170)));

    frame.pack();/*from w  ww.  j  av  a2 s  . c  o  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JComponent newContentPane = new Main();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    frame.pack();/* w w  w .ja  v  a 2  s  .c  om*/
    frame.setVisible(true);
}

From source file:LayeredPaneDemo.java

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

    // Create and set up the content pane.
    JComponent newContentPane = new LayeredPaneDemo();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Display the window.
    frame.pack();//from  w ww  .  j a va2  s  . c o  m
    frame.setVisible(true);
}

From source file:Main.java

/** Set the opaque property of the given components.  Intended to reduce clutter in GUI code. */
public static void setOpaque(boolean b, JComponent... components) {
    for (JComponent c : components) {
        c.setOpaque(b);
    }/*from  w  ww .ja  va2s.  c o m*/
}

From source file:events.Beeper.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//from   ww w . jav a2 s . co m
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("Beeper");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Create and set up the content pane.
    JComponent newContentPane = new Beeper();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

/**
 * Remove all the opaqueness of the given components and child components.
 * /*ww w .jav a  2s  .  c  o m*/
 * @param components list of components
 */
public static void removeOpaqueness(Component... components) {
    for (Component component : components) {
        if (component instanceof JComponent) {
            JComponent jComponent = (JComponent) component;
            jComponent.setOpaque(false);
            removeOpaqueness(jComponent.getComponents());
        }
    }
}