Results 1 to 4 of 4
  1. #1
    DenniGa is offline Member
    Join Date
    Feb 2009
    Posts
    6
    Rep Power
    0

    Default [SOLVED] "start: applet not initialized"

    My applet is displaying the error: "start: applet not initialized", and I don't know why. I created the applet in Netbeans, and the classes the applet uses all work.

    The code is below:

    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    /*
     * GUI.java
     *
     * Created on Feb 14, 2009, 12:50:47 PM
     */
    
    /**
     *
     * @author Dennis
     */
    import javax.swing.*;
    public class GUI extends javax.swing.JApplet {
        private Desk desk;
        /** Initializes the applet GUI */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
                    public void run() {
                        initComponents();
                    }
                });
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            desk = new Desk();
            desk.setGUI(this);
        }
        
        
        public void display(String txt){
            jTextAreaCard.setText("");
            jTextAreaCard.setText(txt);
        }
    
    
        /** This method is called from within the init() method 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">//GEN-BEGIN:initComponents
        private void initComponents() {
    
            jPanel1 = new javax.swing.JPanel();
            jPanel2 = new javax.swing.JPanel();
            jButtonCorrect = new javax.swing.JButton();
            jButtonIncorrect = new javax.swing.JButton();
            jButtonFlip = new javax.swing.JButton();
            jButtonSelect = new javax.swing.JButton();
            jPanel3 = new javax.swing.JPanel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextAreaCard = new javax.swing.JTextArea();
    
            jPanel2.setLayout(new java.awt.GridLayout(2, 0));
    
            jButtonCorrect.setText("Correct");
            jButtonCorrect.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonCorrectActionPerformed(evt);
                }
            });
            jPanel2.add(jButtonCorrect);
    
            jButtonIncorrect.setText("Incorrect");
            jButtonIncorrect.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonIncorrectActionPerformed(evt);
                }
            });
            jPanel2.add(jButtonIncorrect);
    
            jButtonFlip.setText("Flip Stack");
            jPanel2.add(jButtonFlip);
    
            jButtonSelect.setText("Change Stack");
            jButtonSelect.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonSelectActionPerformed(evt);
                }
            });
            jPanel2.add(jButtonSelect);
    
            jPanel3.setLayout(new java.awt.BorderLayout());
    
            jTextAreaCard.setColumns(20);
            jTextAreaCard.setEditable(false);
            jTextAreaCard.setRows(5);
            jScrollPane1.setViewportView(jTextAreaCard);
    
            jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER);
    
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            );
    
            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(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
        }// </editor-fold>//GEN-END:initComponents
    
        private void jButtonCorrectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCorrectActionPerformed
            desk.placeCard(true);
        }//GEN-LAST:event_jButtonCorrectActionPerformed
    
        private void jButtonIncorrectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonIncorrectActionPerformed
            desk.placeCard(false);
        }//GEN-LAST:event_jButtonIncorrectActionPerformed
    
        private void jButtonSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSelectActionPerformed
            desk.changeStack(0);
        }//GEN-LAST:event_jButtonSelectActionPerformed
    
    
        // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JButton jButtonCorrect;
        private javax.swing.JButton jButtonFlip;
        private javax.swing.JButton jButtonIncorrect;
        private javax.swing.JButton jButtonSelect;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private javax.swing.JPanel jPanel3;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextAreaCard;
        // End of variables declaration//GEN-END:variables
    
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    What is the Desk class? I've not seen this before. Is it another class that you haven't posted or part of a library that you are using? I don't believe that it's part of the standard java API, at least not that I know of.

    ... and what line throws your error / exception?
    Last edited by Fubarable; 02-22-2009 at 05:56 PM.

  3. #3
    DenniGa is offline Member
    Join Date
    Feb 2009
    Posts
    6
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    What is the Desk class? I've not seen this before. Is it another class that you haven't posted or part of a library that you are using? I don't believe that it's part of the standard java API, at least not that I know of.

    ... and what line throws your error / exception?
    There is no specific line that throws an error. When I run the applet with appletviewer, it displays an error on the bottom: "start: applet not initialized".

    Also, the Desk class is a class I created that is in the same project/directory.

    PS: I found out that the Desk class is the reason why I'm receiving the error.

    The error is being created because Desk reads from a file, and I don't think applets are supposed to be able to.

    However, I'm reading from a file in the same directory, so this shouldn't be a problem, should it?
    Last edited by DenniGa; 02-22-2009 at 06:51 PM.

  4. #4
    JavaJenius is offline Member
    Join Date
    Mar 2008
    Posts
    4
    Rep Power
    0

    Default

    Yes it shouldn't be a problem if the file is in the applet directory, post the code that you are using to read the file.

Similar Threads

  1. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 03:03 AM
  2. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  3. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  4. <core:forEach var="" begin="+<%=j%>+">???
    By freddieMaize in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-27-2008, 01:20 AM
  5. "Jumble" or "Scramble" Program
    By Shadow22202 in forum Java Applets
    Replies: 8
    Last Post: 04-30-2008, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •