导航

2016年5月22日

摘要: package com.java.charpter12;import java.awt.BorderLayout;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListe 阅读全文

posted @ 2016-05-22 22:58 4565892 阅读(128) 评论(0) 推荐(0)

摘要: public class JButtonTest extends JFrame{ public JButtonTest(){ URL url=JButtonTest.class.getResource("imageButtoo.jpg"); Icon icon=new ImageIcon(url); 阅读全文

posted @ 2016-05-22 21:59 4565892 阅读(220) 评论(0) 推荐(0)

摘要: public class JPanelTest extends JFrame{ public JPanelTest(){ Container c=getContentPane(); c.setLayout(new GridLayout(2,1,10,10)); //初始化一个面板,设置一行三列的网格 阅读全文

posted @ 2016-05-22 21:46 4565892 阅读(161) 评论(0) 推荐(0)

摘要: public class GirdLayoutPosition extends JFrame{ public GirdLayoutPosition() { Container c=getContentPane();//一定要这样表示; setLayout(new GridLayout(7, 3, 5 阅读全文

posted @ 2016-05-22 19:40 4565892 阅读(101) 评论(0) 推荐(0)

摘要: public class BorderLayoutPosition extends JFrame{ String[] border={BorderLayout.CENTER,BorderLayout.NORTH,BorderLayout.SOUTH,BorderLayout.EAST,BorderL 阅读全文

posted @ 2016-05-22 19:20 4565892 阅读(711) 评论(0) 推荐(0)

摘要: public class FlowLayoutPosition extends JFrame{ public FlowLayoutPosition() { setTitle("本窗体使用流布局管理器"); Container c=getContentPane(); //设置窗体使用流布局,使用组件右 阅读全文

posted @ 2016-05-22 18:38 4565892 阅读(197) 评论(0) 推荐(0)

摘要: public class AbsolutePosition extends JFrame{ public AbsolutePosition() { setTitle("本窗口使用绝对布局"); setLayout(null); setBounds(0, 0, 200, 150); Container 阅读全文

posted @ 2016-05-22 18:30 4565892 阅读(193) 评论(0) 推荐(0)

摘要: public class MyImageIcon extends JFrame{ public MyImageIcon() { JFrame jf=new JFrame(); Container container=getContentPane(); JLabel ji=new JLabel("这是 阅读全文

posted @ 2016-05-22 15:48 4565892 阅读(715) 评论(0) 推荐(0)

摘要: class MyJDialog extends JDialog{ public MyJDialog(JFrame frame){ super(frame,"第一个Dialog窗体",true); Container container=getContentPane(); container.add( 阅读全文

posted @ 2016-05-22 15:16 4565892 阅读(289) 评论(0) 推荐(0)

摘要: public class Drawlcon implements Icon{ private int width; private int height; public Drawlcon(int width,int height) { this.width=width; this.height=he 阅读全文

posted @ 2016-05-22 15:16 4565892 阅读(152) 评论(0) 推荐(0)

摘要: 1.JFrame窗体 jf.setSize(200, 150); jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } public static void main(String[] args) { new Example1() 阅读全文

posted @ 2016-05-22 14:38 4565892 阅读(100) 评论(0) 推荐(0)

摘要: 1.原来的AWT组件来自java。awt包,而AWT组件的java应用程序在不同平台的界面显示不同。但是在不同平台运用Swing开发的应用程序,就可以使用同一的GUI界面。 2.SWing组件通常被称为轻量级,它完全由java语言编写。 JButton 按钮 JCheckBox 复选框按钮 JCom 阅读全文

posted @ 2016-05-22 14:10 4565892 阅读(148) 评论(0) 推荐(0)

摘要: 1.非内部类不能被声明为private 或protected访问类型. 阅读全文

posted @ 2016-05-22 13:53 4565892 阅读(117) 评论(1) 推荐(0)

摘要: 1.public class OuterInnerClass extends ClassA.ClassB{ public OuterInnerClass(ClassA a) { a.super(); }}class ClassA{ class ClassB{ } } 说明:在某个类继承内部类时,必须 阅读全文

posted @ 2016-05-22 12:05 4565892 阅读(107) 评论(0) 推荐(0)

摘要: public class StaticInnerClass { int x=100; static class inner{ void doitInner() { System.out.println("外部类+"+x); }//错误的,因为x 不是静态变量,所以在方法中不能用 doitInner方 阅读全文

posted @ 2016-05-22 12:00 4565892 阅读(90) 评论(0) 推荐(0)

摘要: 在方法中定义的内部类,只能访问方法中final 类型的局部变量,这是因为在方法中定义的局部变量相当于一个常量,他的声明周期超出方法运行的声明周期, package com.java.charpt11;interface Outlnterface{//接口一 public void f(); }cla 阅读全文

posted @ 2016-05-22 11:53 4565892 阅读(102) 评论(0) 推荐(0)

摘要: 1.同一个包中的类互相访问,不需要制定包名。 2.java中包名的规则是全部使用小写字母 3.final 方法不能被覆盖, public class OuterClass { innerClass in=new innerClass(); public void outf() { in.inf(); 阅读全文

posted @ 2016-05-22 00:31 4565892 阅读(140) 评论(0) 推荐(0)