一邊閱讀java的源程序,不懂的地方查閱java的API
可以在java網站http://www.oracle.com/technetwork/java/javase/documentation/index.html中找到最新的JDK文檔,即java的API
一.
主類mainFrame繼承自JFrame,是一個窗體
二.
接下來聲明成員變量:
Jlable:顯示文本和圖片
JPannel:面板可以聚集一些組件來布局。當然,面板也是一種容器~
MenuBar:
The MenuBar class encapsulates the platform's concept of a menu bar bound to a frame. In order to associate the menu bar with a Frame object, call the frame's setMenuBar method.
This is what a menu bar might look like:

JToolBar:
A JToolBar is a container that groups several components — usually buttons with icons — into a row or column. Often, tool bars provide easy access to functionality that is also in menus
詳細內容請見:https://docs.oracle.com/javase/tutorial/uiswing/components/toolbar.html
JSeparator
JSeparator provides a general purpose component for implementing divider lines - most commonly used as a divider between menu items that breaks them up into logical groupings. Instead of using JSeparator directly, you can use the JMenu or JPopupMenu addSeparator method to create and add a separator. JSeparators may also be used elsewhere in a GUI wherever a visual divider is useful
至此,成員變量介紹完畢
三.方法
3.1程序主方法
閃屏+login
3.2初始化成員變量ToolBar
toolBar = new ToolBar(getFrameMenuBar());
toolBar.setCursor(new Cursor(Cursor.HAND_CURSOR)); //cursor的構造函數的參數是curser的類型
3.3初始化成員變量frameMenuBar

方法如下:
protected MenuBar getFrameMenuBar() {
if (frameMenuBar == null) {
frameMenuBar = new MenuBar(getDesktopPane(), getStateLabel()); //其他變量的初始化方法的返回值
}
return frameMenuBar;
}
3.4初始化statePanel

首先new了很多GridBagConstraints,初始化每個constraints的成員變量。
初始化StatePanel
...............
四.
最后在主類的構造方法中,調用了initialize的方法。這個initiallize的方法給這個窗體,
設置了大小
綁定了菜單欄
綁定了內容面板
(調用內容面板的初始化方法返回一個Jpane類:
設置面板布局
然后

放置各個初始化后的控件
)
運行出來
今天就到這吧,下午還要開會。明天繼續,今天只看了主類
