77_游戏项目_加载窗口_画图形_加载图片_编程中坐标基本知识
来源:互联网 发布:js简繁体切换 编辑:程序博客网 时间:2024/06/05 07:50
package com.zhushen.Test;import java.awt.Color;import java.awt.Font;import java.awt.Frame;import java.awt.Graphics;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;/** * 游戏窗口类 * @author zhushen * */public class GameFrame extends Frame { private static final long serialVersionUID = 1L; /** * 加载游戏窗口 * @param x * @param y * @param width * @param height */ public void launchFrame(int x,int y,int width,int height){ setSize(width,height); setLocation(x,y); setVisible(true); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e){ System.exit(0); } }) ; } /** * 在窗口里面画元素 */ public void paint(Graphics g){ g.drawLine(100, 100, 300, 300); g.drawRect(100, 100, 200, 200); g.drawOval(100, 100, 200, 200);//根据外切矩形画圆(椭圆同理) Font f=new Font("宋体",Font.BOLD,20); g.setFont(f); g.drawString("我是北京交通大学朱燊", 200, 200);//画一个字符串 g.fillRect(100, 100, 20, 20);//填充一个矩形 Color c=g.getColor(); g.setColor(Color.red); g.fillOval(300, 300, 30, 30);//填充一个圆 g.setColor(c); } public static void main(String[] args) { GameFrame gf=new GameFrame(); gf.launchFrame(100,100,500,500); }}
阅读全文
0 0
- 77_游戏项目_加载窗口_画图形_加载图片_编程中坐标基本知识
- JAVA学习笔记-加载窗口_画图形_编程中坐标基本知识
- 78_游戏项目_图片的加载
- 异步加载图片--狸菇凉_
- ^_^
- ^_^
- ^_^
- ^_^
- *_&
- ...!@~....!@#....+_#%.
- ^_^
- ^_^
- ^_^
- ^_^
- *_*
- ^_^
- ^_^
- ~~~~(>_<)~~~~
- C# 控件命名规范
- 【使用教程】如何把数据导出到 WPF 环境的 Excel 中
- Ogre画中画摄像机靠近模型,模型会被遮挡一部分
- Project configuration is not up-to-date with pom.xml
- core_java泛型篇小总结(1)
- 77_游戏项目_加载窗口_画图形_加载图片_编程中坐标基本知识
- AngularJS停止定时器$interval
- Linux学习第十六篇--磁盘管理(挂载/分区)
- node.js项目中基于mysql利用sequelize-auto对照数据库自动生成相应的models
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- android 代码混淆
- github之删除远程分支
- Webpack入门
- VS快捷键