15.1
2016-06-23 22:02
225 查看
import java.awt.Color; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class Test_15 extends JFrame{ public Test_15(){ add(new JP()); } public static void main(String[] args) { // TODO Auto-generated method stub Test_15 t = new Test_15(); t.setTitle("test"); t.setSize(200,200); t.setLocationRelativeTo(null); t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); t.setVisible(true); } } class JP extends JPanel{ protected void paintComponent(Graphics g){ super.paintComponent(g); int width = getWidth(); int height = getHeight(); g.setColor(Color.BLUE); g.drawLine(0, height/3, width, height/3); g.drawLine(0, 2*height/3, width, 2*height/3); g.setColor(Color.RED); g.drawLine(width/3,0, width/3,height); g.drawLine(2*width/3,0, 2*width/3,height); } }
Test_15
相关文章推荐
- BZOJ1854: [Scoi2010]游戏
- 详解Java集合框架的接口和类层次关系
- 2021发工资咯:)
- HDU 1063 && POJ 1001 Exponentiation (JAVA浮点数大数)
- 有道词典python 代码(暂有缺憾)
- Centos6.8 64位编译安装PF_RING心得和总结
- leetcode 205 Isomorphic Strings
- SDWebImage原理
- LNMP环境搭建之--YUM仓库
- C++学习心得
- hash储存机制
- Harris角点检测原理及实现
- octave高画质图像处理字节数限制问
- 【Python学习日记】递归实现hanoi塔
- 解决:tomcat部署时deploy location不能显示加载后的路径【转载
- 思科基础命令大全
- [疯狂Java]面向对象:继承、覆盖、super
- java try...catch...finally机制详解
- requirejs讲解
- web 爬虫初体验