2022年8月5日

窗口监听事件

摘要: 匿名内部类 public class demo01 { public static void main(String[] args) { new MyFrame("hahhahhs"); } } class MyFrame extends Frame{ public MyFrame(String t 阅读全文

posted @ 2022-08-05 17:36 大风吹过12138 阅读(24) 评论(0) 推荐(0)

鼠标监听事件,模拟画图工具

摘要: 1 public class TestMouseListener { 2 public static void main(String[] args) { 3 new MyFrame01("鼠标监听事件"); 4 } 5 } 6 class MyFrame01 extends Frame{ 7 Ar 阅读全文

posted @ 2022-08-05 15:37 大风吹过12138 阅读(29) 评论(0) 推荐(0)

画笔

摘要: 阅读全文

posted @ 2022-08-05 00:23 大风吹过12138 阅读(84) 评论(0) 推荐(0)

2022年8月4日

简易计算器

摘要: 组合 面向过程 public class TestCalc { public static void main(String[] args) { new Calculate(); } } class Calculate extends Frame{ public Calculate(){ TextF 阅读全文

posted @ 2022-08-04 01:14 大风吹过12138 阅读(71) 评论(0) 推荐(0)

2022年8月3日

输入框事件监听

摘要: e.getText返回的是一个Object对象,向下转型成TextField类的对象 public class TestText01 { public static void main(String[] args) { new MyFrame(); } } class MyFrame extends 阅读全文

posted @ 2022-08-03 22:06 大风吹过12138 阅读(33) 评论(0) 推荐(0)

事件监听

摘要: public class demo06 { public static void main(String[] args) { Frame frame = new Frame(); Button button = new Button("hahahhaha"); frame.add(button); 阅读全文

posted @ 2022-08-03 17:40 大风吹过12138 阅读(30) 评论(0) 推荐(0)

2022年7月31日

课堂练习

摘要: public class demo05 { public static void main(String[] args){ Frame a=new Frame("课堂练习"); a.setVisible(true); a.setBounds(400,400,500,500); a.setLayout 阅读全文

posted @ 2022-07-31 21:10 大风吹过12138 阅读(80) 评论(0) 推荐(0)

三种布局管理器

摘要: 流式布局 public class demo02 { public static void main(String[] args) { Frame frame=new Frame(); Button button1=new Button("a"); Button button2=new Button 阅读全文

posted @ 2022-07-31 17:16 大风吹过12138 阅读(35) 评论(0) 推荐(0)

2022年7月30日

pannel面板

摘要: panel可以看作是一个空间,但是不能单独存在,可以放在frame里面 最后添加窗口监听器方法里面的参数是一个监听器接口的实现类,如果直接new一个接口必须重写里面的所有方法,但是new一个它的实现类就可以选择重写其中一个 public class demo01 { public static vo 阅读全文

posted @ 2022-07-30 22:24 大风吹过12138 阅读(134) 评论(0) 推荐(0)

第一个Frame窗口

摘要: package com.guo; import javax.swing.*; import java.awt.*; public class lesson01 { public static void main(String[] args) { Frame frame = new Frame("我的 阅读全文

posted @ 2022-07-30 17:21 大风吹过12138 阅读(22) 评论(0) 推荐(0)

导航