mFile.setMnemonic('f');
ImageIcon iconNew = new ImageIcon("file_new.gif");
Action actionNew = new AbstractAction("Nuevo", iconNew) {
public void actionPerformed(ActionEvent e) {
DefaultStyledDocument document = new DefaultStyledDocument(new StyleContext());
textPane.setDocument(document);
}
};
JMenuItem item = null;
// JMenuItem item = mFile.add(actionNew);
// item.setMnemonic('n');
ImageIcon iconOpen = new ImageIcon("file_open.gif");
Action actionOpen = new AbstractAction("Abrir...", iconOpen) {
public void actionPerformed(ActionEvent e) {
SVNVisorFicheroEdicion.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Thread runner = new Thread() {
public void run() {
if (fileChooser.showOpenDialog(SVNVisorFicheroEdicion.this) != JFileChooser.APPROVE_OPTION)
return;
SVNVisorFicheroEdicion.this.repaint();
File fChoosen = fileChooser.getSelectedFile();
// Recall that text component read/write operations are
// thread safe. Its ok to do this in a separate thread.
try {
InputStream in = new FileInputStream(fChoosen);
DefaultStyledDocument document = new DefaultStyledDocument(new StyleContext());
textPane.getEditorKit().read(in, document, 0);
textPane.setDocument(document);
in.close();
} catch (Exception ex) {
ex.printStackTrace();