⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faqedit.java

📁 MSN客服自动化机器人
💻 JAVA
字号:
package jm.form.msn.form;import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.io.File;import javax.imageio.ImageIO;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.JTextField;import javax.swing.WindowConstants;import jm.entity.CommandOftenKeys;import jm.entity.ESM000500;import jm.entity.SEQNo;import jm.form.msn.config.JMMRConfigConstants;import jm.form.msn.util.Manager;import jm.framework.util.DBOutValue;import jm.framework.util.SimpleEntityTable;import jm.util.JMCheck;/** * FAQ编辑 * 梦界家园MSNP15 * @author ISHome * @since 0.1 * @version 0.5.0.2.1 */public class FaqEdit extends javax.swing.JDialog implements JMMRConfigConstants{		private JButton save;	private JTextArea values;	private JScrollPane valueScrollPane;	private JPanel backPanel;	private JLabel titleLabel;	private JTextField title;	private JPanel titlePanel;	private JPanel valuePanel;	private JButton clear;	private JPanel commandPanel;	private JLabel valuesLabel;	private JPanel bottomPanel;	private JLabel tagLabel;	private JPanel tagPanel;	private JTextField tag;	private Manager manager = null;	public FaqEdit(JFrame form, Manager server) {		super(form, true);		manager = server;		initGUI();	}	public FaqEdit(JDialog form, Manager server) {		super(form, true);		manager = server;		initGUI();	}	private void initGUI() {		try {			BorderLayout thisLayout = new BorderLayout();			getContentPane().setLayout(thisLayout);			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);			{				backPanel = new JPanel();				BorderLayout backPanelLayout = new BorderLayout();				backPanel.setLayout(backPanelLayout);				getContentPane().add(backPanel, BorderLayout.CENTER);				{					commandPanel = new JPanel();					backPanel.add(commandPanel, BorderLayout.NORTH);					GridLayout jPanel4Layout = new GridLayout(1, 1);					jPanel4Layout.setColumns(1);					jPanel4Layout.setHgap(5);					jPanel4Layout.setVgap(5);					commandPanel.setLayout(jPanel4Layout);					commandPanel.setPreferredSize(new java.awt.Dimension(632, 30));					commandPanel.setBackground(new java.awt.Color(255, 255, 255));					{						clear = new JButton();						commandPanel.add(clear);						clear.setText(manager.getConfigMap().get(LANG_FAQEDIT_BUTTON_CLEAR_TEXT));						clear.setToolTipText(manager.getConfigMap().get(LANG_FAQEDIT_BUTTON_CLEAR_HELP));						clear.setFont(BUTTON_FOUNT);						clear.addActionListener(new ActionListener() {							public void actionPerformed(ActionEvent e) {								tag.setText(manager.getConfigMap().get(LANG_FAQEDIT_TEXT_TAG_VALUE));								values.setText(manager.getConfigMap().get(LANG_FAQEDIT_TEXT_VALUES_VALUE));							}						});					}					{						save = new JButton();						commandPanel.add(save);						save.setText(manager.getConfigMap().get(LANG_FAQEDIT_BUTTON_SAVE_TEXT));						save.setToolTipText(manager.getConfigMap().get(LANG_FAQEDIT_BUTTON_SAVE_HELP));						save.setFont(BUTTON_FOUNT);						save.addActionListener(new ActionListener() {							public void actionPerformed(ActionEvent e) {								ESM000500 faq = new ESM000500();								try {									if (JMCheck.isNull(numID))										faq.setNumID(SEQNo.getInstance().getNextSeqNo(CommandOftenKeys.SEQ_FAQ));									else										faq.setNumID(numID);									faq.setTitle(title.getText());									faq.setTag(tag.getText());									faq.setFaqValue(values.getText());									if (!JMCheck.isNull(numID)) {										updateFaq(faq);									} else if (JMCheck.isNull(title.getText()) && JMCheck.isNull(tag.getText()) && JMCheck.isNull(values.getText())) {										deleteFaq(faq);									} else {										addFaq(faq);									}									manager.showInfoMessageDialog(manager.getConfigMap().get(LANG_FAQEDIT_FORM_SUCCESS));								} catch (Exception ex) {									manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_FAQEDIT_FORM_FAILED));								}							}						});					}				}				{					titlePanel = new JPanel();					BorderLayout titlePanelLayout = new BorderLayout();					titlePanel.setLayout(titlePanelLayout);					backPanel.add(titlePanel, BorderLayout.CENTER);					titlePanel.setBackground(new java.awt.Color(255, 255, 255));					titlePanel.setPreferredSize(new java.awt.Dimension(632, 48));					{						titleLabel = new JLabel();						titlePanel.add(titleLabel, BorderLayout.NORTH);						titleLabel.setFont(LABEL_FOUNT);						titleLabel.setText(manager.getConfigMap().get(LANG_FAQEDIT_LABEL_TITLE_TEXT));						titleLabel.setForeground(new java.awt.Color(0, 0, 255));						titleLabel.setPreferredSize(new java.awt.Dimension(632, 30));					}					{						title = new JTextField();						titlePanel.add(title, BorderLayout.CENTER);						title.setText(manager.getConfigMap().get(LANG_FAQEDIT_TEXT_TITLE_VALUE));						title.setFont(LABEL_FOUNT);					}				}				{					bottomPanel = new JPanel();					backPanel.add(bottomPanel, BorderLayout.SOUTH);					BorderLayout jPanel3Layout = new BorderLayout();					bottomPanel.setLayout(jPanel3Layout);					bottomPanel.setPreferredSize(new java.awt.Dimension(632, 344));					bottomPanel.setBackground(new java.awt.Color(255,255,255));					{						tagPanel = new JPanel();						bottomPanel.add(tagPanel, BorderLayout.NORTH);						BorderLayout jPanel2Layout = new BorderLayout();						tagPanel.setLayout(jPanel2Layout);						tagPanel.setPreferredSize(new java.awt.Dimension(632, 70));						tagPanel.setBackground(new java.awt.Color(255, 255, 255));						{							tagLabel = new JLabel();							tagPanel.add(tagLabel, BorderLayout.NORTH);							tagLabel.setPreferredSize(new java.awt.Dimension(632, 30));							tagLabel.setForeground(new java.awt.Color(0, 0, 255));							tagLabel.setFont(LABEL_FOUNT);							tagLabel.setText(manager.getConfigMap().get(LANG_FAQEDIT_LABEL_TAG_TEXT));						}						{							tag = new JTextField();							tagPanel.add(tag, BorderLayout.CENTER);							tag.setText(manager.getConfigMap().get(LANG_FAQEDIT_TEXT_TAG_VALUE));							tag.setFont(LABEL_FOUNT);						}					}					{						valuePanel = new JPanel();						BorderLayout valuePanelLayout = new BorderLayout();						valuePanel.setLayout(valuePanelLayout);						bottomPanel.add(valuePanel, BorderLayout.CENTER);						valuePanel.setBackground(new java.awt.Color(255,255,255));						{							valuesLabel = new JLabel();							valuePanel.add(valuesLabel, BorderLayout.NORTH);							valuesLabel.setPreferredSize(new java.awt.Dimension(632, 30));							valuesLabel.setForeground(new java.awt.Color(0, 0, 255));							valuesLabel.setFont(LABEL_FOUNT);							valuesLabel.setText(manager.getConfigMap().get(LANG_FAQEDIT_LABEL_VALUES_TEXT));						}						{							valueScrollPane = new JScrollPane();							valuePanel.add(valueScrollPane, BorderLayout.CENTER);							{								values = new JTextArea();								valueScrollPane.setViewportView(values);								values.setText(manager.getConfigMap().get(LANG_FAQEDIT_TEXT_VALUES_VALUE));								values.setFont(LABEL_FOUNT);							}						}					}				}			}			{				this.setTitle(manager.getConfigMap().get(LANG_FAQEDIT_FORM_TITLE));				this.addWindowListener(new WindowAdapter() {					/**					 * 窗口正处在关闭过程中时调用。此时可重写关闭操作。					 * 					 * @param e					 */					public void windowClosing(WindowEvent e) {						dispose();// 关闭画面					}				});				//配置系统图标				this.setIconImage(ImageIO.read(new File(manager.getConfigMap().get(STYLES_MAIN_FORM_FAQ))));				this.pack();				this.setSize(640, 480);			}					} catch (Exception e) {			e.printStackTrace();		}	}		/**	 * 添加FAQ	 * 	 * @return	 */	public boolean addFaq(ESM000500 faq) {		try {			SimpleEntityTable _set = new SimpleEntityTable(faq, true);			DBOutValue _out = _set.insert();			return _out.getResult();		} catch (Exception e) {			e.printStackTrace();		}		return false;	}	/**	 * 添加FAQ	 * 	 * @return	 */	public boolean updateFaq(ESM000500 faq) {		try {			ESM000500 faqW = new ESM000500();			faqW.setNumID(faq.getNumID());			SimpleEntityTable _set = new SimpleEntityTable(faq, true);			DBOutValue _out = _set.update(faqW);			return _out.getResult();		} catch (Exception e) {			e.printStackTrace();		}		return false;	}	/**	 * 删除FAQ	 * 	 * @return	 */	public boolean deleteFaq(ESM000500 faq) {		try {			SimpleEntityTable _set = new SimpleEntityTable(faq, true);			DBOutValue _out = _set.delete();			return _out.getResult();		} catch (Exception e) {			e.printStackTrace();		}		return false;	}	private String numID = null;// 编号	/**	 * 画面启动	 * 	 * @param faq	 * @return 忽略返回值	 */	public boolean reLoad(ESM000500 faq) {		if (faq == null) {			title.setText("");			tag.setText("");			values.setText("");			return true;		}		numID = faq.getNumID();		title.setText(faq.getTitle());		tag.setText(faq.getTag());		values.setText(faq.getFaqValue());		return true;	}}

⌨️ 快捷键说明

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