📄 preferencesview.java
字号:
gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 30; gridBagConstraints.ipadx = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; generalPanel.add(diskLayoutFileLocationLabel, gridBagConstraints); mainTabbedPane.addTab("General", generalPanel); getContentPane().add(mainTabbedPane, java.awt.BorderLayout.CENTER); okButton.setText("OK"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); buttonPanel.add(okButton); applyButton.setText("Apply"); applyButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { applyButtonActionPerformed(evt); } }); buttonPanel.add(applyButton); cancelButton.setText("Cancel"); cancelButton.setDefaultCapable(false); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); buttonPanel.add(cancelButton); getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH); pack(); } private void findDiskLayoutFileLocationButtonActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(applicationSettings.diskLayoutFileDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fileChooser.showDialog(this, "Select Directory"); if(returnVal == JFileChooser.APPROVE_OPTION) { diskLayoutFileLocationTextField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } private void findCDLocationButtonActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(applicationSettings.isoDiskImageDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fileChooser.showDialog(this, "Select Directory"); if(returnVal == JFileChooser.APPROVE_OPTION) { cdImageLocationTextField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } private void findCDRECORDLocationButtonActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Locate cdrecord"); int returnVal = fileChooser.showDialog(this, "Select"); if(returnVal == JFileChooser.APPROVE_OPTION) { cdrecordLocationTextField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } private void findMKISOFSLocationButtonActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Locate mkisofs"); int returnVal = fileChooser.showDialog(this, "Select"); if(returnVal == JFileChooser.APPROVE_OPTION) { mkisofsLocationTextField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } private void mkisofsLocationTextFieldActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: } private void recordingDeviceComboBoxActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: } private void scanForRecordingDevicesButtonPressed(java.awt.event.ActionEvent evt) { try { CDRECORDOutputAnalyzer oAnalyzer; Enumeration devicesColl; oAnalyzer = new CDRECORDOutputAnalyzer(); oAnalyzer.setExtractDevices(true);// executeCommandLine(cdrecord.scanbusCommandString(), oAnalyzer, true, true, true); executeCommandLine(cdrecord.scanbusCommandArray(), oAnalyzer, true, true, true); devicesColl = oAnalyzer.recordingDevices().elements(); ((DefaultComboBoxModel)(recordingDeviceComboBox.getModel())).removeAllElements(); while(devicesColl.hasMoreElements()) { ((DefaultComboBoxModel)(recordingDeviceComboBox.getModel())).addElement(devicesColl.nextElement()); } scannedDevices = oAnalyzer.recordingDevices(); } catch (IOException ie) { System.out.println(ie); } } private void okButtonActionPerformed(java.awt.event.ActionEvent evt) { /* Save changes made for cdrecord and mkisofs settings */ applyChanges(); dispose(); } private void applyButtonActionPerformed(java.awt.event.ActionEvent evt) { applyChanges(); } private void applyChanges() { udpateMKISOFS(); udpateCDRECORD(); updateApplicationSettings(); } private void udpateMKISOFS() { mkisofs.setRockRidge(rockRidgeCheckBox.isSelected()); mkisofs.setAnanymouseRockRidge(ananRockRidgeCheckBox.isSelected()); mkisofs.setJoliet(jolietCheckBox.isSelected()); mkisofs.setAllow32CharFileNames(allow32CharFileNamesCheckBox.isSelected()); mkisofs.setFollowSymLinks(followSymLinkCheckBox.isSelected()); mkisofs.setGenerateTransTBLFiles(generateTRANSTBLCheckBox.isSelected()); mkisofs.setOmitTrailingPeriods(omitTrailingPeriodsCheckBox.isSelected()); mkisofs.setNoDeepDirRelocation(noDeepDirRelocCheckBox.isSelected()); mkisofs.setFilesCanBeginWithPeriod(filesCanBeginWithPeriodCheckBox.isSelected()); mkisofs.setExcludeBackupFiles(excludeBackupFilesCheckBox.isSelected()); mkisofs.mkisofsExecutable(mkisofsLocationTextField.getText()); } private void udpateCDRECORD() { if (scannedDevices != null && scannedDevices.size() > 0){ cdrecord.recordingDevices(scannedDevices); } cdrecord.defaultRecordingDevice((SCSIDevice)(recordingDeviceComboBox.getModel().getSelectedItem())); cdrecord.setOverburn(allowOverburnCheckBox.isSelected()); cdrecord.setEject(ejectAfterWriteCheckBox.isSelected()); cdrecord.setSpeed((Integer.valueOf(speedTextField.getText())).intValue()); cdrecord.setForce(forceWritingCheckBox.isSelected()); cdrecord.setDAO(diskAtOnceCheckBox.isSelected()); cdrecord.setDummy(dummyWriteCheckBox.isSelected()); cdrecord.cdrecordExecutable(cdrecordLocationTextField.getText()); } private void updateApplicationSettings() { applicationSettings.isoDiskImageDirectory(cdImageLocationTextField.getText()); applicationSettings.diskLayoutFileDirectory(diskLayoutFileLocationTextField.getText()); } private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) { dispose(); } private void ananRockRidgeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: } /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) { setVisible(false); dispose(); } private void executeCommandLine(String cmd, OutputAnalyzer oAnalyzer, boolean autoStart, boolean autoClose, boolean waitForCompletion) throws IOException { Process p = Runtime.getRuntime().exec(cmd); Semaphore sem = new Semaphore(); ProcessMonitor pMonitor = new ProcessMonitor(p, oAnalyzer, sem); pMonitor.setShowUI(false); pMonitor.autoStart(autoStart); pMonitor.autoClose(autoClose); pMonitor.run(); sem.waitForSignal(); } private void executeCommandLine(String[] cmd, OutputAnalyzer oAnalyzer, boolean autoStart, boolean autoClose, boolean waitForCompletion) throws IOException { Process p = Runtime.getRuntime().exec(cmd); Semaphore sem = new Semaphore(); ProcessMonitor pMonitor = new ProcessMonitor(p, oAnalyzer, sem); pMonitor.setShowUI(false); pMonitor.autoStart(autoStart); pMonitor.autoClose(autoClose); pMonitor.run(); sem.waitForSignal(); } private javax.swing.JCheckBox jolietCheckBox; private javax.swing.JLabel speedLabel; private javax.swing.JTextField cdrecordLocationTextField; private javax.swing.JCheckBox followSymLinkCheckBox; private javax.swing.JButton findMKISOFSLocationButton; private javax.swing.JCheckBox forceWritingCheckBox; private javax.swing.JCheckBox dummyWriteCheckBox; private javax.swing.JButton findDiskLayoutFileLocationButton; private javax.swing.JCheckBox filesCanBeginWithPeriodCheckBox; private javax.swing.JTextField speedTextField; private javax.swing.JCheckBox excludeBackupFilesCheckBox; private javax.swing.JPanel mkisofsPanel; private javax.swing.JCheckBox noDeepDirRelocCheckBox; private javax.swing.JCheckBox ejectAfterWriteCheckBox; private javax.swing.JButton findCDLocationButton; private javax.swing.JCheckBox ananRockRidgeCheckBox; private javax.swing.JButton okButton; private javax.swing.JComboBox recordingDeviceComboBox; private javax.swing.JLabel mkisofsLocationLabel; private javax.swing.JPanel generalPanel; private javax.swing.JLabel cdrecordLocationLabel; private javax.swing.JCheckBox allowOverburnCheckBox; private javax.swing.JTextField mkisofsLocationTextField; private javax.swing.JTextField diskLayoutFileLocationTextField; private javax.swing.JCheckBox generateTRANSTBLCheckBox; private javax.swing.JButton cancelButton; private javax.swing.JButton applyButton; private javax.swing.JTextField cdImageLocationTextField; private javax.swing.JButton findCDRECORDLocationButton; private javax.swing.JButton scanForRecordingDevicesButton; private javax.swing.JCheckBox rockRidgeCheckBox; private javax.swing.JTabbedPane mainTabbedPane; private javax.swing.JPanel buttonPanel; private javax.swing.JCheckBox allow32CharFileNamesCheckBox; private javax.swing.JLabel cdImageLocationLabel; private javax.swing.JLabel dummyPaddingLabel; private javax.swing.JCheckBox diskAtOnceCheckBox; private javax.swing.JLabel recordingDeviceLabel; private javax.swing.JLabel diskLayoutFileLocationLabel; private javax.swing.JCheckBox omitTrailingPeriodsCheckBox; private javax.swing.JPanel cdrecordPanel; MKISOFSCommand mkisofs; CDRECORDConfiguration cdrecord; ApplicationSettings applicationSettings; private Vector scannedDevices;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -