package com.vci.client.framework.systemConfig.specialCharacter; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import com.vci.client.LogonApplication; import com.vci.client.framework.systemConfig.object.SpecialCharClsfObject; import com.vci.client.logon.base.BaseJDialog; import com.vci.client.ui.locale.LocaleDisplay; import com.vci.client.ui.swing.KJButton; import com.vci.client.ui.swing.KTextField; /** * *
Title:SpecialCharacterDialog
*Description: 特殊字符分类
*Copyright: Copyright (c) 2012
*Company: VCI
* @author sunbo * @time 2012-5-24 * @version 1.0 */ public class SpecialCharacterDialog extends BaseJDialog{ /** * */ private static final long serialVersionUID = 2175656472348441688L; private KJButton conformButton = new KJButton(LocaleDisplay.getI18nString("rmip.framework.button.confirm", "RMIPFramework", getLocale()), "bullet_blue.png"); private KJButton cancelButton = new KJButton(LocaleDisplay.getI18nString("rmip.framework.button.cancel", "RMIPFramework", getLocale()) , "bullet_delete.png"); private KTextField nameField = null; private JTextArea descriptionArea = null; private String nodeType; private SpecialCharacterPanel panel; private SpecialCharClsfObject obj; public SpecialCharacterDialog(SpecialCharacterPanel panel,String nodeType ,SpecialCharClsfObject obj){ super(LogonApplication.frame); this.setModal(true); this.nodeType = nodeType; this.panel = panel; this.obj = obj; init(); } public SpecialCharacterDialog(String nodeType ,SpecialCharClsfObject obj){ super(LogonApplication.frame); this.setModal(true); this.nodeType = nodeType; this.obj = obj; init(); } public void init(){ JLabel titleLabel = new JLabel(); titleLabel.setText("特殊字符分类"); JPanel bottomPanel = new JPanel(); bottomPanel.add(conformButton); bottomPanel.add(cancelButton); JPanel contentPanel = initCenterContentPanel(); JPanel midPanel = new JPanel(); midPanel.setLayout(new BorderLayout()); JTextField jTextField1 = new JTextField();//instead of up line JTextField jTextField2 = new JTextField();//instead of down line jTextField1.setPreferredSize(new Dimension(63,2)); jTextField2.setPreferredSize(new Dimension(63,2)); midPanel.add(jTextField1, BorderLayout.NORTH); midPanel.add(jTextField2, BorderLayout.SOUTH); midPanel.add(contentPanel, BorderLayout.CENTER); this.setLayout(new BorderLayout()); this.add(titleLabel, BorderLayout.NORTH); this.add(midPanel, BorderLayout.CENTER); this.add(bottomPanel, BorderLayout.SOUTH); // int x = (int)(this.getParent().getLocationOnScreen().getX()) +500; // int y = (int)(this.getParent().getLocationOnScreen().getY()) +200; // this.setLocation(x , y); // this.setSize(400, 300); initDialogSize(400, 300); this.setVisible(true); } private JPanel initCenterContentPanel() { JPanel contentPanel = new JPanel(); contentPanel.setLayout(null); JLabel nameLabel = new JLabel("名称:"); nameField = new KTextField(); nameLabel.setBounds(new Rectangle(60,20,100,20)); nameField.setBounds(new Rectangle(95,20,200,25)); JLabel descriptionLabel = new JLabel("描述:"); descriptionArea = new JTextArea(); descriptionLabel.setBounds(new Rectangle(60,50,100,20)); JScrollPane jsDescription=new JScrollPane(); jsDescription.setBounds(new Rectangle(95,50,200,100)); contentPanel.add(descriptionLabel); contentPanel.add(jsDescription); descriptionArea.setLineWrap(true); jsDescription.getViewport().add(descriptionArea); contentPanel.add(nameLabel); contentPanel.add(nameField); contentPanel.add(descriptionLabel); contentPanel.add(jsDescription); conformButton.addActionListener(new SpecialCharacterClsActionListener(this,nodeType,panel,obj)); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { cancelButton_ActionPerformed(e); } }); initContent(); return contentPanel; } private void initContent(){ if (obj != null){ nameField.setText(obj.getName()); descriptionArea.setText(obj.getDesc()); } } /** * 取消按钮事件 * @param e */ private void cancelButton_ActionPerformed(ActionEvent e) { this.dispose(); } public String getNameFieldText() { return nameField.getText().trim(); } public String getDescriptionArea() { return descriptionArea.getText().trim(); } }