import javax.swing.JFrame;
成都创新互联公司成都企业网站建设服务,提供成都网站制作、成都做网站、外贸营销网站建设网站开发,网站定制,建网站,网站搭建,网站设计,自适应网站建设,网页设计师打造企业风格网站,提供周到的售前咨询和贴心的售后服务。欢迎咨询做网站需要多少钱:028-86922220
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
public class LoginFrame {
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="293,25"
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JTextField jTextField = null;
private JTextField jTextField1 = null;
private JButton jButton = null;
/**
* This method initializes jFrame
*
* @return javax.swing.JFrame
*/
private JFrame getJFrame() {
if (jFrame == null) {
jFrame = new JFrame();
jFrame.setSize(new Dimension(330, 222));
jFrame.setTitle("登陆");
jFrame.setContentPane(getJContentPane());
}
return jFrame;
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJPanel(), null);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(45, 76, 54, 22));
jLabel1.setText("密 码:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(47, 39, 53, 25));
jLabel.setText("用户名:");
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBounds(new Rectangle(2, 7, 305, 167));
jPanel.add(jLabel, null);
jPanel.add(jLabel1, null);
jPanel.add(getJTextField(), null);
jPanel.add(getJTextField1(), null);
jPanel.add(getJButton(), null);
}
return jPanel;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(106, 40, 154, 24));
}
return jTextField;
}
/**
* This method initializes jTextField1
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField1() {
if (jTextField1 == null) {
jTextField1 = new JTextField();
jTextField1.setBounds(new Rectangle(105, 76, 154, 23));
}
return jTextField1;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(187, 103, 66, 25));
jButton.setText("登陆");
}
return jButton;
}
}
1、新建一个界面,需要时隐藏开始界面,把新的界面显示出来。
2、如果你是使用swing进行开发,你在一个frame里面进行操作。新增页面就是新增panel,并将panel1.hide
清空表格内容代码如下:
DefaultTableModel model =(DefaultTableModel) jTable1.getModel();
while(model.getRowCount()0){
model.removeRow(model.getRowCount()-1);
}
Swing是一个用于开发Java应用程序用户界面的开发工具包。以抽象窗口工具包(AWT)为基础使跨平台应用程序可以使用任何可插拔的外观风格。
1.小程序中调用repaiint方法时,程序会首先清除paint()方法以前所画的内容。 2.利用clearRect(int x,int y,int width,int height)用背景色填充指定矩形达到清除该矩形的效果,相当一个“橡皮擦”
采纳哦