We do not know much about Java internal classes. Here we will introduce in detail the role of Java internal classes in GUI Design in the form of actual code.
JavaInternal classes are rarely used in J2EE programming,However, Window application programming is particularly common and mainly used for event processing. In fact, for non-
[]){ new JFrame(“我的第一个窗口”); mw.setSize(250,200); new JButton(“我是一个按钮”); mw.getContentPane().add(button); mw.setVisible(true); }}When writing GUI programs with swing, it is not usually necessary to create a Window object directly with JFrame, but to create a Window object with a subclass derived from JFrame, and to include the specific requirements and special contents of the window in the subclass.//define JFrame
GUI (graphical user interface)
Import Java.awt.Button;
Import Java.awt.FlowLayout;
Import Java.awt.Frame;
Import Java.awt.event.WindowAdapter;
Import java.awt.event.WindowEvent;
/** * GUI (graphical user interface) * Graphical user Interface (graphical user interface) * Graphically, to display the interface of computer operation, so that more convenient and intuitive.
* * CLI * command line user Int
Atitit. Gui skin and skin replacement summary java. net c ++, atitit.gui.net
Atitit. Gui skin and skin replacement summary java. net c ++
1. Swing skin 1
1.1. windows style 1
1.2. Mac style (liquid framework) 1
2. How to add a watermark or background to an application? 2
3. Common swing skin package substance, JTatto
Atitit. GUI interface Skin and skinning summary java. NET C + +
1. Swing Skin 1
1.1. Windows Style 1
1.2. MAC Style (liquid frame) 1
2. How to add watermarks or backgrounds to the application. 2
3. Commonly used swing skin package substance, Jtattoo 2
C + + skin QT directly support the CSS, easy.
. NET WinForm ya ten immediately go into effect ...
Sun's design of swing takes into account the visual sens
Easy to use Java GUI to make a simple puzzle gameMainPackage Hw1;import Java.io.ioexception;import Javax.swing.icon;import javax.swing.imageicon;import Javax.swing.jframe;import Javax.swing.jlabel;public class HW1 extends jframe{/** * */public hw1_0586 (String string) {Ico n icon = new ImageIcon (string); JLabel label = new JLabel (icon); this.add (label); This.settitle ("Original image!"); This.setlocation
1.GUI (graphical user interface)Graphical user Interface (GUI).Graphically, to show the interface of computer operation, which is more convenient and more intuitive.2.CLICommand line user Interface (Shell interface)is a common DOS command-line operation.Need to remember some common commands, the operation is not intuitive.Example:For example: Create a folder, or delete a folder, etc.Java provides the
GuiGraghical user Interface (GUI)Java provides GUI for objects that exist in java.awt and java.swing packagesJava GUI does but C + + etc, do not intend to waste too much time on thisA simple form demonstrationpublic static void Main (string[] args) {frame f = new Frame ("new form"); F.setlocation (400, 200);//Set the p
GUI Graphics user interface GUI
AWT Abstract Window Toolkit abstract Windows Development Package
Component Manager
Layout Manager
Event handling
Java graphics
Window Event
AWT abstracts graphical elements such as toolbars, menus, drop-down bars, input boxes, etc. Component: All graphical elements that can be displayed window:
must first call the Getcontentpane in the class JFrame to get the contents pane of the frame,The contents pane is then called by the method add to add the component to the Contents pane. For example, the example above.The contents pane delegate.1 ImportJavax.swing.JButton;2 ImportJavax.swing.JFrame;3 4 Public classFrameWithButton1extendsJFrame {5 PublicFrameWithButton1 () {6JButton button=NewJButton ("button");7Add (button);//JavaSE5 followed by8 }9 Public Static voidMain (string
I. Understand vocabulary
1. Common Words
2. java. AWT package
The Java. AWT package is a Java built-in package, which is part of the Java basic class library (jfc [Java foundation classes]) and contains the following content:
1. a rich set of interface compone
JFrame The basic idea of –java GUI program is based on JFrame, which is the object of window on screen, which can be maximized, minimized and closed. JPanel –java Graphical user interface (GUI) Toolkit The Panel container class in swing, included in the Javax.swing package, can be nested, and functionality is a lightwe
Learning from Java Swing:Focus on understanding Container classes (Container) and component Classes (Component):
Java the object created by the subclass or indirect subclass of the component class is called a component
Java the object created by the subclass or indirect subclass of container is called a container
You can add components to a container
First talk about Swing's features:1 a rich and fast collection of user interface elements.2. The dependency on the operating platform is small, so there are few bugs.3. For different operating platforms, you can give users a consistent feeling. However, the user interface made differs greatly from the local running platform.Java's image user interface is not his strong point, whether it is the original AWT, or later swing is the same, but for the current my personal Android learning, although th
different event sourcesCases:Analysis:1) Event Source to maintain a list of listeners, the resulting events pass these listeners2) The event object should carry information about the event source.3) Event listener to know the source of the event and respond differently depending on the source of the eventEmotional models----------------Girls have emotional events sent to boysGirl Event Source1) responsible for generating emotional events happy ()/sad (), passing the emotion to all the boys inte
+N2) and convert to a string/}}
Classical usage in Java: Holding a reference to another class inside a class
Package cn.javastudy.summary;
Import java.awt.*;
Import java.awt.event.*;
public class TestMath1 {public static void main (String args[]) {new Ttmyframe (). Launchframe (); /* Create the Ttmyframe object and invoke the Lauchframe () method to display the Calculator form///////////////////* Do the form interface of the calculato
Java GUI allows you to connect any circle with arrows and storePass a small geometric program, the little girl is not talented, I remember thinking for a few days to get it out, O (cute _ cute) O design a GUI program, in the window, use the mouse to draw a circle (all circles are of the same size and can be stored), and drag the mouse to draw a line between the c
1. Graphical User Interfacejava objects that are provided for the GUI exist in Java. AWT and javax. Swing two packages in Java. Awt:abstract window Toolkit Abstract Windows Toolkit needs to invoke Local System method implementation functions, poor portability, dependent system. Heavy-weight control javax. Swing's set of graphical interface systems, based on AWT,
those who require the user to do something (such as clicking on a drop-down menu items) only appear dialog box, this dialog is dialog.Ii. Components and Containers (component and container) 2.1.Frame Frame Example:1 package cn.javastudy.summary; 2 3/** Learn Java GUI programming the first graphical interface window */4 import java.awt.*; 5 6 Public class Testframe {7 public static void main ( Strin
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.