반응형 자바101 자바 소스코드: 369게임 혼자하기 package javaapplication32; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class Ex7 extends JFrame{ Ex7(){ this.setTitle("369게임 혼자하기"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.add(new GamePanel());//객체를 생성과 동시에 프레임에 추가 this.setLocationRelativeTo(null); this.setSize(310, 250); this.setVisible(true); } } class GamePanel extends JPane.. 2016. 11. 23. 자바 소스코드: 버블 게임(비눗방울 같은) package javaapplication31; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class Ex6 extends JFrame{ GamePanel panel; ImageIcon icon = new ImageIcon("airplane.jpg"); Ex6(){ this.setTitle("버블 게임"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new GamePanel(); this.add(panel); this.setLocationRelativeTo(null); this.setSize(300,300); thi.. 2016. 11. 23. 자바 소스코드: 움직이는 물체를 맞추는 사격 게임 package javaapplication30; import java.applet.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.net.*; class Ex5 extends JFrame{ Ex5(){ this.setTitle("사격 게임"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GamePanel p = new GamePanel(); this.add(p); this.setLocationRelativeTo(null); this.setSize(300,300); this.setResizable(false);.. 2016. 11. 23. 자바 소스코드: 아무거나 빨리 눌러 바 채우기 package javaapplication29; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class MyLabel extends JLabel{ int barSize=0;//바의 크기 int maxBarSize; MyLabel(int maxBarSize){ this.maxBarSize=maxBarSize; } public void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(Color.magenta); int width =(int)(((double)(this.getWidth()))/maxBarSize*barSiz.. 2016. 11. 14. 이전 1 2 3 4 5 6 7 8 ··· 26 다음 반응형