马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
<P>import javax.swing.*;<BR>import java.awt.*;<BR>import javax.swing.border.*;<BR>import javax.swing.Box;<BR>import java.awt.event.*;<BR>class Mypanell extends Panel<BR> { Checkbox box1,box2;CheckboxGroup sex;<BR> Mypanell()<BR> { sex=new CheckboxGroup();<BR> box1=new Checkbox("男",true,sex);<BR> box2=new Checkbox("女",false,sex);<BR> add(box1);add(box2);<BR> }<BR>}</P>
<P>public class Youxiang extends java.applet.Applet<BR>{ Mypanell panell;<BR> TextField text1,text2;Color backColor;<BR> Button button1,button2;<BR> Box baseBox,boxV1,boxV2;<BR> Choice choice;<BR> public Youxiang()<BR> {<BR> setBackground(Color.pink);<BR> backColor=getBackground();<BR> boxV1=Box.createVerticalBox();<BR> boxV1.add(new Label("用户名"));<BR> boxV1.add(Box.createVerticalStrut(8));<BR> panell=new Mypanell();<BR> boxV1.add(panell);<BR> boxV1.add(Box.createVerticalStrut(8));<BR> <BR> boxV1.add(new Label("登录密码"));<BR> boxV1.add(Box.createVerticalStrut(8));<BR> <BR> boxV1.add(new Label("确认密码"));<BR> boxV1.add(Box.createVerticalStrut(8));<BR> <BR> boxV1.add(new Label("密码提示问题"));<BR> boxV1.add(Box.createVerticalStrut(8));<BR> <BR> boxV1.add(new Label("提示问题答案"));<BR> boxV1.add(Box.createVerticalStrut(8));<BR> ////////////////////////////////////<BR> boxV2=Box.createVerticalBox();<BR> boxV2.add(new TextField(16));<BR> boxV2.add(Box.createVerticalStrut(46));<BR> text1=new TextField(10);<BR> text1.setEchoChar('*');<BR> boxV2.add(text1);<BR> boxV2.add(Box.createVerticalStrut(8));<BR> //boxV2.add(new TextField(16));<BR> text2=new TextField(10);<BR> text2.setEchoChar('*');<BR> boxV2.add(text2);<BR> boxV2.add(Box.createVerticalStrut(8));<BR> /////////////////////////////////<BR> choice=new Choice();<BR> <BR> choice.add("123");<BR> choice.add("456");<BR> choice.add("789");<BR> boxV2.add(choice);<BR> ///////////////////////////////<BR> <BR> boxV2.add(Box.createVerticalStrut(8));<BR> boxV2.add(new TextField(16));<BR> boxV2.add(Box.createVerticalStrut(8));<BR> <BR> add(boxV1);<BR> add(boxV2);<BR> <BR> button1=new Button("提交");<BR> button2=new Button("取消");<BR> add(button1);<BR> add(button2);<BR> }<BR> public void paint(Graphics g)<BR> {<BR> g.setColor(Color.red);<BR> g.drawString("以上信息对保证您的帐号的安全极为重要,请您认真填写并牢记",100,300);<BR> }</P>
<P> public static void main(String args[])<BR> {<BR> final java.applet.Applet f=new Youxiang();<BR> //f.setVisible(true);<BR> System.out.println(f);<BR> }<BR>}<BR><BR>编译过了,但无显示结果,郁闷啊。请问应该如何改?</P> |