When the interface is generated, I want to do a click on a JLabel add a jlabel, that is, similar to the QQ add friends can be added to a friend in a timely manner. Oneself to do for a long time, found not timely refresh. I looked it up on the internet and studied it for a little while. Discover the need to validate this function to re-layout. Wrote a little feature of this. PackageQq.client.tools;Importjava
Java image interface development example
For jradiobutton, jcheckbox, and jlabel applications, you only need to modify the jcheckbox and jlabel applications and add single-choice buttons. A set of note single-choice buttons must be placed in the buttongroup to take effect. The Code is as follows:Import java. AWT. borde
Java image interface development example
The jlabel component is used to display text information. The jcheckbox component is used to set text attributes. The Code is as follows:Import java. AWT. borderlayout;
Import java. AWT. Font;
Import java. AWT. event. actionevent;
Imp
problem : Use a jlabe to display the number of seconds, and automatically reduce the number by 1 per secondThe problem seems very simple, but for beginners of Java, I really took a little effort.The first is how to do it instantly, and can take a threading approach:try {thread.sleep;} catch (Interruptedexception e) {e.printstacktrace ();} TimeLeft--;Thread.Sleep (N)Represents n milliseconds before proceeding to the next step, that is, when n is 1000,
construction method//Create a label and set the text on the label right in the middle of the labelJLabel jl=NewJLabel ("Test", Icon,swingconstants.center); JFrame JF=NewJFrame ();//Create a jframe windowContainer Container=jf.getcontentpane ();//Convert a window to a containerContainer.setbackground (Color.Blue); Container.add (JL); //set the external properties of a containerJf.settitle ("Use of tags, create icons"); Jf.setvisible (true); Jf.setsize (340,400); Jf.setdefaultcloseopera
ObjectiveThis article describes how to help jfc/swing jlabel components create more colorful applications with Java 2D's "magic".
As one of the basic components of the jfc/swing architecture, JLabel is widely used. When you want to draw non-editable text, JLabel is the only option that Jfc/swing offers us. In general,
=NewJLabel (); Pngreen.add (result); Result.settext (After entering the name, click on the ' Test character ' button to see the character value! "); //top row Yellow canvas re-layoutPnyellow.setlayout (NewBorderLayout ()); JLabel label=NewJLabel ();//Generate LabelsLabel.settext ("Enter Name"); Pnyellow.add (label, borderlayout.west);//put it on the left side of the yellow canvasLabel.setbackground (Color.yellow); JTextField text=NewJTextField
The first thing to grasp is a concept: a string of pixels in the computer screen, for example, to take a jlabel inside the text occupied by the width and height, the method is as follows: (mainly used FontMetrics class)
import java.awt.FontMetrics; import javax.swing.JLabel; JLabel label = new JLabel("test Label "); FontMetrics metrics = label.getFontMetrics(lab
Reproduced from: http://blog.sina.com.cn/s/blog_6eef4a86010140or.html
JLabel, JButton, etc. cannot be wrapped in "\ n", but they support HTML, so they can be implemented with Attach a small procedure:
01PackageCom.kaso.Test;0203ImportJavax.swing.JFrame;04ImportJavax.swing.JLabel;0506Public classTestframeextendsJFrame {07PrivateJLabel label =NewJLabel ("");0809 PublicTestframe () {10 This. Add (label);One String s = Fun ();Label.settext ("1
Java GUI implements the student achievement management system,
I have been learning java for more than a year and have been doing web exercises. In a project, I found that the GUI-related knowledge is required and the results cannot be obtained, there are not many articles in this area on the Internet, so I had to learn them from the beginning. However, I found that the GUI is very interesting, he does not
Java --- Swing Interface Development Summary, java --- swing Interface
I. graphical interface of java
1. awt java. awt
The graphic interface launched before jdk1.4 is written in c/c ++, which is not cross-platform.
2. swing javax. swing
Jdk1.4 graphic interface, good cross-platform
Ii. common components
1. Container Co
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.