一个java的进销存管理系统源码阅读

   一边阅读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:

Diagram of MenuBar containing 2 menus: Examples and Options.
 Examples menu is expanded showing items: Basic, Simple, Check, and More Examples.

  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类:

           设置面板布局

           然后

        

           放置各个初始化后的控件

      )  

运行出来

  今天就到这吧,下午还要开会。明天继续,今天只看了主类

posted @ 2016-03-31 11:17  cancanw  阅读(5410)  评论(0编辑  收藏  举报