Results 1 to 2 of 2
  1. #1
    alkismavridis is offline Member
    Join Date
    Oct 2011
    Location
    Athens, Greece
    Posts
    2
    Rep Power
    0

    Default Threads and subclasses

    Hello!!

    I want to create a thread inside the actionPerformed method of a "JFrame extends" class, that will run a spesific method.

    How can i do that without messing with anonymus classes?
    I thought to implement Runnable interface, to include my run methode and finally to create the new thead with the object that my class creates, which will be Runnable.
    But this way i have to create a heavy object which has many fields and swing components, for simply creating a thread..

    Does something more convenient exists??

    Thanks!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: Threads and subclasses

    do that without messing with anonymus classes?
    Anonymous classes are for quick and easy creation of a class. If that is a problem then,
    You can always make a separate class with the full definition.
    An inner class will allow you to get to the outer class's variables.

Similar Threads

  1. need help with subclasses
    By thorobred in forum New To Java
    Replies: 6
    Last Post: 02-19-2011, 06:34 AM
  2. Dynamic Subclasses?
    By MrFish in forum Advanced Java
    Replies: 5
    Last Post: 11-07-2010, 02:28 AM
  3. Lost with subclasses
    By vinyacam in forum New To Java
    Replies: 3
    Last Post: 05-09-2010, 08:12 PM
  4. Generics and subclasses
    By Sven in forum Advanced Java
    Replies: 1
    Last Post: 12-22-2008, 07:06 PM
  5. Hibernate subclasses
    By Ed in forum JDBC
    Replies: 2
    Last Post: 07-02-2007, 05:42 PM

Tags for this Thread

Posting Permissions

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