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

📄 playpanel.java

📁 java+eclipse做的TTPlayer
💻 JAVA
字号:
/* * PlayPanel.java * * Created on 2007年12月25日, 下午7:37 */package com.hadeslee.yoyoplayer.setting;import com.hadeslee.yoyoplayer.util.Config;import javax.swing.JOptionPane;/** * * @author  hadeslee */public class PlayPanel extends javax.swing.JPanel implements Initable {    /** Creates new form PlayPanel */    public PlayPanel() {        initComponents();        init();    }    /** 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.     */    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents    private void initComponents() {        jPanel1 = new javax.swing.JPanel();        isAutoStart = new javax.swing.JCheckBox();        goon = new javax.swing.JCheckBox();        jLabel1 = new javax.swing.JLabel();        interval = new javax.swing.JSpinner();        jLabel2 = new javax.swing.JLabel();        isStopWhenError = new javax.swing.JCheckBox();        jPanel2 = new javax.swing.JPanel();        jButton9 = new javax.swing.JButton();        jButton10 = new javax.swing.JButton();        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(Config.getResource("PlayPanel.playSetting"))); // NOI18N        isAutoStart.setText(Config.getResource("PlayPanel.autoStartWhenBoot")); // NOI18N        isAutoStart.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                isAutoStartActionPerformed(evt);            }        });        goon.setText(Config.getResource("PlayPanel.continueWithLastRate")); // NOI18N        jLabel1.setText(Config.getResource("PlayPanel.playInterval")); // NOI18N        interval.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));        jLabel2.setText(Config.getResource("PlayPanel.second")); // NOI18N        isStopWhenError.setText(Config.getResource("PlayPanel.stopWhenError")); // NOI18N        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);        jPanel1.setLayout(jPanel1Layout);        jPanel1Layout.setHorizontalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addComponent(isAutoStart)                    .addGroup(jPanel1Layout.createSequentialGroup()                        .addComponent(jLabel1)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(interval, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                        .addComponent(jLabel2)))                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addComponent(isStopWhenError)                    .addComponent(goon))                .addContainerGap())        );        jPanel1Layout.setVerticalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(isAutoStart)                    .addComponent(goon))                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(interval, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(jLabel2)                    .addComponent(isStopWhenError))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        jButton9.setText(Config.getResource("save")); // NOI18N        jButton9.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton9ActionPerformed(evt);            }        });        jPanel2.add(jButton9);        jButton10.setText(Config.getResource("reset")); // NOI18N        jButton10.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton10ActionPerformed(evt);            }        });        jPanel2.add(jButton10);        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()                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)                .addContainerGap())            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)        );        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addContainerGap()                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 157, Short.MAX_VALUE)                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                .addContainerGap())        );    }// </editor-fold>//GEN-END:initComponents    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed        // TODO add your handling code here:        doSave();    }//GEN-LAST:event_jButton9ActionPerformed    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed        // TODO add your handling code here:        init();    }//GEN-LAST:event_jButton10ActionPerformed    private void isAutoStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_isAutoStartActionPerformed        // TODO add your handling code here:        goon.setEnabled(isAutoStart.isSelected());    }//GEN-LAST:event_isAutoStartActionPerformed    private void doSave() {        Config config = Config.getConfig();        try {            int i = (Integer.parseInt(interval.getValue().toString()));            if (i < 0) {                JOptionPane.showMessageDialog(this, Config.getResource("PlayPanel.intervalCanotLess0"));                interval.requestFocus();                return;            }            config.setSequencePlayInterval(i);        } catch (NumberFormatException numberFormatException) {            JOptionPane.showMessageDialog(this, Config.getResource("PlayPanel.inputInvalidNumber"));            interval.requestFocus();            return;        }        config.setAutoPlayWhenStart(isAutoStart.isSelected());        config.setMaintainLastPlay(goon.isSelected());        config.setStopWhenError(isStopWhenError.isSelected());        if (config.isAutoCloseDialogWhenSave()) {            config.getOptionDialog().setVisible(false);        }    }    public void init() {        Config config = Config.getConfig();        isAutoStart.setSelected(config.isAutoPlayWhenStart());        goon.setSelected(config.isMaintainLastPlay());        goon.setEnabled(config.isAutoPlayWhenStart());        interval.setValue(config.getSequencePlayInterval());        isStopWhenError.setSelected(config.isStopWhenError());    }    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JCheckBox goon;    private javax.swing.JSpinner interval;    private javax.swing.JCheckBox isAutoStart;    private javax.swing.JCheckBox isStopWhenError;    private javax.swing.JButton jButton10;    private javax.swing.JButton jButton9;    private javax.swing.JLabel jLabel1;    private javax.swing.JLabel jLabel2;    private javax.swing.JPanel jPanel1;    private javax.swing.JPanel jPanel2;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

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