Read Java's source program, do not know where to read the Java API
The latest JDK document, the Java API, can be found in the Java Web site http://www.oracle.com/technetwork/java/javase/documentation/index.html
One.
The main class mainframe inherits from JFrame, which is a form
Two.
Next, declare the member variable:
jlable: displaying text and pictures
jpannel: The panel can assemble some components to lay out. Of course, the panel is also a container ~
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 a menu bar might:
JToolBar:
A is JToolBar
a container this groups several components-usually buttons with Icons-into a row or column. Often, tool bars provide easy access to functionality that's also in menus
For more information, see: 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 breaks them up to logical groupings. Instead of using JSeparator
directly, you can use the JMenu
or JPopupMenu
addSeparator
method to create and add a separator. JSeparator
s may also was used elsewhere in a GUI wherever a visual divider is useful
At this point, the member variable is complete
Three. Methods
3.1 Program Main method
splash screen +login
3.2 Initializing member variables toolbar
ToolBar = new ToolBar (Getframemenubar ());
Toolbar.setcursor (new Cursor (cursor.hand_cursor)); The parameter of the cursor's constructor is the type of curser
3.3 Initializing member variables Framemenubar
Here's how:
Protected MenuBar Getframemenubar () {
if (Framemenubar = = null) {
Framemenubar = new MenuBar (Getdesktoppane (), Getstatelabel ()); The return value of the initialization method for other variables
}
return framemenubar;
}
3.4 Initializing Statepanel
First new a lot of gridbagconstraints, initialize the member variable of each constraints.
Initialize Statepanel
...............
Four.
Finally, the method of initialize is called in the constructor method of the main class. This initiallize method gives this form,
Set the size
The menu bar is bound
The content panel is bound
(The initialization method of the call content panel returns a Jpane class:
Set Panel layout
And then
Placing the controls after each initialization
)
Run out
Come here today and have a meeting in the afternoon. Tomorrow continues, today only the main class
A Java Invoicing management system source Reading