当前位置:网站首页>Why can swing implement a form program by inheriting the JFrame class?
Why can swing implement a form program by inheriting the JFrame class?
2022-07-06 14:43:00 【in a cocoon around oneself.】
1. javax.swing.JFrame
1.1 JFrame Hierarchical structure
- Class JFrame
- java.lang.Object
- java.awt.Component
- java.awt.Container
- java.awt.Window
- java.awt.Frame
- javax.swing.JFrame
- java.awt.Frame
- java.awt.Window
- java.awt.Container
- java.awt.Component
- java.lang.Object
stay java api 8 Chinese vs Class JFrame It's described like this :
java.awt.frame Extended version of , It's for JFC / Swing Component architecture adds support .
Warning: Swing is not thread safe. For more information see Swing’s Threading Policy. Swing Not thread safe .
1.2 JFrame Medium Nested Classes ( Inner class )
- JFrame.AccessibleJFrame
This kind of implementation JFrame Class accessibility support .
protected class AccessibleJFrame extends AccessibleAWTFrame {
// AccessibleContext methods
/** * Get the accessible name of this object. * * @return the localized name of the object -- can be null if this * object does not have a name */
public String getAccessibleName() {
if (accessibleName != null) {
return accessibleName;
} else {
if (getTitle() == null) {
return super.getAccessibleName();
} else {
return getTitle();
}
}
}
/** * Get the state of this object. * * @return an instance of AccessibleStateSet containing the current * state set of the object * @see AccessibleState */
public AccessibleStateSet getAccessibleStateSet() {
AccessibleStateSet states = super.getAccessibleStateSet();
if (isResizable()) {
states.add(AccessibleState.RESIZABLE);
}
if (getFocusOwner() != null) {
states.add(AccessibleState.ACTIVE);
}
// FIXME: [[[WDW - should also return ICONIFIED and ICONIFIABLE
// if we can ever figure these out]]]
return states;
}
} // inner class AccessibleJFrame
AccessibleJFrame Realized awt Medium AccessibleAWTFrame Interface
This class implements the auxiliary function support of the window class .
It provides... Suitable for window user interface elements Java Accessibility API The implementation of the .
- public String getAccessibleName() Localized name of the object , Can be null
Component How to implement the interface
The implementation logic is to get accessibleName If it is not empty, return accessibleName, Otherwise, get the form title ,title If it is empty, take the parent class accessibleName , Otherwise return to title
- public AccessibleStateSet getAccessibleStateSet() Get the status of the current object Overriding the parent class awt in Fram Methods
public AccessibleStateSet getAccessibleStateSet() {
AccessibleStateSet states = super.getAccessibleStateSet();
if (isResizable()) {
states.add(AccessibleState.RESIZABLE);
}
if (getFocusOwner() != null) {
states.add(AccessibleState.ACTIVE);
}
// FIXME: [[[WDW - should also return ICONIFIED and ICONIFIABLE
// if we can ever figure these out]]]
return states;
}
Logic : The parent object call gets the window state object reference , Gets whether this window is available for user adjustment , If yes, add one AccessibleState.RESIZABLE Indicates that the current window is not fixed . Get that the window has focus , If yes, it will be added as AccessibleState.ACTIVE Indicates that the current window is active .
1.3 JFram Medium Fields ( Property fields )
- protected AccessibleContextaccessibleContext Accessible context properties .
- static int EXIT_ON_CLOSE Exit the default window closing operation of the application .
- protected JRootPane rootPane tube The reason is ContentPane And... In the optional menu of this window JrootPane Examples and Glasspane.
- protected boolean rootPaneCheckingEnabled If true, Will add and setLayout The call will be forwarded to ContentPane.
contentPane
swing Four heavyweight components in JFrame, JDialog, JWindow, and JApplet
JROOTPANE The custom layout manager used ensures :
Glasspane Filled jrootpane The entire visible area of ( The border - Jack ).
DiallayPane Filled Jrootpane The entire visible area of .
( The border - Insert )
The incubator is located on the upper edge of the cover .
ContentPane Fill the entire visible area , If there is , Subtract the menu bar .
1.4 JFram Constructors ( Constructors )
- JFrame() Initial parameterless constructor
- JFrame(GraphicsConfiguration gc) Create a form in the specified graphic configuration and blank title of the screen device
- JFrame(String title) Create a new initial invisible form with the specified title
- JFrame(String title, GraphicsConfiguration gc) Create with the specified title and the specified graphic configuration of the screen device JFrame.
1.5 JFram Method Summary ( Only describe common methods )
- public void repaint(long time,
int x,
int y,
int width,
int height)
public void repaint(long time, int x, int y, int width, int height) {
if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
RepaintManager.currentManager(this).addDirtyRegion(
this, x, y, width, height);
}
else {
super.repaint(time, x, y, width, height);
}
}
Repaint the specified rectangle of this component in milliseconds .
time : The maximum time before updating is in milliseconds
x,y coordinate 、 Width and height
边栏推荐
- Flash implements forced login
- 线程的实现方式总结
- “Hello IC World”
- 王爽汇编语言详细学习笔记二:寄存器
- The most popular colloquial system explains the base of numbers
- Fundamentals of digital circuit (IV) data distributor, data selector and numerical comparator
- Overview of LNMP architecture and construction of related services
- What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
- Function: find the maximum common divisor and the minimum common multiple of two positive numbers
- Functions: Finding Roots of equations
猜你喜欢
What is the transaction of MySQL? What is dirty reading and what is unreal reading? Not repeatable?
Realize applet payment function with applet cloud development (including source code)
Data mining - a discussion on sample imbalance in classification problems
Binary search tree concept
JDBC transactions, batch processing, and connection pooling (super detailed)
《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
数字电路基础(四) 数据分配器、数据选择器和数值比较器
How does SQLite count the data that meets another condition under the data that has been classified once
《统计学》第八版贾俊平第五章概率与概率分布
Statistics 8th Edition Jia Junping Chapter 3 after class exercises and answer summary
随机推荐
数字电路基础(三)编码器和译码器
C language learning summary (I) (under update)
Fundamentals of digital circuits (II) logic algebra
Proceedingjoinpoint API use
How to test whether an object is a proxy- How to test if an object is a Proxy?
指针--剔除字符串中的所有数字
Sword finger offer 23 - print binary tree from top to bottom
{1,2,3,2,5}查重问题
[pointer] find the largest string
Es full text index
Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
Always of SystemVerilog usage_ comb 、always_ iff
浙大版《C语言程序设计实验与习题指导(第3版)》题目集
JDBC 的四种连接方式 直接上代码
The four connection methods of JDBC are directly coded
Function: calculates the number of uppercase letters in a string
“Hello IC World”
[pointer] delete all spaces in the string s