Discussions
Categories
- 385.5K All Categories
- 5.1K Data
- 2.5K Big Data Appliance
- 2.5K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
NetBeans: Auto-generated classes failing to compile

Below is the code in question.Normally this code would work, because it used to work as it is until suddenly i got errors on all java.awt.event.ActionEvent variables. Basically the problem i have is not a bug or code error, because that code used to work as it is.i even tried uninstalling Netbeans and reinstalling, even installing later versions of the jdk but still seems like that ActionEvent class is missing somehow and thats the sole cause of the bugs because all of them point to an ActionEvent instance, for example mouseClicked.So i am now under the impression that maybe my jdk lost that class, or its disabled in Netbeans.Below is a copy of the full program and a screenshot of the error messages as they appear in Netbeans attached:
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author HUBBIE
*/
public class NewJFrame extends javax.swing.JFrame {
/**
* Creates new form NewJFrame
*/
PlayMovie m = null;
ArrayList Playlist = new ArrayList();
public NewJFrame() {
initComponents();
jFileChooser1.setVisible(false);
}
/**
* 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() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
jMenu1 = new javax.swing.JMenu();
jTabbedPane1 = new javax.swing.JTabbedPane();
jDialog1 = new javax.swing.JDialog();
jPopupMenu1 = new javax.swing.JPopupMenu();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jFileChooser1 = new javax.swing.JFileChooser();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
jButton5 = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu6 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
jRadioButtonMenuItem1.setSelected(true);
jRadioButtonMenuItem1.setText("jRadioButtonMenuItem1");
jMenu1.setText("jMenu1");
javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(102, 204, 255));
setForeground(new java.awt.Color(153, 153, 255));
jButton1.setText("play");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Book Antiqua", 1, 13)); // NOI18N
jTextArea1.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(51, 51, 255)));
jTextArea1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
jTextArea1PropertyChange(evt);
}
});
jScrollPane1.setViewportView(jTextArea1);
jFileChooser1.setBackground(new java.awt.Color(0, 102, 255));
jFileChooser1.setCurrentDirectory(new java.io.File("C:\\Users\\HUBBIE\\Desktop\\Music"));
jFileChooser1.setDialogTitle("Select Music files to play");
jFileChooser1.setFileHidingEnabled(false);
jFileChooser1.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(153, 51, 255)));
jFileChooser1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jFileChooser1ActionPerformed(evt);
}
});
jButton2.setText("Add Music");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Stop");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Pause");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dear.jpg"))); // NOI18N
jLabel1.setText("jLabel1");
jList1.setBackground(new java.awt.Color(153, 153, 153));
jList1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jList1MouseClicked(evt);
}
});
jScrollPane2.setViewportView(jList1);
jButton5.setFont(new java.awt.Font("Century Schoolbook", 1, 11)); // NOI18N
jButton5.setText("Recently Played:");
jButton5.setDoubleBuffered(true);
jMenuBar1.setBackground(new java.awt.Color(102, 102, 255));
jMenu2.setText("File");
jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenu2MouseClicked(evt);
}
});
jMenuItem1.setText("Open");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem1);
jMenuItem2.setText("Save");
jMenu2.add(jMenuItem2);
jMenuItem3.setText("Exit");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem3);
jMenuBar1.add(jMenu2);
jMenu3.setText("Edit");
jMenuBar1.add(jMenu3);
jMenu6.setText("View");
jMenuBar1.add(jMenu6);
jMenu4.setText("Tools");
jMenuBar1.add(jMenu4);
jMenu5.setText("Help");
jMenuItem4.setText("About Us");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
});
jMenu5.add(jMenuItem4);
jMenuBar1.add(jMenu5);
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2)
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton4)
.addComponent(jButton1)
.addComponent(jButton3)
.addComponent(jButton2)))
.addComponent(jButton5))
.addGap(0, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 477, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 449, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(52, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (jFileChooser1.isVisible())
{
jFileChooser1.setVisible(false);
jButton2.setText("Choose Music");
}
else
{
jButton2.setText("Choose Music");
jFileChooser1.setVisible(true);
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
File muzik = jFileChooser1.getSelectedFile();
String pth = muzik.getAbsolutePath();
m =new PlayMovie();
m.CreateGraph(pth);
Date d =new Date(muzik.lastModified());
jTextArea1.setText("Now Playing :"+muzik.getName()+" " +muzik.length()/1000000 +"mins"+"\n");
jTextArea1.append("File Details:"+"\n"+"Last Modified: "+d.toLocaleString()+"\n");
{
}
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
m.stop();// TODO add your handling code here:
}
private void jFileChooser1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
closeCurrentPlayer();
jTextArea1.setText(" NOW PLAYING :\n");
jTextArea1.setText(jFileChooser1.getSelectedFile().getName());
File muzik = jFileChooser1.getSelectedFile();
m =new PlayMovie();
PlayMovie mpf = new PlayMovie();
m.CreateGraph( muzik.getAbsolutePath());
Date d =new Date(muzik.lastModified());
jTextArea1.setText("Now Playing :"+muzik.getName()+" " +muzik.length()/1000000 +"mins"+"\n"+"Last Modified:"+d);
jFileChooser1.setVisible(false);
Playlist.add(muzik);
jList1.setListData(Playlist.toArray());
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
try {
// TODO add your handling code here:
m.wait();
} catch (InterruptedException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void jList1MouseClicked(java.awt.event.MouseEvent evt) {
try {
closeCurrentPlayer();
File muzik= new File(jList1.getSelectedValue().toString());
m = new PlayMovie();
m.CreateGraph(muzik.getAbsolutePath());
Date d =new Date(muzik.lastModified());
jTextArea1.setText("Now Playing :"+muzik.getName()+" " +muzik.length()/1000000 +"mins"+"\n"+"Last Modified:"+d);
}
catch (Exception e)
{
e.getMessage();
}
}
private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jFileChooser1.setVisible(true);
}
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTextArea1PropertyChange(java.beans.PropertyChangeEvent evt) {
// TODO add your handling code here:
}
private void closeCurrentPlayer() {
if (getPlayer()!= null) {
getPlayer().stop();
}
}
private PlayMovie getPlayer()
{
return m;
}
/**
*
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JDialog jDialog1;
private javax.swing.JFileChooser jFileChooser1;
private javax.swing.JLabel jLabel1;
private javax.swing.JList jList1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenu jMenu6;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
}
below is a screenshot of the code as it appears in my Netbeans:
Answers
-
so in my Netbeans all my java.awt.event.ActionEvent instances generate an error:
cannot find symbol
symbol:class ActionEvent
location: class eventfor example:
private void jButton2ActionPerfomed(java.awt.event.ActionEvent evt) {
.......
.......
....}