Java Notes-2
来源:互联网 发布:海淘折扣软件 编辑:程序博客网 时间:2024/05/16 18:34
-In Java, every class defines a new type (data type).
-The JComponent class provides the framework for building all kinds of user interface
components. Particular components—such as buttons, labels, and list boxes—are im‐
plemented as subclasses of JComponent
-JComponent is really the tip of another iceberg called Swing. Swing is Java’s user interface
toolkit
-Component is a subclass of the top-level Object class, so all these classes are types of
Object . Every other class in the Java API inherits behavior from Object , which defines
a few basic methods,
-The java. and javax. package hierarchies are special. Any package that begins with
java. is part of the core Java API and is available on any platform that supports Java.
The javax. package normally denotes a standard extension to the core platform, which
may or may not be installed.
-There are many different event classes, including MouseEvent , KeyEvent , and
ActionEvent .
-GUI components in Java generate events for specific kinds of user actions. For example,
if you click the mouse inside a component, the component generates a mouse event.
Objects can ask to receive the events from one or more components by registering a
listener with the event source.
-The mouseDragged() method is
called automatically on a listener to receive the events generated when the user drags
the mouse—that is, moves the mouse with any button pressed. The mouseMoved()
method is called whenever the user moves the mouse over the area without pressing a
button.
-Because we changed the coordinates for the message (when we dragged the mouse), we
would like HelloComponent2 to redraw itself. We do this by calling repaint() , which
asks the system to redraw the screen at a later time.
-an interface is a list of methods that the class must have
-Interfaces
give us a way of acting on objects based on their capabilities without knowing or caring
about their actual type.
-A class in Java can
extend only one class, but can implement as many interfaces as it wants;
-Component is a base class from which all of Java’s GUI components are derived. It contains
variables that represent the location, shape, general appearance, and status of the object
as well as methods for basic painting and event handling.
-The Container causes its children to be displayed
and arranges them on the screen according to a particular layout strategy
- A LayoutManager object embodies a partic‐
ular scheme for arranging components on the screen and adjusting their sizes.
- Java Notes-2
- Java Notes-2
- Java Notes (2)
- Java - Notes
- notes[java]
- java notes
- java notes
- Java Notes
- Java Notes
- 【Notes】Effective Java 2nd -- Concurrency
- Effective Java, 2nd - Concurrency - Notes
- Java 游戏开发Notes
- Java Thread - Notes
- Java 游戏开发Notes
- Java-Notes Documents
- java 访问notes domino
- java 读取notes数据库
- Java Container Learning notes
- HDU 1251 统计难题
- hdu 5595
- Java Notes-1
- java基础第八天——正则、集合与数组的区别
- java模拟异步消息机制
- Java Notes-2
- POJ 1062 迪杰斯特拉
- HDOJ 5595 GTW likes math(简单数学,模拟)
- Solve 0x80004005 issue, cannot access sharefolder under windows2012
- [hdoj试题]A+B for Input-Output Practice (VII)
- Java Notes-3
- 文章标题
- 模仿淘宝客户端倒计时控件
- 【C++】JSON文件的读取和生成