opening RTF and TXT files
From: yorkmac (yorkmac_at_hotmail.com)
Date: 03/30/05
- Previous message: Celia: "Recommend a good web GUI layout and design book?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Mar 2005 19:14:06 -0500
i am making a wordprocessor that can open .RTF files. is their any way i
can make it open .txt files also this is the code for opening RTF files
Action actionOpen = new AbstractAction("Open",iconOpen){
public void actionPerformed (ActionEvent e)
{
WordPad.this.setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Thread runner = new Thread()
{
public void run()
{
if (myChooser.showOpenDialog(WordPad.this)!=
JFileChooser.APPROVE_OPTION)
return;
WordPad.this.repaint();
File fileChoosen = myChooser.getSelectedFile();
try{
InputStream in = new FileInputStream (fileChoosen);
myDoc = new DefaultStyledDocument(myStyleContext);
myKit.read(in,myDoc,0);
myOutput.setDocument(myDoc);
in.close();
}
catch (Exception ex){
ex.printStackTrace();
}
WordPad.this.setCursor(Cursor.getPredefinedCursor
(Cursor.DEFAULT_CURSOR ) );
}
};
runner.start();
myDoc.addUndoableEditListener(new Undoer());
}
};
- Previous message: Celia: "Recommend a good web GUI layout and design book?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]