java的setvisible_setVisible(true)后还是看不见框架

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class TextLog extends JFrame implements ActionListener{

Container c=getContentPane();

JPanel p1,p2,p3;

JLabel lb1,lb2,lb3;

JTextField tf1,tf2;

JButton b1,b2;

public void TextLog(){

c.setSize(350,200);

c.setName("登陆");

p1=new JPanel();

p2=new JPanel();

p3=new JPanel();

lb1=new JLabel("用户名:");

lb2=new JLabel("密码:");

lb3=new JLabel("版权所有:");

tf1=new JTextField(15);

tf2=new JTextField(15);

b1=new JButton("登陆");

b2=new JButton("退出");

b1.addActionListener(this);

b2.addActionListener(this);

p1.setLayout(new GridLayout(2,2,3,3));

p1.add(lb1);

p1.add(tf1);

p1.add(lb2);

p1.add(tf2);

c.add(p1,BorderLayout.NORTH);

p2.setLayout(new GridLayout(1,2));

c.add(p2,BorderLayout.CENTER);

p3.add(lb3);

c.add(p3,BorderLayout.SOUTH);

c.setVisible(true);

}

public void actionPerformed(ActionEvent ae){

String s1,s2;

s1=ae.getActionCommand();

if(s1.equals("登陆")){

Fund a=new Fund();

a.go();

}

else System.exit(0);

}

public static void main(String as[]){

TextLog t=new TextLog();

}

}

//编译可以通过,运行后什么也没,中间有设置setVisible,望高手指点

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值