givebackwindow.java

来自「自己做的影碟碟出租管理系统」· Java 代码 · 共 75 行

JAVA
75
字号
/**
 * @(#)GiveBackWindow.java
 *
 *
 * @author 
 * @version 1.00 2008/6/1
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class GiveBackWindow extends AppFrame{

    Container c;
    private GridBagLayout layout;
    private GridBagConstraints constraints; 
    JButton test;
    JButton ok ;
    JButton cancel;
    JLabel UserLabel;
    JLabel DiscLabel;
    JLabel TimeLabel;
   
    JLabel Label1=new JLabel("扣除金额");
    JLabel Label2=new JLabel("帐户余额");
    JTextField UserField=new JTextField(12);
    JTextField DiscField=new JTextField(12);
 
    JTextField plus=new JTextField(5);
    JTextField left=new JTextField(5);
    public GiveBackWindow() {
    	c=getContentPane();
        layout=new GridBagLayout();
    	c.setLayout(layout);
    	constraints=new GridBagConstraints();
    	 super.setTitle("删除碟片");
        UserLabel=new JLabel("输入归还的用户");
        DiscLabel=new JLabel("输入归还的碟片");
    
        test=new JButton("结算");
     	ok =new JButton("归还");
    	ok.setEnabled(false);
        cancel=new JButton("取消");
        addComponent(UserLabel,0,0,1,1);
        addComponent(UserField,0,1,1,3);
        addComponent(DiscLabel,1,0,1,1);
        addComponent(DiscField,1,1,1,3);
      
        addComponent(Label1,3,0,1,1);
        addComponent(plus,3,2,1,1);
        addComponent(Label2,4,0,1,1);
        addComponent(left,4,2,1,1);
        
        addComponent(test,6,1,1,1);
        addComponent(ok,6,2,1,1);
        addComponent(cancel,6,3,1,1);
    
     	c.setBackground(Color.LIGHT_GRAY);
        setLocation(200,100);
        setVisible(true);
    }
    
   private void addComponent( Component component,
      int row, int column,  int height,int width )
   {
      
      constraints.gridx = column;
      constraints.gridy = row;
      constraints.gridwidth = width;   
      constraints.gridheight = height;
      layout.setConstraints( component,constraints);  
      c.add(component);      
   } 

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?