run:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - illegal start of expression
at test.note.mnuFileSaveActionPerformed(note.java:112)
at test.note.access$100(note.java:21)
at test.note$2.actionPerformed(note.java:64)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:374)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:829)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:873)
at java.awt.Component.processMouseEvent(Component.java:6175)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:5940)
at java.awt.Container.processEvent(Container.java:2105)
at java.awt.Component.dispatchEventImpl(Component.java:4536)
at java.awt.Container.dispatchEventImpl(Container.java:2163)
at java.awt.Component.dispatchEvent(Component.java:4362)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055)
at java.awt.Container.dispatchEventImpl(Container.java:2149)
at java.awt.window.dispatchEventImpl(window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4362)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
BUILD SUCCESSFUL (total time: 33 seconds)
// Also Find the program I have tried
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* note.java
*
* Created on Dec 15, 2010, 3:53:07 PM
*/
package test;
/**
*
* @author bibinbabu
*/
public class note extends javax.swing.JFrame {
/** Creates new form note */
public note() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
mnuTextField = new javax.swing.JTextField();
jMenuBar1 = new javax.swing.JMenuBar();
jFile = new javax.swing.JMenu();
mnuFileOpen = new javax.swing.JMenuItem();
mnuFileSave = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JPopupMenu.Separator();
mnuFileExit = new javax.swing.JMenuItem();
jEdit = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Note");
jFile.setText("File");
mnuFileOpen.setText("Open");
mnuFileOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuFileOpenActionPerformed(evt);
}
});
jFile.add(mnuFileOpen);
mnuFileSave.setText("Save");
mnuFileSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuFileSaveActionPerformed(evt);
}
});
jFile.add(mnuFileSave);
jFile.add(jSeparator1);
mnuFileExit.setText("Exit");
mnuFileExit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuFileExitActionPerformed(evt);
}
});
jFile.add(mnuFileExit);
jMenuBar1.add(jFile);
jEdit.setText("Edit");
jMenuBar1.add(jEdit);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(mnuTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(26, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(mnuTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(34, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void mnuFileExitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.dispose();
}
private void mnuFileSaveActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
public void Save()
{
if (canSave)
{
JFileChooser fileChooser = new JFileChooser();
if (fileChooser.showSaveDialog (this)== JFileChooser.APPROVE_OPTION )
{
ObjectOutputStream out;
try {
out = new ObjectOutputStream (fileChooser.getSelectedFile ());
out.WriteObject(this.note);
out.close ();
}
catch (IO Exception ex){}
JOptionPane.showMessageDialog(null, fileChooser.getSelectedFile(),"Message Saved",JOptionPane.INFORMATION_MESSAGE);
}
}canSave = false;
}
else
JOptionPane.showMessageDialog(null,"Cannot save message","save error",JOptionPane.ErrorMessage);
}
private void mnuFileOpenActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new note().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JMenu jEdit;
private javax.swing.JMenu jFile;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPopupMenu.Separator jSeparator1;
private javax.swing.JMenuItem mnuFileExit;
private javax.swing.JMenuItem mnuFileOpen;
private javax.swing.JMenuItem mnuFileSave;
private javax.swing.JTextField mnuTextField;
// End of variables declaration
}
This post has been edited by Dogstopper: 16 December 2010 - 07:26 AM

New Topic/Question
Reply




MultiQuote








|