📄 sellticketjpanel.java
字号:
} }); noRadioButton.setFont(resourceMap.getFont("noRadioButton.font")); // NOI18N noRadioButton.setText(resourceMap.getString("noRadioButton.text")); // NOI18N noRadioButton.setName("noRadioButton"); // NOI18N noRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { noRadioButtonActionPerformed(evt); } }); sellButton.setAction(actionMap.get("sell")); // NOI18N sellButton.setFont(resourceMap.getFont("noRadioButton.font")); // NOI18N sellButton.setText(resourceMap.getString("sellButton.text")); // NOI18N sellButton.setName("sellButton"); // NOI18N resetButton.setAction(actionMap.get("reset")); // NOI18N resetButton.setFont(resourceMap.getFont("noRadioButton.font")); // NOI18N resetButton.setText(resourceMap.getString("resetButton.text")); // NOI18N resetButton.setName("resetButton"); // 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() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yesRadioButton) .addGap(55, 55, 55) .addComponent(noRadioButton)) .addGroup(layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 570, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(4, 4, 4) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(beginPointTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(35, 35, 35) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(endPointTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(38, 38, 38) .addComponent(selectButton)))) .addGroup(layout.createSequentialGroup() .addGap(178, 178, 178) .addComponent(sellButton) .addGap(82, 82, 82) .addComponent(resetButton))) .addContainerGap(47, Short.MAX_VALUE)) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {beginPointTextField, endPointTextField}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(75, 75, 75) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(endPointTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(beginPointTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addComponent(selectButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(yesRadioButton) .addComponent(noRadioButton)))) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(resetButton) .addComponent(sellButton)) .addContainerGap(23, Short.MAX_VALUE)) ); layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {beginPointTextField, endPointTextField, jLabel1, jLabel2, selectButton}); this.returnInitState(); }// </editor-fold>//GEN-END:initComponents private void yesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.yesRadioButton.setSelected(true); this.noRadioButton.setSelected(false); this.ti.is_insured = true; } private void noRadioButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.yesRadioButton.setSelected(false); this.noRadioButton.setSelected(true); this.ti.is_insured = false; } private void endPointTextFieldFocusGained(java.awt.event.FocusEvent evt) { // TODO add your handling code here: this.returnInitState(); } private void ticketInfoTableFocusGained(java.awt.event.FocusEvent evt) { // TODO add your handling code here: //默认买保险 this.yesRadioButton.setEnabled(true);this.yesRadioButton.setSelected(true); this.noRadioButton.setEnabled(true); this.sellButton.setEnabled(true); this.resetButton.setEnabled(true); int i = this.ticketInfoTable.getSelectedRow(); ti.setId(this.ticketInfoTable.getModel().getValueAt(i, 0).toString());//车票id先添加车辆id ti.setStart_point((this.ticketInfoTable.getModel().getValueAt(i, 3).toString())); ti.setEnd_point((this.ticketInfoTable.getModel().getValueAt(i, 4) .toString())); ti.setFare((Double.parseDouble(this.ticketInfoTable.getModel().getValueAt( i, 5).toString()))); } private void returnInitState() { this.yesRadioButton.setEnabled(false); this.noRadioButton.setEnabled(false); this.sellButton.setEnabled(false); this.resetButton.setEnabled(false); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField beginPointTextField; private javax.swing.JTextField endPointTextField; private javax.swing.ButtonGroup insuranceButtonGroup; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JRadioButton noRadioButton; private javax.swing.JButton resetButton; private javax.swing.JButton selectButton; private javax.swing.JButton sellButton; private javax.swing.JTable ticketInfoTable = new javax.swing.JTable(); private javax.swing.JRadioButton yesRadioButton; // End of variables declaration//GEN-END:variables TicketInfo ti = new TicketInfo(); Connection conn = Database.getConn(); Statement stmt = Database.createStmt(conn);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -