project = curProject;  JPanel mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(3,1));   wizardPanels[0] = createFilePanel("Class jars and directories to analyze:", analyzeList, analyzeModel, JFileChooser.FILES_AND_DIRECTORIES, directoryOrJar);  wizardPanels[1] = createFilePanel("Auxiliary class locations:", auxList, auxModel, JFileChooser.FILES_AND_DIRECTORIES, directoryOrJar);  wizardPanels[2] = createFilePanel("Source directories:", sourceList, sourceModel, JFileChooser.FILES_AND_DIRECTORIES, null);  JPanel buttons = new JPanel(); buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS)); buttons.add(Box.createHorizontalStrut(5)); buttons.add(finishButton); buttons.add(Box.createHorizontalStrut(5)); buttons.add(cancelButton); finishButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { for (int i = 0; i < analyzeModel.getSize(); i++){ File temp = new File((String)analyzeModel.get(i)); if(!(temp.exists() && (temp.isDirectory() || temp.getName().endsWith(".jar") || temp.getName().endsWith(".zip")))){ JOptionPane.showMessageDialog(NewProjectWizard.this, temp.getName()+" is invalid.", "Error", JOptionPane.ERROR_MESSAGE); return; } }   for (int i = 0; i < auxModel.getSize(); i++){ File temp = new File((String)auxModel.get(i)); if(!(temp.exists() && (temp.isDirectory() || temp.getName().endsWith(".jar") || temp.getName().endsWith(".zip")))){ JOptionPane.showMessageDialog(NewProjectWizard.this, temp.getName()+" is invalid.", "Error", JOptionPane.ERROR_MESSAGE); return; } }  Project p = (project == null ? new Project() : project); for (int i = 0; i < analyzeModel.getSize(); i++) p.addFile((String) auxModel.get(i)); for (int i = 0; i < auxModel.getSize(); i++) p.addAuxClasspathEntry((String) auxModel.get(i)); for (int i = 0; i < sourceModel.getSize(); i++) p.addSourceDir((String) sourceModel.get(i));  if (project == null || (projectChanged && JOptionPane.showConfirmDialog(NewProjectWizard.this, "Project settings have been changed.  Perform a new analysis with the changed files?", "Redo analysis?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)) new AnalyzingDialog(p);  dispose(); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { dispose(); } });  JPanel south = new JPanel(new BorderLayout()); south.add(new JSeparator(), BorderLayout.NORTH); south.add(buttons, BorderLayout.EAST);   if (curProject != null) { for (String i : curProject.getFileList()) analyzeModel.addElement(i); for (String i : curProject.getAuxClasspathEntryList()) auxModel.addElement(i); for (String i : curProject.getSourceDirList()) sourceModel.addElement(i); }   loadAllPanels(mainPanel); add(mainPanel, BorderLayout.CENTER); add(south, BorderLayout.SOUTH);  setDefaultCloseOperation(DISPOSE_ON_CLOSE);   setTitle("New Project"); setModal(true); setVisible(true);
this(null);
	public NewProjectWizard(Project curProject)	{		project = curProject;				JPanel mainPanel = new JPanel();		mainPanel.setLayout(new GridLayout(3,1));						wizardPanels[0] = createFilePanel("Class jars and directories to analyze:", 				analyzeList, analyzeModel, JFileChooser.FILES_AND_DIRECTORIES, directoryOrJar);				wizardPanels[1] = createFilePanel("Auxiliary class locations:", 				auxList, auxModel, JFileChooser.FILES_AND_DIRECTORIES, directoryOrJar);				wizardPanels[2] = createFilePanel("Source directories:", sourceList, sourceModel, JFileChooser.FILES_AND_DIRECTORIES, null);						JPanel buttons = new JPanel();		buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));		buttons.add(Box.createHorizontalStrut(5));		buttons.add(finishButton);		buttons.add(Box.createHorizontalStrut(5));		buttons.add(cancelButton);		finishButton.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt)			{					for (int i = 0; i < analyzeModel.getSize(); i++){					File temp = new File((String)analyzeModel.get(i));					if(!(temp.exists() && (temp.isDirectory() || 							temp.getName().endsWith(".jar") || temp.getName().endsWith(".zip")))){						JOptionPane.showMessageDialog(NewProjectWizard.this, 								temp.getName()+" is invalid.", "Error", JOptionPane.ERROR_MESSAGE);						return;					}				}											for (int i = 0; i < auxModel.getSize(); i++){					File temp = new File((String)auxModel.get(i));					if(!(temp.exists() && (temp.isDirectory() || 							temp.getName().endsWith(".jar") || temp.getName().endsWith(".zip")))){						JOptionPane.showMessageDialog(NewProjectWizard.this, 								temp.getName()+" is invalid.", "Error", JOptionPane.ERROR_MESSAGE);						return;					}				}								Project p = (project == null ? new Project() : project);				for (int i = 0; i < analyzeModel.getSize(); i++)					p.addFile((String) auxModel.get(i));				for (int i = 0; i < auxModel.getSize(); i++)					p.addAuxClasspathEntry((String) auxModel.get(i));				for (int i = 0; i < sourceModel.getSize(); i++)					p.addSourceDir((String) sourceModel.get(i));								if (project == null || (projectChanged && JOptionPane.showConfirmDialog(NewProjectWizard.this, "Project settings have been changed.  Perform a new analysis with the changed files?", "Redo analysis?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION))					new AnalyzingDialog(p);								dispose();			}		});		cancelButton.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt)			{				dispose();			}		});				JPanel south = new JPanel(new BorderLayout());		south.add(new JSeparator(), BorderLayout.NORTH);		south.add(buttons, BorderLayout.EAST);						if (curProject != null)		{			for (String i : curProject.getFileList()) 				analyzeModel.addElement(i);			for (String i : curProject.getAuxClasspathEntryList())				auxModel.addElement(i);			for (String i : curProject.getSourceDirList())				sourceModel.addElement(i);		}				//loadPanel(0);		loadAllPanels(mainPanel);		add(mainPanel, BorderLayout.CENTER);		add(south, BorderLayout.SOUTH);				setDefaultCloseOperation(DISPOSE_ON_CLOSE);		//		pack();		setTitle("New Project");		setModal(true);		setVisible(true);	}