timeraboutbox.java#1.2

来自「数据库远程同步软件NetBeans项目源文件 项目采用Jdesktop集成组件」· 2 代码 · 共 361 行 · 第 1/2 页

2
361
字号
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)                        .addGroup(layout.createSequentialGroup()                            .addComponent(modelRadio2)                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                            .addComponent(dateField2, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)                            .addGap(36, 36, 36)                            .addComponent(btnDate2))                        .addGroup(layout.createSequentialGroup()                            .addComponent(jButton1)                            .addGap(14, 14, 14)                            .addComponent(okButton)                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)                            .addComponent(exitButton)))))        );        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                .addContainerGap()                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(startCheckBox))                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(modelRadio1)                    .addComponent(dateField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(btnDate1))                .addGap(18, 18, 18)                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                .addGap(18, 18, 18)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(modelRadio2)                    .addComponent(dateField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(btnDate2))                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)                    .addComponent(exitButton)                    .addComponent(jButton1)                    .addComponent(okButton))                .addContainerGap())        );        pack();    }// </editor-fold>//GEN-END:initComponents    private void startCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startCheckBoxActionPerformed        // TODO add your handling code here:        if (startCheckBox.isSelected()) {        }}//GEN-LAST:event_startCheckBoxActionPerformed    private void modelRadio1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modelRadio1ActionPerformed        // TODO add your handling code here:}//GEN-LAST:event_modelRadio1ActionPerformed    private void btnDate1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnDate1MouseClicked        // TODO add your handling code here:        dateChooser.showChooser(btnDate1, evt.getX() - DateChooser.width, evt.getY());        if (dateChooser.getDate() != null) {            dateField1.setText(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss.SSS").format(dateChooser.getDate()));        }        dateChooser.hideChooser();}//GEN-LAST:event_btnDate1MouseClicked    private void btnDate1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDate1ActionPerformed        // TODO add your handling code here:    }//GEN-LAST:event_btnDate1ActionPerformed    private void modelRadio2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modelRadio2ActionPerformed        // TODO add your handling code here:}//GEN-LAST:event_modelRadio2ActionPerformed    private void btnDate2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnDate2MouseClicked        // TODO add your handling code here:               dateChooser.showChooser(btnDate2, evt.getX() - DateChooser.width, evt.getY() - 10);        if (dateChooser.getDate() != null) {            dateField2.setText(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss.SSS").format(dateChooser.getDate()));        }        dateChooser.hideChooser();}//GEN-LAST:event_btnDate2MouseClicked    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked        // TODO add your handling code here:}//GEN-LAST:event_jButton1MouseClicked    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed        // TODO add your handling code here:        closeAboutBox();        previous.setVisible(Boolean.TRUE);    }//GEN-LAST:event_jButton1ActionPerformed    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed        // TODO add your handling code here:        if (checkSubmit()) {            if (modelGroup.isSelected(modelRadio1.getModel())) {                date = CalendarUtil.getNowdate(dateField1.getText());                model = 0;            } else {                date = CalendarUtil.getNowdate(dateField1.getText());                model = 1;            }            setVisible(false);            previous.setVisible(true);        }    }//GEN-LAST:event_okButtonActionPerformed    private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed        // TODO add your handling code here:        setVisible(false);    }//GEN-LAST:event_exitButtonActionPerformed    private void startCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_startCheckBoxStateChanged        // TODO add your handling code here:        enable = !enable;    }//GEN-LAST:event_startCheckBoxStateChanged    private ChoosePropertiesAboutBox previous;    public int getModel() {        return model;    }    public boolean isEnable() {        return enable;    }    public Date getDate() {        return date;    }    private boolean checkSubmit() {        if (!(modelGroup.isSelected(modelRadio1.getModel()) || modelGroup.isSelected(modelRadio2.getModel()))) {            JOptionPane.showMessageDialog(null, "运行模式必须选择", "Warning", JOptionPane.ERROR_MESSAGE);            return false;        }        if (modelGroup.isSelected(modelRadio1.getModel()) && "".equals(getDate1())) {            JOptionPane.showMessageDialog(null, "时间未选择", "Warning", JOptionPane.ERROR_MESSAGE);            dateField1.setFocusable(true);            return false;        }        if (modelGroup.isSelected(modelRadio2.getModel()) && "".equals(getDate2())) {            JOptionPane.showMessageDialog(null, "时间未选择", "Warning", JOptionPane.ERROR_MESSAGE);             dateField2.setFocusable(true);            return false;        }        return true;    }    private int model;    private Date date;    private boolean enable;    private DateChooser dateChooser;    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JButton btnDate1;    private javax.swing.JButton btnDate2;    private javax.swing.JTextField dateField1;    private javax.swing.JTextField dateField2;    private javax.swing.JButton exitButton;    private javax.swing.JButton jButton1;    private javax.swing.JLabel jLabel1;    private javax.swing.JSeparator jSeparator1;    private javax.swing.JSeparator jSeparator2;    private javax.swing.ButtonGroup modelGroup;    private javax.swing.JRadioButton modelRadio1;    private javax.swing.JRadioButton modelRadio2;    private javax.swing.JButton okButton;    private javax.swing.JCheckBox startCheckBox;    // End of variables declaration//GEN-END:variables    public String getDate2() {        return dateField2.getText();    }    // End of variables declaration    public String getDate1() {        return dateField1.getText();    }}

⌨️ 快捷键说明

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