Java programming ideas Chapter 1 exercise 3

Source: Internet
Author: User

I have never written a Java program, but it is just a theory. So I decided to write a program from Chapter 1. However, I forgot the theoretical knowledge I learned earlier. It seems that I still have to learn from practice.

This is the first article. The readers should know that I am a good cook. I hope you will give me more advice and suggestions!

First problem: because a toolkit is created independently, You need to reference the toolkit. Later, I tried to set the environment variable in classpath. Is there any other way? Please advise. Of course, I will continue to explore and work tomorrow night.

Second question: very naive. Classpath environment variables cannot be set as Chinese paths and cannot be identified.

Well, there are two problems. I found that my code writing speed is slow, so it takes a little time to practice it. I don't need to worry about it (I still want to hurry up.

Code:

Import util. *; // custom toolkit, including the swingconsole class.
Import javax. Swing .*;
Import java. util. Concurrent .*;

Public class submitswingprogram extends jframe
{

Jlabel label;
Public submitswingprogram ()
{
Label = new jlabel ("A label ");
Add (Label );
}
Static submitswingprogram SSP;
Public static void main (string [] ARGs) throws exception
{
Ssp = new submitswingprogram ();
Swingconsole. Run (SSP, 300,100 );
Timeunit. Seconds. Sleep (1 );
Swingutilities. invokelater (New runnable ()
{
Public void run ()
{
Ssp. Label. settext ("Hey! This is different! ");
}
});
}
}

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.