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! ");
}
});
}
}