Results 1 to 3 of 3
  1. #1
    vitaly87 is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Default problem with repaint bar

    Hello all!

    I have a problem with repaint bar process.

    when the apps start I hide it with visible=false

    but when I click on button I what to see it agian but still cant.

    here is the code:

    this block works:




    public start() {







    initComponents();



    jProgressBar1.setVisible(false);







    }





    but here is my problem:




    private void searchButActionPerformed(java.awt.event.ActionEven t evt) {



    jProgressBar1.setVisible(true);



    start.jProgressBar1.repaint();





    just cant do a repiant or flash to the form.

    my GUI looks like that:

    ImageShack® - Online Photo and Video Hosting

    thanks for helping me.

  2. #2
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    10

    Default

    Oh mai god. So much white space. Could you use [code][/code] tags when posting your code? It will help us look at your code.

    What is the purpose of this code
    Java Code:
    private void searchButActionPerformed(java.awt.event.ActionEven t evt) {
    Also, posting in an Short, Self Contained, Correct Example will also help us to help you.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  3. #3
    vitaly87 is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Default

    this is a buttion that supposed to do search on the net(when this buttion clicked the application started to work).I just want to see the bar.
    the implimintation of the bar is a thread
    Java Code:
    ublic class threadProcessBar implements Runnable {
          
    public Boolean done;
    public  long interval=1000;
          
     
             public void run() {
                 System.out.print("thread Process Bar started ");
                 done=false;
                 start.jProgressBar1.setVisible(true);  
                start.jProgressBar1.setIndeterminate(true);
                start.jProgressBar1.setString("Loading");
                start.jProgressBar1.repaint();
    
                while(!done)
                {
                try {
                    Thread.sleep(interval) ;
                } catch (InterruptedException ex) {
               
                }
                }
                start.jProgressBar1.setValue(100);
                start.jProgressBar1.setIndeterminate(false);
                start.jProgressBar1.setString("Done");
                start.jProgressBar1.repaint();
             }
         }
    when the app is comlete then done=true.
    I can see the bar only when message pop up from searchButActionPerformed then it appeared.
    I tested it and only if I do JOptionPane.showMessageDialog(null, "start");
    and then start.jProgressBar1.setVisible(true); its work but without the message it dosent work. Why is that?
    Last edited by vitaly87; 07-12-2011 at 03:16 PM.

Similar Threads

  1. problem with repaint()
    By ankit1801 in forum New To Java
    Replies: 2
    Last Post: 03-29-2011, 09:26 AM
  2. repaint() problem ?
    By santa in forum New To Java
    Replies: 4
    Last Post: 02-09-2011, 11:47 AM
  3. repaint problem
    By amith in forum Java 2D
    Replies: 2
    Last Post: 07-01-2008, 12:10 AM
  4. Problem in repaint
    By Preethi in forum AWT / Swing
    Replies: 16
    Last Post: 03-18-2008, 08:10 PM
  5. Repaint problem
    By swimberl in forum Java 2D
    Replies: 0
    Last Post: 01-06-2008, 03:28 AM

Posting Permissions

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