assetview.java
来自「一个企业小型固定资产系统的源代码。发布出来让刚学习java的人研究。」· Java 代码 · 共 139 行
JAVA
139 行
package project;
/*
*AssetView.java:建立固定资产管理界面(类)。
*包括:增、删、改3个子界面。
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
public class AssetView extends JDialog {
public AssetPanel p1;
public AssetView(ButPanel p2) {
JLabel lblTiTle = new JLabel("资产编辑");
lblTiTle.setFont(new Font("隶书", Font.PLAIN, 30));
lblTiTle.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().setLayout(new BorderLayout());
p1 = new AssetPanel();
getContentPane().add(lblTiTle, BorderLayout.NORTH);
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
}
}
class AssetPanel extends JPanel implements ActionListener {
private Container cont;
private GridBagLayout layout;
private GridBagConstraints cons;
JLabel lblAssproID ;
JLabel lblAssproNID ;
JLabel lblAssproName ;
JLabel lblAssproTSize ;
JLabel lblAssproProperty ;
JLabel lblAssproUnit ;
JLabel lblAssproRemark ;
public JTextField jtfAssproID ;
public JTextField jtfAssproNID ;
public JTextField jtfAssproName ;
public JTextField jtfAssproTSize ;
public JTextField jtfAssproProperty ;
public JTextField jftAssproUnit ;
public JTextArea jtaAssproRemark ;
JScrollPane jScrollPane1 ;
public AssetPanel() {
cont = this;
layout = new GridBagLayout();
cont.setLayout(layout);
cons = new GridBagConstraints();
lblAssproID= new JLabel("资产代码");
lblAssproNID= new JLabel("资产新代码");
lblAssproName = new JLabel("资产名称");
lblAssproTSize = new JLabel("型号规格");
lblAssproProperty = new JLabel("资产属性");
lblAssproUnit= new JLabel("单位");
lblAssproRemark= new JLabel("备注");
jtfAssproID = new JTextField(10);
jtfAssproNID = new JTextField(10);
jtfAssproName = new JTextField(10);
jtfAssproTSize= new JTextField(10);
jtfAssproProperty = new JTextField(10);
jftAssproUnit =new JTextField(10);
jtaAssproRemark= new JTextArea(5,10);
jScrollPane1 = new JScrollPane(jtaAssproRemark);
addComponent(lblAssproID ,0,0,1,1);
addComponent(jtfAssproID,0,1,1,1);
addComponent(lblAssproNID ,1,0,1,1);
addComponent(jtfAssproNID,1,1,1,1);
addComponent(lblAssproName,2,0,1,1);
addComponent(jtfAssproName,2,1,1,1);
addComponent(lblAssproTSize,3,0,1,1);
addComponent(jtfAssproTSize,3,1,1,1);
addComponent(lblAssproProperty,4,0,1,1);
addComponent(jtfAssproProperty,4,1,1,1);
addComponent(lblAssproUnit,5,0,1,1);
addComponent( jftAssproUnit,5,1,1,1);
addComponent(lblAssproRemark,6,0,1,1);
addComponent(jScrollPane1,6,1,1,1);
}
private void addComponent(Component comp,
int row, int column, int width, int height) {
cons.gridx = column;
cons.gridy = row;
cons.gridwidth = width;
cons.gridheight = height;
layout.setConstraints(comp,cons);
cont.add(comp);
}
public void actionPerformed(ActionEvent e) {
}
}
class AddAssetView extends AssetView {
public AddAssetView(ButPanel p) {
super(p);
setTitle("增加资产");
p1.jtfAssproNID.setEnabled(false);
// p1.jtfUseby.setEnabled(false);
}
}
class UptAssetView extends AssetView {
public UptAssetView(ButPanel p) {
super(p);
setTitle("修改资产");
// p1.jcbCateId.setEnabled(false) ;
// p1.jcbSubCateId.setEnabled(false) ;
}
}
class DelAssetView extends AssetView {
public DelAssetView(ButPanel p) {
super(p);
setTitle("删除资产");
p1.jtfAssproNID.setEnabled(false);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?