求助大佬,我这个代码没有任何报错但是运行没有窗体,老哥们有什么解决方法,谢谢了
[JavaFX] 纯文本查看 复制代码 package fanxingbao;
import java.awt.Color;
import java.awt.Point;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class LoginFrame extends JFrame {
private static final long serialVersionUID = 1L;
JLabel b1, b2;
JTextField txtyhm;// 单行文本框
JPasswordField jpfmm;// 密码框
JButton btnOK, btnNo;// 按钮
public void loginFrame() {
this.setTitle("登陆窗体");
this.setSize(420, 300);
Point p = new Point(100, 200);
this.setLocation(p);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setLayout(null);
b1 = new JLabel("用户名:");
b2 = new JLabel("密码:");
b1.setBounds(60, 60, 80, 30);
b2.setBounds(60, 110, 80, 30);
this.add(b1);
this.add(b2);
txtyhm = new JTextField();
jpfmm = new JPasswordField("123");
txtyhm.setBounds(150, 60, 180, 30);
jpfmm.setBounds(150, 100, 180, 30);
this.add(jpfmm);
this.add(txtyhm);
btnOK = new JButton("登录");// JButton(String text)
// Image Icon()
// Image Icon(JRLlocation)
// Image Icon
ImageIcon icon = new ImageIcon(LoginFrame.class.getResource("002.gif"));
new JButton("退出", icon);
btnOK.setBounds(100, 160, 80, 40);
btnOK.setBounds(230, 160, 100, 40);
this.add(btnOK);
this.add(btnNo);
b1.setBackground(new Color(202, 90, 194));
btnOK.setBackground(Color.BLUE);
btnOK.setForeground(Color.white);
this.setVisible(true);
}
public static void main(String[] args) {
new LoginFrame();
}
}
|