AWT,Panel入门,多框架,多Panel
2016-06-01 15:06
232 查看
import java.awt.*; public class TestMultiPanel{ public static void main(String[] args) { SubFrame f1 = new SubFrame(100,100,200,200,Color.BLUE); SubFrame f2 = new SubFrame(300,100,200,200,Color.darkGray); SubFrame f3 = new SubFrame(100,300,200,200,Color.CYAN); SubFrame f4 = new SubFrame(300,300,200,200,Color.magenta); } } class SubFrame extends Frame{ static int serial = 1; private Panel p1, p2, p3, p4; SubFrame(int x, int y, int height, int width,Color color){ super("Panel in Frame " + (serial++)); super.setLayout(null); super.setBounds(x,y,height,width); super.setVisible(true); super.setBackground(color); p1 = new Panel(null); p2 = new Panel(null); p3 = new Panel(null); p4 = new Panel(null); p1.setBounds(0,0,width/2,height/2); p2.setBounds(0,height/2,width/2,height/2); p3.setBounds(width/2,0,width/2,height/2); p4.setBounds(width/2,height/2,width/2,height/2); p1.setBackground(Color.cyan); p2.setBackground(Color.DARK_GRAY); p3.setBackground(Color.gray); p4.setBackground(Color.green); super.add(p1); super.add(p2); super.add(p3); super.add(p4); } }
相关文章推荐
- C#通过重写Panel改变边框颜色与宽度的方法
- 解决Extjs 4 Panel作为Window组件的子组件时出现双重边框问题
- C#的WebBrowser操作frame实例解析
- 解决AJAX.NET中的悬停panel在页面加载时闪烁的问题
- js函数在frame中的相互调用详解
- 对frameset、frame、iframe的js操作示例代码
- flex4 panel去掉标题设置透明度效果代码
- 服务器(VPS)安装WebSite Panel面板教程(图文)
- 用JS操作FRAME中的IFRAME及其内容的实现代码
- Godaddy VDS Simple Control Panel出错的解决方法
- C# WinForm中Panel实现用鼠标操作滚动条的实例方法
- 防止登录页面出现在frame中js代码
- 如何用js控制frame的隐藏或显示的解决办法
- 详解iframe与frame的区别
- JavaScript实现防止网页被嵌入Frame框架的代码分享
- asp.net页面触发事件panel滚动条高度不变的实现方法
- jQuery控制frames及frame页面JS的方法
- iOS图片放大的方式(transform和frame)
- Python实例之wxpython中Frame使用方法
- C# Winform 中真正意义的透明控件