📄 jcdwriter.java
字号:
} } } } private void scanbusTestActionPerformed(java.awt.event.ActionEvent evt) { Process p; ProcessMonitor pMon; try { Semaphore s = new Semaphore(); p = Runtime.getRuntime().exec("cdrecord --scanbus"); pMon = new ProcessMonitor(p, new CDRECORDOutputAnalyzer(), s); pMon.show(); s.waitForSignal(); cdrecord.recordingDevices(((CDRECORDOutputAnalyzer)pMon.outputAnalyzer).recordingDevices()); } catch (IOException ie){ } } private void preferencesMenuItemActionPerformed(java.awt.event.ActionEvent evt) { (new PreferencesView(this, false, mkisofs, cdrecord, applicationSettings)).show(); } private void initializeDragAndDropMechanism(){ //dragSource = new DragSource(); } private void printVirtualFileSystemTree1ActionPerformed(java.awt.event.ActionEvent evt) { virtualFileSystemPanel.printTree(); } private void printGraftPoints1ActionPerformed(java.awt.event.ActionEvent evt) { virtualFileSystemPanel.printGraftPoints(); } private void formWindowOpened(java.awt.event.WindowEvent evt) { addFileSystemViews(); } private void deleteMenuItemActionPerformed(java.awt.event.ActionEvent evt){ virtualFileSystemPanel.eraseSelectedNode(); } private void insertFolderActionPerformed(java.awt.event.ActionEvent evt){ virtualFileSystemPanel.insertNewNode(); } private void addFileSystemViews(){ hostFileSystemPanel = new HostFileSystemView(); hostToVirtualSplitPane.setTopComponent(hostFileSystemPanel); virtualFileSystemPanel = new VirtualFileSystemView(); hostToVirtualSplitPane.setBottomComponent(virtualFileSystemPanel); virtualFileSystemPanel.setStatusBar(statusBar); } private void exitApplication() { saveCDRECORDConfig(); saveMKISOFSConfig(); saveApplicationSettings(); System.exit(0); }//:event_exitActionPerformed private void exitActionPerformed(java.awt.event.ActionEvent evt) { exitApplication(); } private void exitForm(java.awt.event.WindowEvent evt) { exitApplication(); } /** * @param args the command line arguments */ public static void main(String args[]) { try{ new JCDWriter().show(); } catch(Exception e) { System.out.println("gotcha"); } } private void saveCDRECORDConfig() { createConfigDir(); String configFileName = applicationSettings.getConfigDirectory() + "/" + applicationSettings.cdrecordConfigFileName; File f = new File(configFileName); cdrecord.saveToFile(f); } private void saveMKISOFSConfig() { createConfigDir(); File f = new File(applicationSettings.getConfigDirectory() + "/" + applicationSettings.mkisofsConfigFileName); mkisofs.saveToFile(f); } private void saveApplicationSettings() { /* Application settings are saved on users home directory inside .jcdwriter */ File settingsDir = new File(System.getProperty("user.home") + "/.jcdwriter/"); String settingsFileName = settingsDir.getAbsolutePath() + "/jcdwriter.conf"; if (!settingsDir.exists()) { JOptionPane.showMessageDialog(null, "Creating " + settingsFileName, "Creating jcdwriter.conf", JOptionPane.INFORMATION_MESSAGE); settingsDir.mkdir(); }; File settingsFile = new File(settingsFileName); applicationSettings.saveToFile(settingsFile); } private void initializeMKISOFS() { File f = new File(applicationSettings.getConfigDirectory() + "/" + applicationSettings.mkisofsConfigFileName); if(mkisofs == null) mkisofs = new MKISOFSCommand(); if(f.exists()) { mkisofs.readFromFile(f); } } private void initializeCDRECORDConfig() { if(cdrecord == null) cdrecord = new CDRECORDConfiguration(); File f = new File(applicationSettings.getConfigDirectory() + "/" + applicationSettings.cdrecordConfigFileName); if(f.exists()) { cdrecord.readFromFile(f); } } private void intializeStatusBar(){ virtualFileSystemPanel.setStatusBar(statusBar); } private void initializeApplicationSettings() { File f = new File(applicationSettings.getConfigDirectory() + "/" + applicationSettings.appSettingsConfigFileName); if(f.exists()) { applicationSettings.readFromFile(f); } /* Initialize in case config file is missing */ if(applicationSettings == null) applicationSettings = new ApplicationSettings(); } public void createConfigDir() { File dir = new File(applicationSettings.getConfigDirectory()); if(!dir.exists()) { JOptionPane.showMessageDialog(null, "Creating config directory: " + dir.getPath(), "Information", JOptionPane.INFORMATION_MESSAGE); System.out.println("Creating config directory: " + dir.getPath()); dir.mkdirs(); } } private void saveDiskLayout() { if(currentFile == null) { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setFileHidingEnabled(true); fc.setDialogType(JFileChooser.SAVE_DIALOG); fc.setMultiSelectionEnabled(false); fc.showSaveDialog(this); currentFile = fc.getSelectedFile(); } if (currentFile != null) { try { FileOutputStream ostream = new FileOutputStream(currentFile); ObjectOutputStream p = new ObjectOutputStream(ostream); p.writeObject(virtualFileSystemPanel.getModel()); p.flush(); ostream.close(); } catch(java.io.FileNotFoundException fnfe) { System.out.println(fnfe); } catch(java.io.IOException ie) { System.out.println(ie); } } } private void readDiskLayout() { if (currentFile != null) { try { FileInputStream ostream = new FileInputStream(currentFile); ObjectInputStream p = new ObjectInputStream(ostream); virtualFileSystemPanel.setModel((DefaultTreeModel)p.readObject()); ostream.close(); } catch(ClassNotFoundException cnfe) { System.out.println(cnfe); } catch(java.io.FileNotFoundException fnfe) { System.out.println(fnfe); } catch(java.io.IOException ie) { System.out.println(ie); } } } private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt){ JOptionPane.showMessageDialog(null, " Written by: Ram Mallappa", "jCDWriter " + versionID, JOptionPane.PLAIN_MESSAGE); } private javax.swing.JLabel topComponentPlaceHolder; private javax.swing.JMenuItem saveLayout; private javax.swing.JMenuItem saveLaoutAs; private javax.swing.JSeparator jSeparator2; private javax.swing.JMenuItem printVirtualFileSystemTree1; private javax.swing.JMenu fileMenu; private javax.swing.JMenu diskMenu; private javax.swing.JMenuItem recordFromISOImage; private javax.swing.JMenuItem recordDirectly; private javax.swing.JMenuBar mainMenuBar; private javax.swing.JMenuItem blankCD; private javax.swing.JMenuItem createCDImage; private javax.swing.JMenuItem scanbusTest; private javax.swing.JPanel mainPanel; private javax.swing.JLabel statusBar; private javax.swing.JMenu printMenu; private javax.swing.JLabel bottomComponentPlaceHolder; private javax.swing.JMenuItem exit; private javax.swing.JMenu editMenu; private javax.swing.JMenu helpMenu; private javax.swing.JMenuItem printGraftPoints1; private javax.swing.JSeparator jSeparator1; private javax.swing.JMenuItem loadLayout; private javax.swing.JSplitPane hostToVirtualSplitPane; private javax.swing.JMenuItem calculateFileSystemSize; private javax.swing.JMenuItem newLayout; private javax.swing.JMenuItem preferencesMenuItem; private javax.swing.JMenuItem deleteMenuItem; private javax.swing.JMenuItem insertMenuItem; private javax.swing.JMenuItem aboutMenuItem; private javax.swing.JPanel statusBarPanel; private javax.swing.JPanel hostFileSystemPanel; private VirtualFileSystemView virtualFileSystemPanel; private javax.swing.JToolBar mainToolBar; private javax.swing.JButton newLayoutButton; private javax.swing.JButton openLayoutButton; private javax.swing.JButton eraseDiskButton; private javax.swing.JButton writeDiskImageButton; private javax.swing.JButton writeDiskFromImageButton; private javax.swing.JButton writeDiskButton; private javax.swing.JButton editPreferencesButton; CDRECORDConfiguration cdrecord = new CDRECORDConfiguration() ; MKISOFSCommand mkisofs = new MKISOFSCommand() ; ApplicationSettings applicationSettings = new ApplicationSettings() ; String isoFileName; File currentFile; private static String versionID = "0.8.3";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -