Everyone is good, the younger brother has just contacted Java. Some problems are not very understanding, I hope everyone will he

xiaoxiao2021-03-06  39

The younger brother found a section code in the Internet.

Although I don't understand, I really want to understand it.

I wrote it myself.

How can you compose it?

I hope that you can give your youep only!

Greatful!

Import javax.swing. *;

Import java.awt. *;

Public class myframe extends jframe

{

JButton Button;

Jlabel label;

Jtextfield text;

JPANel P;

Font F;

Public myframe ()

{

Super ("My Window");

Button = New JButton ("Button");

Button.Settext ("Button");

Button.SetForeground (Color.Red);

f = New font ("Huawenbo", Font.Bold, 36);

Button.SetFont (f);

Label = New Jlabel ("label");

Label.SetTooltiptext ("this is a label");

Label.setfont (f);

Label.Settext ("label");

Text = New jtextfield (10);

Text.Settext ("1213");

Text.setfont (f);

P = new jpanel ();

getContentPane (). Add (p);

p.Add (Button);

P.Add (label);

p.Add (text);

SetDefaultCloseOperation (jframe.exit_on_close);

Setsize (300, 300);

SetVisible (TRUE);

}

Public static void main (string [] args)

{

NEW myframe ();

}

}

转载请注明原文地址:https://www.9cbs.com/read-62528.html

New Post(0)