Results 1 to 4 of 4
  1. #1
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Error while enabling jbutton

    Hi all,
    I have just updated to Java 1.7 and i am getting problems while enabling jbuttons.

    My code crashes in sentences like this:

    jButtonFechaInicialA1.setEnabled(false);

    How can I fixed it?? I would like to keep on using Java 1.7
    Thanks in advance.
    Regards

  2. #2
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Re: Error while enabling jbutton

    Hi all,
    I was googling and I could finally find a solution.

    It was not related to my code. Is is a Java 1.7 bug. To fix it, just use this sentence in your VM parameters:
    -Djava.util.Arrays.useLegacyMergeSort=true

    Thank you all!

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,985
    Rep Power
    9

    Default Re: Error while enabling jbutton

    Huh? Please provide some example code that demonstrates the problematic behavior. It doesn't really make sense that your fix would change anything with JButtons.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Re: Error while enabling jbutton

    It is a simple jbutton listener in which I am enabling/disabling another components:

    Java Code:
    			jButtonFechaInicialA1.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					fechaInicioSemanaA1 = jCalendarA1.getCalendar();
    					jButtonFechaFinalA.setEnabled(true);
    					jButtonFechaFinalA1.setEnabled(true);
    					jButtonFechaInicialA1.setEnabled(false);
    					jTextAreaLog.append(................);
    					jCalendarActual.setCalendar(calendar7Despues);
    				}
    			});
    I could find the solution here:
    swing - How to debug in Java with this stack trace which makes no mention of my own classes? - Stack Overflow

    I've read in some forums that this behaviour is related to the FocusTraversalPolicy and it affects not only jbuttons but also tabberedPanes and some other components.

Similar Threads

  1. Replies: 4
    Last Post: 01-17-2013, 04:34 PM
  2. Enabling Javascript
    By drewsonoffergus in forum Networking
    Replies: 1
    Last Post: 08-06-2011, 08:42 PM
  3. disabling and re-enabling a jframe
    By jchinson in forum AWT / Swing
    Replies: 8
    Last Post: 07-07-2011, 05:20 AM
  4. Error in writing JButton Array of objects into File
    By justbeller in forum AWT / Swing
    Replies: 3
    Last Post: 06-08-2011, 11:06 PM
  5. enabling keystrokes
    By elieN in forum AWT / Swing
    Replies: 7
    Last Post: 05-28-2011, 06:29 PM

Posting Permissions

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