Menu

Calls to setEnabled are ignored

Help
2006-02-23
2013-04-16
  • Wyatt Tellis

    Wyatt Tellis - 2006-02-23

    Hi,

    I'm having problems disabling buttons when an applet is first started under JEP . All calls to setEnabled(false) seem to be ignored (the component remains enabled even though I've tried to disable it). I've also found that the applet will sometime fail to start (all I see is the Java logo). I've attached code that demonstrates the problem (it was created using NetBeans 5.0):

    public class ImageDownloadApplet extends javax.swing.JApplet
    {
       
        /** Initializes the applet ImageDownloadApplet */
        public void init()
        {
            try
            {
                java.awt.EventQueue.invokeAndWait(new Runnable()
                {
                    public void run()
                    {
                        initComponents();
                    }
                });
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
        }
       
        public void start()
        {
            try
            {
                java.awt.EventQueue.invokeAndWait(new Runnable()
                {
                    public void run()
                    {
                        testButton.setEnabled(false);
                    }
                });
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
        }
        /** 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.
         */
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents()
        {
            testButton = new javax.swing.JButton();

            getContentPane().setLayout(new java.awt.FlowLayout());

            testButton.setText("jButton1");
            getContentPane().add(testButton);

        }// </editor-fold>
       
       
        // Variables declaration - do not modify
        private javax.swing.JButton testButton;
        // End of variables declaration
       
    }

    I'm using OSX 10.3.9, Firefox 1.5.0.1, JEP 0.9.5, Java 1.4.2_09. Works fine in Safari 1.3. There are no errors in the Java console. Any ideas about what's wrong?

    -Wyatt

     
    • Wyatt Tellis

      Wyatt Tellis - 2006-02-24

      It looks like I'm not the only one experiencing this:

      http://forum.java.sun.com/thread.jspa?threadID=700870&tstart=90

      Any ideas on how to fix or workaround?

      Thanks,

      Wyatt

       
    • Steven Michaud

      Steven Michaud - 2006-02-24

      I can reproduce one of the problems you report (jButton1 not getting disabled)
      but not the other (sometimes seeing the Java logo instead of the applet).

      Indeed, I've _never_ experienced the second problem at all, though I've seen
      one other report of it.  Until I get better information, I have no idea what
      might be happening.  So let's end discussion of this second problem and stick
      with the first one (the 'not disabled' problem).  (If you're able to find a
      way to consistently reproduce the "Java logo" problem, please open a second
      bug report on it.)

      I have a suspicion what may be causing the 'not disabled' problem -- it may be
      an overly aggressive fix (for a different problem) that I put into the Java
      Embedding Plugin a long time ago.

      I'll add more comments as I find out more.

       
    • Wyatt Tellis

      Wyatt Tellis - 2006-02-27

      Steven,

      I'm really glad to hear the setEnabled bug is reproducible (that's half the battle of fixing a bug). Do you have any info about the Java logo problem? Since it's random, I need more info to see if I can create a reproducible case.

      -Wyatt

       
    • Steven Michaud

      Steven Michaud - 2006-02-27

      As I've already said, I don't.

      If you're able to find a way to consistently reproduce the "Java logo"
      problem, please open a second bug report on it.

       
    • Wyatt Tellis

      Wyatt Tellis - 2006-02-27

      But you said you've "seen one other report of it." Where is this other report?

       
    • Steven Michaud

      Steven Michaud - 2006-02-27

      I looked around for it a bit ... but couldn't find it.  I now think I may have
      mixed it up with a different one -- one that was equally uninformative.

      As you yourself have realized, bug reports that say "something bad happened
      but I can't reproduce it, or give any other information" are basically
      worthless.  Trying to track a bug down with that little information is a waste
      of time.  In fact, it's quite likely that whatever happened was a
      self-inflicted wound.

      The only reasonable thing to do is wait for a more informative report, or (if
      the problem happened to you) wait for the problem to happen again, and then
      immediately stop and try to remember as much as you can about the current
      state of your computer.

      If you find a way to reproduce the "Java logo" problem, or find out that
      someone else has done so, please let me know.  Until then I'm simply going to
      file the problem away for future reference.

       
    • Wyatt Tellis

      Wyatt Tellis - 2006-03-01

      Given that you have a feel for the cause of the setEnabled bug, do you know if there's a (temporary) workaround?

       
    • Steven Michaud

      Steven Michaud - 2006-03-02

      There is no workaround.

      But I do have the "not disabled" bug fixed in my current version, which I
      should be able to release (as JEP 0.9.5+d) in the next week or two.

       
    • Steven Michaud

      Steven Michaud - 2006-03-14

      I've just released a new version (0.9.5+d) of the Java Embedding
      Plugin that fixes the "not disabled" problem.

      To use the new JEP version, you will need to:

      1) Install it in /Library/Internet Plug-Ins/ (according to the
         instructions in the JEP Readme).
      2) Remove the old JEP files (JavaEmbeddingPlugin.bundle and
         MRJPlugin.plugin) from the Contents/MacOS/plugins/ directory of
         your Mozilla.org browser(s).

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.