📄 settingpanel.java
字号:
.addComponent(mixers, 0, 307, Short.MAX_VALUE))) .addComponent(miniHide, javax.swing.GroupLayout.Alignment.LEADING)) .addGap(76, 76, 76)) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(80, 80, 80)))) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(mixers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(autoClose) .addComponent(encoding, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(autoMini) .addComponent(showTrayIcon)) .addGap(2, 2, 2) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(showPlayTip) .addComponent(showTitle)) .addGap(5, 5, 5) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(autoShutDown) .addComponent(shutDownTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(miniHide) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents private void autoMiniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoMiniActionPerformed // TODO add your handling code here:}//GEN-LAST:event_autoMiniActionPerformed public void init() { Config config = Config.getConfig(); List list = config.getMixers(); if (list != null) { mixers.removeAllItems(); for (Object obj : list) { mixers.addItem(obj); } } if (config.getAudioDevice() != null) { mixers.setSelectedItem(config.getAudioDevice()); } if (config.getEncoding() != null) { encoding.setSelectedItem(config.getEncoding()); } autoClose.setSelected(config.isAutoCloseDialogWhenSave()); autoMini.setSelected(config.isStartAutoMinimize()); showTrayIcon.setSelected(config.isShowTrayIcon()); showPlayTip.setSelected(config.isShowPlayTip()); showTitle.setSelected(config.isShowTitleInTaskBar()); autoShutDown.setSelected(config.isAutoShutDown()); miniHide.setSelected(config.isMiniHide()); shutDownTime.setValue(config.getShutDownTime() != null ? config.getShutDownTime() : new Date()); shutDownTime.setEnabled(config.isAutoShutDown()); String strategy = config.getCheckUpdateStrategy(); if (strategy != null) { checkUpdate.setSelectedItem(Config.getResource(strategy)); } } private void autoShutDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoShutDownActionPerformed // TODO add your handling code here: shutDownTime.setEnabled(autoShutDown.isSelected()); }//GEN-LAST:event_autoShutDownActionPerformed 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 jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed // TODO add your handling code here: doSave(); }//GEN-LAST:event_jButton9ActionPerformed private void showTitleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showTitleActionPerformed // TODO add your handling code here: Config.getConfig().setShowTitleInTaskBar(showTitle.isSelected()); Config.getConfig().getPlayer().setShowTile(showTitle.isSelected()); }//GEN-LAST:event_showTitleActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: jButton1.setEnabled(false); new Thread() { public void run() { Version remote = Util.getRemoteVersion(); Util.checkUpdate(remote); jButton1.setEnabled(true); } }.start(); }//GEN-LAST:event_jButton1ActionPerformed private void doSave() { Config config = Config.getConfig(); boolean isAutoShutDown = autoShutDown.isSelected(); if (isAutoShutDown) { try { Date shutdownTime = (Date) shutDownTime.getValue(); config.setShutDownTime(shutdownTime); } catch (Exception exception) { JOptionPane.showMessageDialog(this, Config.getResource("SettingPanel.inputInvalidDateFormat")); return; } } String mix = mixers.getSelectedItem().toString(); String encode = encoding.getSelectedItem().toString(); boolean isStartAutoMini = autoMini.isSelected(); boolean isShowTrayIcon = showTrayIcon.isSelected(); boolean isShowPlayTip = showPlayTip.isSelected(); boolean isShowTitle = showTitle.isSelected(); String check = getCheckString(checkUpdate.getSelectedItem().toString()); config.setAudioDevice(mix); config.setEncoding(encode); config.setStartAutoMinimize(isStartAutoMini); config.setShowPlayTip(isShowPlayTip); config.setShowTrayIcon(isShowTrayIcon); config.setShowTitleInTaskBar(isShowTitle); config.setMiniHide(miniHide.isSelected()); config.setAutoShutDown(isAutoShutDown); config.setAutoCloseDialogWhenSave(autoClose.isSelected()); config.setCheckUpdateStrategy(check); if (config.isAutoCloseDialogWhenSave()) { config.getOptionDialog().setVisible(false); } } private String getCheckString(String s) { String[] ss = {Config.CHECK_DAY, Config.CHECK_MONTH, Config.CHECK_NONE, Config.CHECK_WEEK}; for (String temp : ss) { if (Config.getResource(temp).equals(s)) { return temp; } } return Config.CHECK_NONE; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox autoClose; private javax.swing.JCheckBox autoMini; private javax.swing.JCheckBox autoShutDown; private javax.swing.JComboBox checkUpdate; private javax.swing.JComboBox encoding; private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton2; private javax.swing.JButton jButton9; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JCheckBox miniHide; private javax.swing.JComboBox mixers; private javax.swing.JCheckBox showPlayTip; private javax.swing.JCheckBox showTitle; private javax.swing.JCheckBox showTrayIcon; private javax.swing.JSpinner shutDownTime; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -