1.一个按钮能触发WindowEvent吗?一个按钮能触发MouseEvent吗?一个按钮能触发ActionEvent吗?
JButton能产生MouseEvent和ActionEvent。不能触发WindowEvent
2.一个源可以有多个监听器吗?一个监听器可以有多个源吗?一个监听器可以使自身的监听器吗?
YES.YES.YES
3.内部类可以用在不是嵌套他的其他类中吗?
Objects of an inner class are often created in the outer class. But you can also create an object of an inner class from another class. If the inner class is nonstatic, you must first create an instance of the outer class, then use the following syntax to create
an object for the inner class:
OuterClass.InnerClass innerObject = outerObject.new InnerClass();
If the inner class is static, use the following syntax to create an object for it:
OuterClass.InnerClass innerObject = new OuterClass.InnerClass();
时间: 2024-10-11 21:07:18