Results 1 to 3 of 3
  1. #1
    LeonLanford is offline Member
    Join Date
    Oct 2009
    Posts
    29
    Rep Power
    0

    Default progress bar problem

    Hi.. I'm new to java, I'm making application to append binary codes.
    Whenever I press the execute, the program seems like stopped but it doesn't. That's why I want to make progress bar for it.

    I don't know why I encountered page not found if I post the code so I attached the code in the attachment.

    The problem is the progress bar is not working, I've read about making new progress monitor thread in java-forums.org/new-java/19903-trying-use-progress-bar-first-time.html but it's not working also.

    What I mean not working is, the progress bar not started when I press the execute button. But after the execution finished, the progress monitor already full.

    As you can see I'm using setText to change the status to 'processing'
    Java Code:
    status.setText("Status : Processing..");
    But the status never come out.. :(

    After that status I set wait cursor to it
    Java Code:
    mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    And it's working..

    Why setting cursor working but not with the text and progress bar?

    I'm using netbeans 6.7.1

    Hope you can help thanks..
    Attached Files Attached Files

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    Maybe need to call the refresh on parent container ?

  3. #3
    LeonLanford is offline Member
    Join Date
    Oct 2009
    Posts
    29
    Rep Power
    0

    Default

    Quote Originally Posted by travishein View Post
    Maybe need to call the refresh on parent container ?
    Is it repaint?
    I've tried this, it's working but I got errors in the command line while running.

    Java Code:
    this.getFrame().repaint();
    this.getFrame().paintAll(null);
    The errors
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: java.lang.reflect.InvocationTargetException
            at org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAction.java:859)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:665)
            at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:698)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
            at java.awt.Component.processMouseEvent(Component.java:6263)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
            at java.awt.Component.processEvent(Component.java:6028)
            at java.awt.Container.processEvent(Container.java:2041)
            at java.awt.Component.dispatchEventImpl(Component.java:4630)
            at java.awt.Container.dispatchEventImpl(Container.java:2099)
            at java.awt.Component.dispatchEvent(Component.java:4460)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
            at java.awt.Container.dispatchEventImpl(Container.java:2085)
            at java.awt.Window.dispatchEventImpl(Window.java:2475)
            at java.awt.Component.dispatchEvent(Component.java:4460)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:662)
            ... 27 more
    Caused by: java.lang.NullPointerException
            at java.awt.Component.paintAll(Component.java:3038)
            at binergabung.BinergabungView.gabung(BinergabungView.java:70)
            ... 32 more
    Then I tried to change the null parameter
    Java Code:
    this.getFrame().repaint();
    this.getFrame().paintAll(this.getFrame());
    I got error while compiling..
    Java Code:
    Compiling 3 source files to C:\Documents and Settings\Leon Lanford\Desktop\binarygabung\SimPend\build\classes
    C:\Documents and Settings\Leon Lanford\Desktop\binarygabung\SimPend\src\binergabung\BinergabungView.java:70: paintAll(java.awt.Graphics) in java.awt.Component cannot be applied to (javax.swing.JFrame)
            this.getFrame().paintAll(this.getFrame());
    1 error

Similar Threads

  1. trying to use progress bar for the first time.
    By IYIaster in forum New To Java
    Replies: 19
    Last Post: 07-26-2009, 04:59 AM
  2. How to use Progress bar
    By LankanSniper in forum AWT / Swing
    Replies: 3
    Last Post: 03-25-2009, 11:44 AM
  3. how to implement progress bar .....
    By roshithmca in forum AWT / Swing
    Replies: 1
    Last Post: 03-06-2008, 05:18 PM
  4. Console Progress Bar
    By new_2_java in forum New To Java
    Replies: 1
    Last Post: 02-16-2008, 03:18 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
  •