?? pkwgui.java
字號:
/** Programmname : PkwGUI <br>Klasse : <b> PkwGUI </b>@autor Li,Haibin Hou,Yujing Zhang,Xiangpeng@version 1.0 / 15.12.2006*/import java.awt.*;import javax.swing.*;abstract class PkwGUI extends JDialog{ protected MainGUI parentJFrame; protected String identnummerString,typString,herstellerString, farbeString,kmleistungString,preisString; protected int kmleistung,preis; protected int errorcode; protected JLabel actionJLabel; protected JLabel identnummerJLabel,typJLabel,herstellerJLabel, farbeJLabel,kmleistungJLabel,preisJLabel; protected JTextField identnummerJTextField,typJTextField, herstellerJTextField,farbeJTextField, kmleistungJTextField,preisJTextField; protected static Font aFont=new Font("Courier",Font.BOLD,30); protected static Font cFont=new Font("Courier",Font.BOLD,12); protected static Color fColor=Color.white; protected static Color editColor=Color.blue; protected static Color noeditColor=Color.red; protected static Color textColor=Color.white; protected int pl=25,po=25,pw=170,ph=30; protected PkwGUI(MainGUI aGUI,boolean mode) { super(aGUI,mode); getContentPane().setLayout(null); getContentPane().setBackground(fColor); actionJLabel=new JLabel(); actionJLabel.setBounds(pl,po,2*pw,ph); actionJLabel.setFont(aFont); actionJLabel.setVisible(true); getContentPane().add(actionJLabel); identnummerJLabel=new JLabel("Identifikationsnr"); identnummerJLabel.setBounds(pl,po+=2*ph,pw,ph); identnummerJLabel.setFont(cFont); identnummerJLabel.setVisible(true); getContentPane().add(identnummerJLabel); identnummerJTextField=new JTextField(); identnummerJTextField.setBounds(pl+pw,po,pw,ph); identnummerJTextField.setFont(cFont); identnummerJTextField.setEditable(false); identnummerJTextField.setBackground(noeditColor); identnummerJTextField.setForeground(textColor); identnummerJTextField.setVisible(true); getContentPane().add(identnummerJTextField); typJLabel=new JLabel("Typ"); typJLabel.setBounds(pl,po+=2*ph,pw,ph); typJLabel.setFont(cFont); typJLabel.setVisible(true); getContentPane().add(typJLabel); typJTextField=new JTextField(); typJTextField.setBounds(pl+pw,po,pw,ph); typJTextField.setFont(cFont); typJTextField.setEditable(true); typJTextField.setBackground(editColor); typJTextField.setForeground(textColor); typJTextField.setVisible(true); getContentPane().add(typJTextField); herstellerJLabel=new JLabel("Hersteller"); herstellerJLabel.setBounds(pl,po+=2*ph,pw,ph); herstellerJLabel.setFont(cFont); herstellerJLabel.setVisible(true); getContentPane().add(herstellerJLabel); herstellerJTextField=new JTextField(); herstellerJTextField.setBounds(pl+pw,po,pw,ph); herstellerJTextField.setFont(cFont); herstellerJTextField.setEditable(true); herstellerJTextField.setBackground(editColor); herstellerJTextField.setForeground(textColor); herstellerJTextField.setVisible(true); getContentPane().add(herstellerJTextField); farbeJLabel=new JLabel("Farbe"); farbeJLabel.setBounds(pl,po+=2*ph,pw,ph); farbeJLabel.setFont(cFont); farbeJLabel.setVisible(true); getContentPane().add(farbeJLabel); farbeJTextField=new JTextField(); farbeJTextField.setBounds(pl+pw,po,pw,ph); farbeJTextField.setFont(cFont); farbeJTextField.setEditable(true); farbeJTextField.setBackground(editColor); farbeJTextField.setForeground(textColor); farbeJTextField.setVisible(true); getContentPane().add(farbeJTextField); kmleistungJLabel=new JLabel("Kilometerleistung"); kmleistungJLabel.setBounds(pl,po+=2*ph,pw,ph); kmleistungJLabel.setFont(cFont); kmleistungJLabel.setVisible(true); getContentPane().add(kmleistungJLabel); kmleistungJTextField=new JTextField(); kmleistungJTextField.setBounds(pl+pw,po,pw,ph); kmleistungJTextField.setFont(cFont); kmleistungJTextField.setEditable(true); kmleistungJTextField.setBackground(editColor); kmleistungJTextField.setForeground(textColor); kmleistungJTextField.setVisible(true); getContentPane().add(kmleistungJTextField); preisJLabel=new JLabel("Preis"); preisJLabel.setBounds(pl,po+=2*ph,pw,ph); preisJLabel.setFont(cFont); preisJLabel.setVisible(true); getContentPane().add(preisJLabel); preisJTextField=new JTextField(); preisJTextField.setBounds(pl+pw,po,pw,ph); preisJTextField.setFont(cFont); preisJTextField.setEditable(true); preisJTextField.setBackground(editColor); preisJTextField.setForeground(textColor); preisJTextField.setVisible(true); getContentPane().add(preisJTextField); setVisible(false); } protected void runMessageDialog() { String [] errorString = { "***", "Neue Eingabe sind erst nach CLEAR m鰃lich !", "Typ hat 0 oder mehr als 20 Zeichen !", "Hersteller hat 0 oder mehr als 20 Zeichen !", "Farbe hat 0 oder mehr als 20 Zeichen !", "Kilometerleistung ist negativ oder hat mehr als 6 Stellen !", "Kilometerleistumg enth鋖t nichtnumerische Zeichen !", "Preis ist negativ oder hat mehr als 6 Stellen !", "Preis enth鋖t nichtnumerische Zeichen !" }; JOptionPane.showMessageDialog(this,errorString[errorcode]); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -