com.darwinsys.util.FileIO.stringToFile(log, "linkchecker.log");
String fileName = "linkchecker.log"; com.darwinsys.util.FileIO.stringToFile(log, fileName); JOptionPane.showMessageDialog(LinkChecker.this, "File saved as " + fileName, "Done", JOptionPane.INFORMATION_MESSAGE);
	public LinkChecker() {		super("LinkChecker");		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);		Container cp = getContentPane();		cp.setLayout(new BorderLayout());		JPanel p = new JPanel();		p.setLayout(new FlowLayout());		p.add(new JLabel("URL"));		p.add(textFldURL = new JTextField(30));		p.add(checkButton = new JButton("Check URL"));		// Make a single action listener for both the text field (when		// you hit return) and the explicit "Check URL" button.		ActionListener starter = new ActionListener() {			public void actionPerformed(ActionEvent e) {				done = false;				checkButton.setEnabled(false);				killButton.setEnabled(true);				Thread t = new Thread() {					public void run() {						textWindow.setText("Checking...");						checkOut(textFldURL.getText());						textWindow.append("-- All done --");					}				};				t.start();			}		};		textFldURL.addActionListener(starter);		checkButton.addActionListener(starter);		p.add(killButton = new JButton("Stop"));		killButton.setEnabled(false);	// until startChecking is called.		killButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent e) {				done = true;				checkButton.setEnabled(true);				killButton.setEnabled(false);			}		});		p.add(saveButton = new JButton("Save Log"));		saveButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {			try {				String log = textWindow.getText();				com.darwinsys.util.FileIO.stringToFile(log, "linkchecker.log");			} catch (IOException ex) {				JOptionPane.showMessageDialog(LinkChecker.this,					"IOError",					ex.toString(),					JOptionPane.ERROR_MESSAGE);				}			}		});		// Now lay out the main GUI - URL & buttons on top, text larger		cp.add("North", p);		textWindow = new JTextArea(80, 40);		cp.add("Center", new JScrollPane(textWindow));		com.darwinsys.util.UtilGUI.maximize(this);	}