📄 talkedit.java.svn-base
字号:
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.ESM000200;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;/** * 编辑对话信息条目 * 梦界家园MSNP15 * @author ISHome * @since 0.5.0.1 * @version 0.5.0.2.1 */public class TalkEdit extends javax.swing.JDialog implements JMMRConfigConstants{ private JButton save; private JTextArea values; private JScrollPane valueScrollPane; private JPanel backPanel; private JButton clear; private JPanel commandPanel; private JLabel valuesLabel; private JPanel valuePanel; private JLabel tagLabel; private JPanel tagPanel; private JTextField tag; private Manager manager = null; public TalkEdit(JFrame form, Manager server) { super(form, true); manager = server; initGUI(); } public TalkEdit(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_TALKEDIT_BUTTON_CLEAR_TEXT)); clear.setToolTipText(manager.getConfigMap().get(LANG_TALKEDIT_BUTTON_CLEAR_HELP)); clear.setFont(BUTTON_FOUNT); clear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tag.setText(manager.getConfigMap().get(LANG_TALKEDIT_TEXT_TAG_VALUE)); values.setText(manager.getConfigMap().get(LANG_TALKEDIT_TEXT_VALUES_VALUE)); } }); } { save = new JButton(); commandPanel.add(save); save.setText(manager.getConfigMap().get(LANG_TALKEDIT_BUTTON_SAVE_TEXT)); save.setToolTipText(manager.getConfigMap().get(LANG_TALKEDIT_BUTTON_SAVE_HELP)); save.setFont(BUTTON_FOUNT); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ESM000200 faq = new ESM000200(); try { if (JMCheck.isNull(numID)) faq.setNumID(SEQNo.getInstance().getNextSeqNo(CommandOftenKeys.SEQ_TALK)); else faq.setNumID(numID); faq.setTag(tag.getText()); faq.setTalkValue(values.getText()); if (!JMCheck.isNull(numID)) { updateTalk(faq); } else if (JMCheck.isNull(tag.getText()) && JMCheck.isNull(values.getText())) { deleteTalk(faq); } else { addTalk(faq); } manager.showInfoMessageDialog(manager.getConfigMap().get(LANG_TALKEDIT_FORM_SUCCESS)); } catch (Exception ex) { manager.showErrorMessageDialog(manager.getConfigMap().get(LANG_TALKEDIT_FORM_FAILED)); } } }); } } { tagPanel = new JPanel(); backPanel.add(tagPanel, BorderLayout.CENTER); 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_TALKEDIT_LABEL_TAG_TEXT)); } { tag = new JTextField(); tagPanel.add(tag, BorderLayout.CENTER); tag.setText(manager.getConfigMap().get(LANG_TALKEDIT_TEXT_TAG_VALUE)); tag.setFont(LABEL_FOUNT); } } { valuePanel = new JPanel(); backPanel.add(valuePanel, BorderLayout.SOUTH); BorderLayout jPanel3Layout = new BorderLayout(); valuePanel.setLayout(jPanel3Layout); valuePanel.setPreferredSize(new java.awt.Dimension(632, 344)); 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_TALKEDIT_LABEL_VALUES_TEXT)); } { valueScrollPane = new JScrollPane(); valuePanel.add(valueScrollPane, BorderLayout.CENTER); { values = new JTextArea(); valueScrollPane.setViewportView(values); values.setText(manager.getConfigMap().get(LANG_TALKEDIT_TEXT_VALUES_VALUE)); values.setFont(LABEL_FOUNT); } } } } { this.setTitle(manager.getConfigMap().get(LANG_TALKEDIT_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_TALK)))); this.pack(); this.setSize(640, 480); } catch (Exception e) { e.printStackTrace(); } } /** * 添加TALK * * @return */ public boolean addTalk(ESM000200 talk) { try { SimpleEntityTable _set = new SimpleEntityTable(talk, true); DBOutValue _out = _set.insert(); return _out.getResult(); } catch (Exception e) { e.printStackTrace(); } return false; } /** * 添加TALK * * @return */ public boolean updateTalk(ESM000200 talk) { try { ESM000200 talkW = new ESM000200(); talkW.setNumID(talk.getNumID()); SimpleEntityTable _set = new SimpleEntityTable(talk, true); DBOutValue _out = _set.update(talkW); return _out.getResult(); } catch (Exception e) { e.printStackTrace(); } return false; } /** * 删除TALK * * @return */ public boolean deleteTalk(ESM000200 talk) { try { SimpleEntityTable _set = new SimpleEntityTable(talk, true); DBOutValue _out = _set.delete(); return _out.getResult(); } catch (Exception e) { e.printStackTrace(); } return false; } private String numID = null;// 编号 /** * 画面启动 * * @param talk * @return 忽略返回值 */ public boolean reLoad(ESM000200 talk) { if (talk == null) { tag.setText(""); values.setText(""); return true; } numID = talk.getNumID(); tag.setText(talk.getTag()); values.setText(talk.getTalkValue()); return true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -