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

📄 promulgatenewsjpanel.java

📁 客运售票管理信息系统
💻 JAVA
字号:
/* * PromulgateNewsJPanel.java * * Created on 2009年1月11日, 下午1:00 */package passengertransportmis;import java.sql.Connection;import java.sql.Statement;import org.jdesktop.application.Action;/** * * @author  Degree41 */public class PromulgateNewsJPanel extends javax.swing.JPanel {    public javax.swing.JComboBox getNewsTypeComboBox() {		return newsTypeComboBox;	}	/** Creates new form PromulgateNewsJPanel */    public PromulgateNewsJPanel() {        initComponents();    }        @Action    public void confirm() {    	if(this.jTextArea1.getText().isEmpty()){    		javax.swing.JOptionPane.showMessageDialog(this,					"以上文本区均不得为空,请保持正确的数据输入!", "警告", 2/* warning */);			return;    	}else{    		this.log.setContent(this.jTextArea1.getText());    	}    			String sql = new String("insert into log values ("				+ "now(),'" + this.log.getType() + "','" + this.log.getContent()				+ "')");		int i = Database.executeUpdate(stmt, sql);		if (i == 1) {			javax.swing.JOptionPane.showMessageDialog(this, "发布公告成功!", "提示",					1/* infomation */);			this.returnInitState();		} else			javax.swing.JOptionPane.showMessageDialog(this,					"发布公告,请确保输入信息正确!", "错误", 0/* erroe */);	    	    	          }         private void returnInitState() {		// TODO Auto-generated method stub    	this.jTextArea1.setText("");		this.newsTypeComboBox.setSelectedIndex(0);		this.log.setType("日常");			}	@Action    public void cancel() {       this.log = new Log();       this.returnInitState();    }    /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    @SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">                              private void initComponents() {        newsTypeComboBox = new javax.swing.JComboBox();        jScrollPane1 = new javax.swing.JScrollPane();        jTextArea1 = new javax.swing.JTextArea();        jLabel1 = new javax.swing.JLabel();        confirmButton = new javax.swing.JButton();        cancelButton = new javax.swing.JButton();        setName("Form"); // NOI18N        newsTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Dialy", "Insurance" }));        newsTypeComboBox.setName("newsTypeComboBox"); // NOI18N        newsTypeComboBox.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {            	newsTypeComboBoxActionPerformed(evt);            }        });        jScrollPane1.setName("jScrollPane1"); // NOI18N        jTextArea1.setColumns(20);        jTextArea1.setRows(5);        jTextArea1.setName("jTextArea1"); // NOI18N        jScrollPane1.setViewportView(jTextArea1);        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(passengertransportmis.PassengerTransportMISApp.class).getContext().getResourceMap(PromulgateNewsJPanel.class);        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N        jLabel1.setName("jLabel1"); // NOI18N               javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(passengertransportmis.PassengerTransportMISApp.class).getContext().getActionMap(PromulgateNewsJPanel.class, this);        confirmButton.setAction(actionMap.get("confirm")); // NOI18N        confirmButton.setFont(resourceMap.getFont("confirmButton.font")); // NOI18N        confirmButton.setText(resourceMap.getString("confirmButton.text")); // NOI18N        confirmButton.setName("confirmButton"); // NOI18N        cancelButton.setAction(actionMap.get("cancel")); // NOI18N        cancelButton.setFont(resourceMap.getFont("cancelButton.font")); // NOI18N        cancelButton.setText(resourceMap.getString("cancelButton.text")); // NOI18N        cancelButton.setName("cancelButton"); // NOI18N        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);        this.setLayout(layout);        layout.setHorizontalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addContainerGap()                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 231, Short.MAX_VALUE)                        .addComponent(confirmButton)                        .addGap(34, 34, 34)                        .addComponent(cancelButton))                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)                    .addComponent(newsTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))                .addContainerGap())        );        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, confirmButton});        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addContainerGap()                .addComponent(newsTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)                .addGap(18, 18, 18)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(confirmButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(cancelButton))                .addContainerGap(12, Short.MAX_VALUE))        );        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {cancelButton, confirmButton});        this.returnInitState();            }// </editor-fold>              private void newsTypeComboBoxActionPerformed(java.awt.event.ActionEvent evt) {		// TODO add your handling code here:		//添加退钱比率    	switch(this.newsTypeComboBox.getSelectedIndex()){	    	case 0:	    		this.log.setType("日常");	    			    		break;	    	case 1:	    		this.log.setType("保险");	    		break;    	}    	}        private javax.swing.JButton cancelButton;    private javax.swing.JButton confirmButton;    private javax.swing.JLabel jLabel1;    private javax.swing.JScrollPane jScrollPane1;    private javax.swing.JTextArea jTextArea1;    private javax.swing.JComboBox newsTypeComboBox;    // End of variables declaration                   	    Log log = new Log();    Connection conn = Database.getConn();	Statement stmt = Database.createStmt(conn);}

⌨️ 快捷键说明

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