Last active
December 19, 2015 14:58
-
-
Save unaunagi/5972655 to your computer and use it in GitHub Desktop.
豆腐プログラミングJava編
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package javaapplication1; | |
import javax.swing.JFrame; | |
import java.awt.*; | |
public class JavaApplication1{ | |
public static void main(String [] args) { | |
JFrame f = new JFrame("メインウィンドウ"); | |
f.setSize(640, 480); | |
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
f.add(new MyCanvas(),BorderLayout.CENTER); | |
f.setVisible(true); | |
} | |
} | |
class MyCanvas extends Canvas { | |
public void paint(Graphics g) { | |
g.setColor(Color.black); | |
g.fillRect(0,0,640,480); | |
g.setColor(Color.white); | |
g.fillRect(100, 100, 50, 50); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment