📄 searchlyricpanel.java
字号:
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(autoOverWrite) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE) .addComponent(saveAsTheFileName)) .addGroup(layout.createSequentialGroup() .addComponent(selectBest) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE) .addComponent(relativeWithFile))) .addGap(18, 18, 18)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveLyricDir, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton5) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(autoSearch) .addComponent(searchWhenFull)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(selectBest) .addComponent(relativeWithFile)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(autoOverWrite) .addComponent(saveAsTheFileName)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(saveLyricDir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, 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 jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: JFileChooser jfc = Util.getFileChooser(new FileNameFilter("*", Config.getResource("SearchLyricPanel.folder")), JFileChooser.DIRECTORIES_ONLY); if (jfc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File dir = jfc.getSelectedFile(); if (!files.contains(dir)) { files.add(dir); list.setListData(files); } } }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: File value = (File) list.getSelectedValue(); if (value != null) { files.remove(value); list.setListData(files); } }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: File obj = (File) list.getSelectedValue(); if (obj != null) { int index = files.indexOf(obj); if (index > 0) { files.remove(obj); files.add(index - 1, obj); } list.setListData(files); list.setSelectedValue(obj, true); } }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: File obj = (File) list.getSelectedValue(); if (obj != null) { int index = files.indexOf(obj); if (index < files.size() - 1) { files.remove(obj); files.add(index + 1, obj); } list.setListData(files); list.setSelectedValue(obj, true); } }//GEN-LAST:event_jButton4ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: if(Config.getConfig().isLinux()){ int i=JOptionPane.showConfirmDialog(this, Config.getResource("SearchLyricPanel.warning1") + Config.getResource("SearchLyricPanel.warning2"),Config.getResource("SearchLyricPanel.confirm"),JOptionPane.YES_NO_OPTION); if(i!=JOptionPane.YES_OPTION){ return ; } } JFileChooser jfc = Util.getFileChooser(new FileNameFilter("*", Config.getResource("SearchLyricPanel.folder")), JFileChooser.DIRECTORIES_ONLY); if (jfc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { lyricDir = jfc.getSelectedFile(); saveLyricDir.setText(lyricDir.getPath()); } }//GEN-LAST:event_jButton5ActionPerformed 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 doSave() { Config config = Config.getConfig(); config.setSearchLyricDirs(files); config.setAutoSearchLyricOnline(autoSearch.isSelected()); config.setSearchWhenInfoFull(searchWhenFull.isSelected()); config.setSelectBestLyric(selectBest.isSelected()); config.setAutoRelatingWithMediaFile(relativeWithFile.isSelected()); config.setAutoOverWriteExistFile(autoOverWrite.isSelected()); config.setSaveTheSameNameAsMediaFile(saveAsTheFileName.isSelected()); config.setSaveLyricDir(lyricDir); //自动把这个目录加到搜索目录去 if(!files.contains(lyricDir)){ files.add(lyricDir); } if (config.isAutoCloseDialogWhenSave()) { config.getOptionDialog().setVisible(false); } } public void init() { Config config = Config.getConfig(); files = new Vector<File>(); files.addAll(config.getSearchLyricDirs()); list.setListData(files); autoSearch.setSelected(config.isAutoSearchLyricOnline()); searchWhenFull.setSelected(config.isSearchWhenInfoFull()); selectBest.setSelected(config.isSelectBestLyric()); relativeWithFile.setSelected(config.isAutoRelatingWithMediaFile()); autoOverWrite.setSelected(config.isAutoOverWriteExistFile()); saveAsTheFileName.setSelected(config.isSaveTheSameNameAsMediaFile()); lyricDir = config.getSaveLyricDir(); if (lyricDir != null) { saveLyricDir.setText(lyricDir.getPath()); } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox autoOverWrite; private javax.swing.JCheckBox autoSearch; private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton9; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JList list; private javax.swing.JCheckBox relativeWithFile; private javax.swing.JCheckBox saveAsTheFileName; private javax.swing.JTextField saveLyricDir; private javax.swing.JCheckBox searchWhenFull; private javax.swing.JCheckBox selectBest; // End of variables declaration//GEN-END:variables}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -