mehraan's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 14 (0.02 per day)
- Joined:
- 04-October 11
- Profile Views:
- 489
- Last Active:
Oct 23 2011 02:27 PM- Currently:
- Offline
Previous Fields
- Country:
- ZA
- OS Preference:
- Windows
- Favorite Browser:
- Safari
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Playstation
- Your Car:
- Toyota
- Dream Kudos:
- 0
Latest Visitors
-
smohd 
05 Oct 2011 - 04:14
Posts I've Made
-
In Topic: Close JFrame using a timer in NetBeans?
Posted 6 Oct 2011
ActionListener taskPerformer = new ActionListener() public ExitScreen() { initComponents(); Timer t = new Timer(1000, taskPerformer); t.start(); } public void actionPerformed(ActionEvent e) { this.dispose(); System.exit(0); }
when i do it that way, i get an error at ActionListener taskPerformer = new ActionListener()
i get the error
java.awt.event.ActionListener is abstract; cannot be instantiated
here is my complete code, if it helps
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; public class ExitScreen extends javax.swing.JFrame { ActionListener taskPerformer = new ActionListener(); public ExitScreen() { initComponents(); Timer t = new Timer(1000, taskPerformer); t.start(); } public void actionPerformed(ActionEvent e) { this.dispose(); System.exit(0); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("Thank you for using Soccer Log Assistor"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(79, 79, 79) .addComponent(jLabel1) .addContainerGap(83, Short.MAX_VALUE)) .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(4, 4, 4) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(258, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> public static void main(String args[]) { //<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(ExitScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ExitScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ExitScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ExitScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ExitScreen().setVisible(true); } }); } -
In Topic: Close JFrame using a timer in NetBeans?
Posted 6 Oct 2011
this is what i got and it doesn't work
ActionListener taskPerformer = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); } }; public ExitScreen() { initComponents(); Timer t = new Timer(1000, taskPerformer); t.start(); } public void actionPerformed(ActionEvent e) { this.dispose(); System.exit(0); } -
In Topic: Error in Limit sql function
Posted 6 Oct 2011
It worked perfectly!! thanks!
-
In Topic: "Too few parameters. Expected 1." Help?
Posted 5 Oct 2011
thanks for the help. It was actually a stupid mistake from my side.
'team' was supposed to be 'teams'
thanks again! -
In Topic: how do i use an SQL to create a new table in my database?
Posted 5 Oct 2011
alright this is my working code
String newTourney = JOptionPane.showInputDialog("Enter tournament name"); try{ ResultSet rs = soccer.queryTbl("CREATE TABLE "+newTourney+"(Team char(20))"); rs.close(); } catch(SQLException e) { System.out.println(e.getMessage()); }
how can i edit that code to output a message using JOptionPane.showMessageDialog if the new tournament entered already exists
My Information
- Member Title:
- New D.I.C Head
- Age:
- 18 years old
- Birthday:
- June 5, 1994
- Gender:
-
- Location:
- South Africa
- Programming Languages:
- Java
Contact Information
- E-mail:
- Private
- Twitter:
- mehraankhan
Friends
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
mehraan has no profile comments yet. Why not say hello?