Java Code Examples for java.awt.Canvas#setBackground()

The following examples show how to use java.awt.Canvas#setBackground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Mickey.java    From ThinkJavaCode2 with MIT License 5 votes vote down vote up
public static void main(String[] args) {
    JFrame frame = new JFrame("Mickey Mouse");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Canvas canvas = new Mickey();
    canvas.setSize(400, 400);
    canvas.setBackground(Color.WHITE);
    frame.add(canvas);
    frame.pack();
    frame.setVisible(true);
}
 
Example 2
Source File: Moire.java    From ThinkJavaCode2 with MIT License 5 votes vote down vote up
public static void main(String[] args) {
    JFrame frame = new JFrame("Moire Pattern");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Canvas canvas = new Moire();
    canvas.setSize(400, 400);
    canvas.setBackground(Color.WHITE);
    frame.add(canvas);
    frame.pack();
    frame.setVisible(true);
}
 
Example 3
Source File: Moire.java    From Think-Java-Exercises with GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) {
   JFrame frame = new JFrame("Moire Pattern");
   Canvas canvas = new Moire();
   canvas.setSize(400, 400);
   canvas.setBackground(Color.white);
   frame.add(canvas);
   frame.pack();
   frame.setVisible(true);
}
 
Example 4
Source File: Mickey.java    From ThinkJavaCode with MIT License 5 votes vote down vote up
public static void main(String[] args) {
    JFrame frame = new JFrame("Mickey Mouse");
    Canvas canvas = new Mickey();
    canvas.setSize(400, 400);
    canvas.setBackground(Color.white);
    frame.add(canvas);
    frame.pack();
    frame.setVisible(true);
}
 
Example 5
Source File: Moire.java    From ThinkJavaCode with MIT License 5 votes vote down vote up
public static void main(String[] args) {
    JFrame frame = new JFrame("Moire Pattern");
    Canvas canvas = new Moire();
    canvas.setSize(400, 400);
    canvas.setBackground(Color.white);
    frame.add(canvas);
    frame.pack();
    frame.setVisible(true);
}