An excellent introductory textbook for "GUI development" swing

Source: Internet
Author: User

1 //Java University Concise tutorial Deitel Easy to understand, in detail swing graphical interface development2 3  PackageFirst ;4 5 Importjava.awt.*;6 Importjavax.swing.*;7 8 9  Public classWelcomeswingextendsJFrameTen { One     PrivateJLabel Textjlabel; A     //private JLabel Picturejlabel; -      -      Publicwelcomeswing () the     { - createuserinterface (); -     } -      +     Private voidcreateuserinterface () -     { +Container ContentPane =Getcontentpane (); A Contentpane.setbackground (color.yellow); atContentpane.setlayout (NULL); -          -Textjlabel =NewJLabel (); -Textjlabel.settext ("Welcome to Java programming!"); -Textjlabel.setlocation (35,0); -Textjlabel.setsize (550,88); inTextjlabel.setfont (NewFont ("Sanserif", font.plain,36)); - Contentpane.add (Textjlabel); to          +         //Picturejlabel = new JLabel (); -         //Picturejlabel.seticon (New ImageIcon ()); the          *Settitle ("Welcomeswing"); $SetSize (608,413);Panax NotoginsengSetVisible (true); -}//End Mothod Createuserinterface the      +      Public Static voidMain (string[] args) A     { thewelcomeswing application =Newwelcomeswing (); + application.setdefaultcloseoperation (jframe.exit_on_close); -}//End Method Main $  $}

Learning Swing, this book is probably the most understandable, this is Deitel consistent style, through the swing interface to learn the basic Java syntax and some API
Originally bought Java University Tutorial (2003 Edition), the inside GUI is AWT, is the example of JDK1.0, inside Applet's action method is now completely obsolete
In the JDK1.8, some examples inside can also run out, but the text box input data after the return, the interface has been unable to respond to enter the event message
It is a good book that is easy to understand, but there is no review of the utility, 65 dollars!



Revisit AWT, this is the first Java program to learn
1 //A First program in Java2  PackageFirst ;3 ImportJava.applet.Applet;4 ImportJava.awt.Graphics;5 6  Public classWellcomextendsapplet{7      Public voidPaint (Graphics g) {8g.DrawString ("Welcome to Java programing!", 5, 50);9g.DrawString ("Welcome to Java programing!", 5, 100);Ten     } One}

Honestly, Deitel's book is a good book, but this he wrote the Java University Tutorial (2003.4 Edition), using AWT, then let me this two eyes a smear dish, deeply Java GUI interface is extremely boring

At that time, poor personal machine configuration, running an applet are very laborious, looking at the stiff box, ugly and slow slowly squeeze on the screen, a sense of disgust arises spontaneously ...

More importantly, learn the basic syntax of Java, should not adopt this GUI teaching Method! Because, for beginners, and even to OOP, there is no concept, in the beginning will be plunged into a lot of unnecessary knowledge points, such as the inheritance of classes, the GUI interface of the event message response mechanism, the subclass of the method coverage, some of the GUI-related specific objects, such as, This hideous graphics g, what the hell is his grandmother??? Wait, wait, it's a real hassle!

Nothing but a little more visualization, but it is very likely to directly bruise the initiative of the beginning of the confused, not to mention, the AWT interface is surprisingly ugly, sun design This rotten thing, is simply insulting Java itself, the result is not long, AWT on Europe.

It turns out that although Deitel later also developed the Swing Java Basics Tutorial (as recommended here), he was in the sixth edition of the Java University Basic tutorial, taking the classics that worked in other Java textbooks:

public static void Main (string[] args) {

System.out.println ("Welcome to Java programming!");

}

and used the command-line compilation to run the Java program teaching method

What does this change mean?

This shows that, 10 years ago, is an extremely impetuous era, is addicted to GUI interface supremacy of the era, that era did not, Vb,delphi flying, a view GUI can make teaching easier and more convenient times, this, is absolutely wrong

Time shuttle, more than 10 years later today, in the configuration of the extremely general machine, swing interface can run very smooth, when using eclipse to open the above program, pop up a bright welcome interface, this is the dream of Java, perhaps I did not know there is swing, or swing can not achieve the current smooth, anyway, an AWT-style grammar tutorial, let me and Java pass ...

Fortunately, in the unconsciously from a remote directory, click on the Eclipse icon, everything is shaking, greatly different, this is what I want java!

Warning: Beginners who do not have the concept of gui,oop, you will go astray if you learn Java Basic Grammar from the practice of writing GUI interface code. Beginners, highly recommended to learn from GUI programming

The GUI most embodies the most complex part of OOP thought, for beginners who do not understand OOP, but GUI programming to get them into the OOP style of programming language, it is very ironic thing

An excellent introductory textbook for "GUI development" swing

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.