Results 1 to 2 of 2
  1. #1
    markw8500's Avatar
    markw8500 is offline Senior Member
    Join Date
    Jul 2008
    Location
    Pennsylvania, USA
    Posts
    136
    Rep Power
    0

    Default [SOLVED] Theread help...

    I have an application where I am connecting to a database and I need to run 3-4 different queries that will populate a JTable and about 20 arrays... Each element in the array represents a row in the JTable... So myArray[0] is row zero in my table...

    I tried one long query, but it takes to long... So I have a short qurey that sets the visable cells in the JTable and the other queries I want to run in the background filling the arrays...

    Now I am new to Threads so I am not sure if this is good to do... Here is my code:


    Java Code:
    public class MyClass {
        
        
        private Thread loadBracketPricing;
        private Runnable myRunnable;
        
        public MyClass() {
    
            myRunnable = new Runnable() {
    
                public void run() {
    
                    //connect to database
                    //query database
                    //loadArrays...
    
                }
            };
    
            loadBracketPricing = new Thread(myRunnable);
    
        }
    
        public void loadRow(String cellvalue){
    
            //connect to database
            //see if cellvalue is found
            
            if(cellValueIsFound){
                
                //Load JTable with data
                
                //Load the rest of the Arrays in the Background...
                loadBracketPricing.run();
            }
    
    
            
    
        }
    
    
    
    
    }

    Is this ok to do...

  2. #2
    markw8500's Avatar
    markw8500 is offline Senior Member
    Join Date
    Jul 2008
    Location
    Pennsylvania, USA
    Posts
    136
    Rep Power
    0

    Default

    After a couple of different test... I have found that this does not work at all...
    Who Cares... As Long As It Works...

Posting Permissions

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