Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Problem visualize Jframe contents during the execution of an ActionPerformed

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem visualize Jframe contents during the execution of an ActionPerformed

    Hi guys,

    I'm new on the forum and i hope to be in the right section.
    I'm already sorry for the bad english i will use: i hope you will understand the question.

    I have a problem.

    I have a Jframe "MAIN: with a Jbutton "START" which is related to an action.
    The action should create a new JFrame "SECOND" with a Jmenu, a text Area showing a particular String and, after that, execute a procedure "LISTEN" which will monitor a directory.

    The problem is that the program creates the Frame "SECOND" , but i cannot see and interact with the contents as long the procedure "LISTEN" is not terminated.
    Considering that the procedure never ends without any signal.

    How can I fix it?
    Because i would like to have the Frame "SECOND" with an "Exit" Button in a "File" Jmenu in order to send a signal and interrupt the procedure LISTEN and eventually terminate the program.

    Thank you in advance for the patience and the help.

    Cheers

    gtotto


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Problem visualize Jframe contents during the execution of an ActionPerformed

    Sounds like you're blocking the EDT with a while(true) or a long-running task. Instead, use a separate Thread or a Swing Timer.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Problem visualize Jframe contents during the execution of an ActionPerformed

    Ah, never mind, turns out I was wasting my time.

    This thread has been cross posted here:

    http://www.java-forums.org/awt-swing/57455-problem-visualize-jframe-contents-during-execution-actionperformed.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem visualize Jframe contents during the execution of an ActionPerformed

    Sorry for the cross posting Kevin
    The problem is exactly that the thread is blocked into a while(true).
    I still have the problem, and i try to explain it better.
    Maybe you could have a look.
    Problem visualize Jframe contents during the execution of an ActionPerformed

    Thank you

Similar Threads

  1. Problem retreving data from another JFrame in Java
    By phabion in forum Java Networking
    Replies: 3
    Last Post: March 19th, 2012, 09:59 AM
  2. jmenu&jframe problem
    By beni.vd in forum AWT / Java Swing
    Replies: 1
    Last Post: January 2nd, 2011, 12:11 PM
  3. Java Gif image problem in JFrame
    By Zachary Wins in forum What's Wrong With My Code?
    Replies: 0
    Last Post: May 23rd, 2010, 08:51 PM
  4. Problem with a JFrame method
    By Lakmini Kuruppu in forum AWT / Java Swing
    Replies: 1
    Last Post: May 20th, 2010, 08:40 AM
  5. Change JFrame components problem
    By bruno88 in forum AWT / Java Swing
    Replies: 0
    Last Post: June 30th, 2009, 01:25 PM