Ver Mensaje Individual
  #9 (permalink)  
Antiguo 27/10/2009, 06:57
giorgio_83
 
Fecha de Ingreso: febrero-2009
Mensajes: 29
Antigüedad: 15 años, 3 meses
Puntos: 1
Respuesta: clase java que herede de applet

buff, he tenido que cortar, porque la clase es muy extensa.

public static void main(String args[]) {
try{
new JCDWriter().show();
}
catch(Exception e) {
System.out.println("error: " + e.getMessage());
}
}

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.Action Event 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";

public void run() {
new JCDWriter().show();
throw new UnsupportedOperationException("Not supported yet.");
}
}