Java 2014-12-03 Li Shuning

Source: Internet
Author: User

Calculator

An interface, a function

Parameters are implemented in arrays with variable number of parameters,

Viewing the source code can also be viewed from the JRE package

Box Grid layout Manager

Box:creatverticalbox

    

JScrollPane

JSplitPane

JTree

JTable

Java Event-driven model

Button.addactionlistener (/* parameter is a actionlistener*/)//interface-oriented programming

Class Cbuttonexit implements actionlistener{

public void actionperformed (ActionEvent argo) {

System.exit (0);

}

}//ctrl+1 quickly generate code

Null pointer error:

Whether to instantiate, whether there is a null pointer, there is no more than life cycle, or scope.

Anonymous inner class. Instantiate in the form of an interface

JMenuItem

JMenu

JMenuBar

First do a menubar, which put is the menu, if it is a level two menus in the restaurant put menu, if the node is put JMenuItem bar

Then use addActionListener.

You can also use class Frame1 extends JFrame implements actionlistener{}

1Class Frame1Extends JFrameImplementsactionlistener{2Publicvoid actionperformed (ActionEvent Argo) { 3 Object Objsource =  Argo.getsource ();  (JComponent) Objsource; 5 if (Com.getname (). Equals ("Regist"  6  { 7 } 8 else if (Com.getname (). Equals (" 9 10  11 12}           

Java 2014-12-03 Li Shuning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.