View Single Post
  #1 (permalink)  
Old 10-02-2007, 09:26 PM
Victor Victor is offline
Learning Programmer
 
Join Date: May 2007
Posts: 96
Credits: 0
Rep Power: 6
Victor is on a distinguished road
Default Compilation Error

Sidewinder | Please use [php], [code] and [highlight="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: The Forum Rules.


Alright, I'm very puzzled. I get an error on compile and I can't fix it. Any ideas?
Java Code:
  1. /*
  2. * GUI.java
  3. *
  4. * Created on September 29, 2007, 9:37 PM
  5. */
  6.  
  7. package nasg;
  8. import java.io.*;
  9. import java.lang.reflect.Method;
  10. import java.util.Arrays;
  11. import javax.swing.JOptionPane;
  12. import java.util.HashMap;
  13. import java.util.Map;
  14.  
  15.  
  16. /**
  17. *
  18. * @author  Victor
  19. */
  20. public class GUI{
  21.    
  22.     /** Creates new form GUI */
  23.     public GUI() {
  24.         initComponents();
  25.     }
  26.    
  27.     /** This method is called from within the constructor to
  28.      * initialize the form.
  29.      * WARNING: Do NOT modify this code. The content of this method is
  30.      * always regenerated by the Form Editor.
  31.      */
  32.     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
  33.     private void initComponents() {
  34.         jComboBox1 = new javax.swing.JComboBox();
  35.         jScrollPane1 = new javax.swing.JScrollPane();
  36.         jTextArea1 = new javax.swing.JTextArea();
  37.         jLabel1 = new javax.swing.JLabel();
  38.         jButton1 = new javax.swing.JButton();
  39.  
  40.         setTitle("Neo's Admin Script Generator 0.5");
  41.         setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  42.         setLocationByPlatform(true);
  43.         setResizable(false);
  44.         addKeyListener(new java.awt.event.KeyAdapter() {
  45.             public void keyPressed(java.awt.event.KeyEvent evt) {
  46.                 formKeyPressed(evt);
  47.             }
  48.         });
  49.  
  50.         getAccessibleContext().setAccessibleName("nasg");
  51.         jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "r", "m", "m4m", "m4a1auto", "ma", "ar", "g", "at4", "s", "s82", "s24", "spr", "m9", "b", "sf", "ak", "ak74su", "gp", "rpg", "rpk", "svd", "mos", "v", "d", "pso", "bdm" }));
  52.         jComboBox1.addActionListener(new java.awt.event.ActionListener() {
  53.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  54.                 jComboBox1ActionPerformed(evt);
  55.             }
  56.         });
  57.  
  58.         jTextArea1.setColumns(20);
  59.         jTextArea1.setLineWrap(true);
  60.         jTextArea1.setRows(5);
  61.         jTextArea1.setText("Enter Admin Message");
  62.         jTextArea1.setToolTipText("You can enter your administrator's message here");
  63.         jTextArea1.setWrapStyleWord(true);
  64.         jScrollPane1.setViewportView(jTextArea1);
  65.  
  66.         jLabel1.setText("Weapon Class");
  67.  
  68.         jButton1.setText("Compile!");
  69.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  70.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  71.                 jButton1ActionPerformed(evt);
  72.             }
  73.         });
  74.  
  75.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  76.         getContentPane().setLayout(layout);
  77.         layout.setHorizontalGroup(
  78.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  79.             .addGroup(layout.createSequentialGroup()
  80.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  81.                     .addGroup(layout.createSequentialGroup()
  82.                         .addGap(73, 73, 73)
  83.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  84.                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  85.                                 .addComponent(jLabel1)
  86.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  87.                                 .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  88.                             .addComponent(jButton1)))
  89.                     .addGroup(layout.createSequentialGroup()
  90.                         .addContainerGap(34, Short.MAX_VALUE)
  91.                         .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)))
  92.                 .addContainerGap())
  93.         );
  94.         layout.setVerticalGroup(
  95.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  96.             .addGroup(layout.createSequentialGroup()
  97.                 .addGap(23, 23, 23)
  98.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  99.                     .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  100.                     .addComponent(jLabel1))
  101.                 .addGap(23, 23, 23)
  102.                 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  103.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
  104.                 .addComponent(jButton1)
  105.                 .addContainerGap())
  106.         );
  107.         pack();
  108.     }// </editor-fold>                       
  109.    
  110.     private void formKeyPressed(java.awt.event.KeyEvent evt) {                               
  111. // TODO add your handling code here:
  112.     }                               
  113.    
  114.     private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
  115.         jComboBox1.addActionListener(new java.awt.event.ActionListener() {
  116.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  117.                 JComboBox jcmbType = (JComboBox)e.getSource();
  118.                 String cmbType = (String)jcmbType.getSelectedItem();
  119.                 jComboBox1ActionPerformed(evt);
  120.     }                                         
  121.            
  122.     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
  123.         FileOutputStream fout;
  124.        
  125.         try {
  126.             fout = new FileOutputStream("nasg.txt");
  127.             for(int number = 1; number <= 50; number++) {
  128.                 new PrintStream(fout).println("admin forceclass " + cmdType);
  129.             }
  130.             new PrintStream(fout).println("admin message ");
  131.             new PrintStream(fout).println("admin say ");
  132.             fout.close();
  133.         } catch (IOException e) {
  134.             System.err.println("Unable to write to file");
  135.             System.exit(-1);
  136.         }
  137.        
  138.     }                                       
  139.    
  140.     /**
  141.      * @param args the command line arguments
  142.      */
  143.     public static void main(String args[]) {
  144.         java.awt.EventQueue.invokeLater(new Runnable() {
  145.             public void run() {
  146.                 new GUI().setVisible(true);
  147.             }
  148.         });
  149.     }
  150.     // Variables declaration - do not modify                     
  151.     private javax.swing.JButton jButton1;
  152.     private javax.swing.JComboBox jComboBox1;
  153.     private javax.swing.JLabel jLabel1;
  154.     private javax.swing.JScrollPane jScrollPane1;
  155.     private javax.swing.JTextArea jTextArea1;
  156.     // End of variables declaration
  157.  
And my error:
Quote:
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Victor\My Documents\Java\NASG\build\classes
C:\Documents and Settings\Victor\My Documents\Java\NASG\src\nasg\GUI.java:155: reached end of file while parsing
private javax.swing.JTextArea jTextArea1;
1 error
BUILD FAILED (total time: 1 second)
Sidewinder | Please use [php], [code] and [highlight="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: The Forum Rules.
__________________
Pegasus Homepage

Last edited by John; 10-03-2007 at 12:08 AM.
Reply With Quote

Sponsored Links