Progress bar on Applet using swing

Not sure if this is Swing related or applet related, so I'll post it here... :-)
Long work should be done on a Worker thread an not inside the Swing Dispacher thread .
So normally I create a Runnable object that calls something like doWork(), and pass the runnable object as a parameter to the Sing utilities invokelater() function.
My question is inside the worker thread how to update the GUI, in this case the progress bar?
Can I just call from inside doWork() with no problems the progressbar.setValue(X)?
Do I need to create another thread and use it too update the UI?
Is something like this valid ?
public void doWork() {
// work work work
progressbar.setValue(5);
//more work
progressbar.setValue(15);
// and so on
Thanks for the help!

Not sure if this is Swing related or applet related,
so I'll post it here... :-)It's definitely Swing related.
Long work should be done on a Worker thread an not
inside the Swing Dispacher thread . This is true.
So normally I create a Runnable object that calls
something like doWork(), and pass the runnable object
as a parameter to the Sing utilities invokelater()
function.This does not start a worker thread but rather schedules your Runnable object to be run on the EDT.
My question is inside the worker thread how to update
the GUI, in this case the progress bar?SwingUtilities or EventQueue have invokeLater and invokeAndWait specifically for this purpose.
Can I just call from inside doWork() with no problems
the progressbar.setValue(X)?
Do I need to create another thread and use it too
update the UI?No. Here's where you could use invokeLater.
Is something like this valid ?
public void doWork() {
// work work work
rogressbar.setValue(5);
//more work
progressbar.setValue(15);
// and so onNo.
>
Thanks for the help!Like pete has pointed out, this seems to be a job for SwingWorker.

Similar Messages

  • Html file to run an Applet using swings in 1.4.1 or 1.3.1

    Can anyone send me an html document to launch the applet in a browser. I have very basic html, but I need one that uses the appropriate plug-in and that has parameters such as height, width, etc. My applet uses tabbed panes, dialog boxes and comboboxes. It works well with appletviewer, but does not work in IE or Netscape.
    Thank you for your help
    here is what I am using which does does show anything but a grey screen
    <HTML>
    <HEAD>
    <TITLE>
    CIS 602 Semister Project
    </TITLE>
    </HEAD>
    <BODY>
    <BR>
    <H3>
    <CENTER>
    Swing
    </CENTER>
    </H3>
    <H3>
    <BR><BR>
    <P><H3>
    <CENTER>
    <BR><BR>
    <P><h2>
    Structured Problem Solving Strategy
    </h2>
    <blockquote>
    <!--"CONVERTED_APPLET"-->
    <!-- CONVERTER VERSION 1.1 -->
    <SCRIPT LANGUAGE="JavaScript"><!--
    var info = navigator.userAgent; var ns = false;
    var ie = (info.indexOf("MSIE") > 0 && info.indexOf("Win") > 0 && info.indexOf("Windows 3.1") < 0);
    //--></SCRIPT>
    <COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
    var ns = (navigator.appName.indexOf("Netscape") >= 0 && ((info.indexOf("Win") > 0 && info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
    //--></SCRIPT></COMMENT>
    <SCRIPT LANGUAGE="JavaScript"><!--
    if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "570" HEIGHT = "500" codebase="http://java.sun.com/products/plugin/1.1.2/jinstall-112-win32.cab#Version=1,1,2,0"><NOEMBED><XMP>');
    else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.4.2" java_CODE = "semiclient.class" WIDTH = "570" HEIGHT = "500" pluginspage="http://java.sun.com/products/plugin/1.1.2/plugin-install.html"><NOEMBED><XMP>');
    //--></SCRIPT>
    <APPLET CODE = "semiclient.class" WIDTH = "570" HEIGHT = "500" ></XMP>
    <PARAM NAME = CODE VALUE = "semiclient.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4.2">
    </APPLET>
    </NOEMBED></EMBED></OBJECT>
    <!--
    <APPLET CODE = "semiclient.class" WIDTH = "570" HEIGHT = "500" >
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    </Center>
    <BLOCKQUOTE><PRE>
    </PRE></BLOCKQUOTE>
    </H3>
    <BLOCKQUOTE><PRE>
    </PRE></BLOCKQUOTE>
    </H3>
    </BODY></HTML>

    Try this:
    <HTML>
    <HEAD>
    <TITLE>CIS 602 Semister Project</TITLE>
    </HEAD>
    <BODY>
    <CENTER><H3>Swing</H3></CENTER><CENTER><H2>Structured Problem Solving Strategy</H2></CENTER>
            <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                width="750"
                height="575"
                align="baseline"
                codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_0-win.cab">
                <PARAM NAME="code"       VALUE="full.qualified.ClassName">
                <PARAM NAME="codebase"   VALUE="path/to/your/class/files/or/archive/">
                <PARAM NAME="archive"    VALUE="nameOfJarWhichContainsClassFiles.jar">
                <PARAM NAME="type"       VALUE="application/x-java-applet;version=1.4">
                <PARAM NAME="scriptable" VALUE="false">
                <COMMENT>
                    <EMBED type="application/x-java-applet;version=1.4"
                        width="750"
                        height="575"
                        align="baseline"
                        code="full.qualified.ClassName"
                        codebase="path/to/your/class/files/or/archive/"
                        archive="nameOfJarWhichContainsClassFiles.jar"
                        pluginspage="http://java.sun.com/products/plugin/1.4/plugin-install.html">
                        <NOEMBED>
                            No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!
                        </noembed>
                    </embed>
                </COMMENT>
            </OBJECT>
    </BODY>
    </HTML>

  • Memory leak with 1.6.0_07 in applet using Swing

    Java Plug-in 1.6.0_07
    Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
    Windows XP - SP2
    I have a commercial application that has developed a memory leak with the introduction of the latest plugin. The applets chew up memory and eventually freeze. They did not before. Using jvisualm I see a build up of native arrays, primarily int[][] and char[]. I'm still investigating. Anyone have a similar experience?
    The Applet uses a swing interface, uses buffered images and swing timers, and regularly performs http connections to the server which result in actions via the SwingUtil.invokeLater() method.

    I am Using Internet Explorer Browser Version 6.0.Huge security hole.
    Its not throwing Error / Exception Wrap a try/catch at the highest level possible.
    Catch 'Throwable'. And log/display it somewhere.

  • Calculator applet using swing

    please Help!!!!!
    This thing keeps giving a Null Pointer Exception whenever you click a button it compiles fine and runs ok until a button is clicked.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MyCalculator extends JApplet implements ActionListener {
    private char op = 0;
    private float num1 = 0, num2 = 0, value = 0 ;
    private boolean clearNext = false;
    private JTextField display, textField2;
    private JButton buttonEq, buttonPlus, buttonMinus, buttonMult,buttonCos;
    private JButton buttonDiv,buttonPlusMinus,buttonDec,buttonC,buttonSin;
    private JButton buttonTan;
    private JButton button = new JButton();
    private boolean start = true;
    // create GUI components
    public void init() {
    Container con = getContentPane();
    con.setLayout( new BorderLayout());
    con.setBackground(Color.darkGray);
    //add display display
    JTextField display = new JTextField( "0", 15 );
    display.setBackground(Color.black);
    display.setForeground(Color.red);
    display.setEditable(false);
    JTextField textField2 = new JTextField( " Design and Implementation By Erwin Zeitner" );
    textField2.setBackground(Color.black);
    textField2.setForeground(Color.red);
    textField2.setEditable(false);
    //create numbered buttons
    JButton button0 = new JButton("0" );
    button0.setBackground(Color.blue);
    JButton button1 = new JButton( "1" );
    button1.setBackground(Color.blue);
    JButton button2 = new JButton( "2" );
    button2.setBackground(Color.blue);
    JButton button3 = new JButton( "3" );
    button3.setBackground(Color.blue);
    JButton button4 = new JButton( "4" );
    button4.setBackground(Color.blue);
    JButton button5 = new JButton( "5" );
    button5.setBackground(Color.blue);
    JButton button6 = new JButton( "6" );
    button6.setBackground(Color.blue);
    JButton button7 = new JButton( "7" );
    button7.setBackground(Color.blue);
    JButton button8 = new JButton( "8" );
    button8.setBackground(Color.blue);
    JButton button9 = new JButton( "9" );
    button9.setBackground(Color.blue);
    //create function buttons
    JButton buttonC = new JButton( "clear" );
    buttonC.setBackground(Color.green);
    JButton buttonPlus = new JButton( "+" );
    buttonPlus.setBackground(Color.green);
    JButton buttonMinus = new JButton( "-" );
    buttonMinus.setBackground(Color.green);
    JButton buttonMult = new JButton( "*" );
    buttonMult.setBackground(Color.green);
    JButton buttonDiv = new JButton( "/" );
    buttonDiv.setBackground(Color.green);
    JButton buttonSin = new JButton( "Sin" );
    buttonSin.setBackground(Color.green);
    JButton buttonCos = new JButton( "Cos" );
    buttonCos.setBackground(Color.green);
    JButton buttonTan = new JButton( "Tan" );
    buttonTan.setBackground(Color.green);
    JButton buttonDec = new JButton( "." );
    buttonDec.setBackground(Color.blue);
    JButton buttonEq = new JButton( "=" );
    buttonEq.setBackground(Color.orange);
    JButton buttonPlusMinus = new JButton( "+/-" );
    buttonPlusMinus.setBackground(Color.blue);
    //create a panel for each row
    JPanel row1 = new JPanel();
    row1.setBackground(Color.darkGray);
    JPanel row2 = new JPanel();
    row2.setBackground(Color.darkGray);
    JPanel row3 = new JPanel();
    row3.setBackground(Color.darkGray);
    JPanel row4 = new JPanel();
    row4.setBackground(Color.darkGray);
    JPanel row5 = new JPanel();
    row5.setBackground(Color.darkGray);
    JPanel row6 = new JPanel();
    row6.setBackground(Color.darkGray);
    JPanel row7 = new JPanel();
    row7.setBackground(Color.darkGray);
    //create panel for rows and set layout
    JPanel p = new JPanel();
    p.setLayout(new GridLayout( 7,1,0,5 ));
    p.setBackground(Color.darkGray);
    //set layout for rows
    GridLayout grid = new GridLayout(1,4,5,0);
    //add buttons & display field to rows
    row1.setLayout(grid);
    row1.add(display);
    //add row to panel
    p.add(row1);
    row2.setLayout(grid);
    buttonC.addActionListener(this);
    row2.add(buttonC);
    buttonSin.addActionListener(this);
    row2.add(buttonSin);
    buttonCos.addActionListener(this);
    row2.add(buttonCos);
    buttonTan.addActionListener(this);
    row2.add(buttonTan);
    //add row to panel
    p.add(row2);
    row3.setLayout(grid);
    button7.addActionListener(this);
    row3.add(button7);
    button8.addActionListener(this);
    row3.add(button8);
    button9.addActionListener(this);
    row3.add(button9);
    buttonPlus.addActionListener(this);
    row3.add(buttonPlus);
    //add row to panel
    p.add(row3);
    row4.setLayout(grid);
    button4.addActionListener(this);
    row4.add(button4);
    button5.addActionListener(this);
    row4.add(button5);
    button6.addActionListener(this);
    row4.add(button6);
    buttonMinus.addActionListener(this);
    row4.add(buttonMinus);
    //add row to panel
    p.add(row4);
    row5.setLayout(grid);
    button1.addActionListener(this);
    row5.add(button1);
    button2.addActionListener(this);
    row5.add(button2);
    button3.addActionListener(this);
    row5.add(button3);
    buttonMult.addActionListener(this);
    row5.add(buttonMult);
    //add row to panel
    p.add(row5);
    row6.setLayout(grid);
    button0.addActionListener(this);
    row6.add(button0);
    buttonDec.addActionListener(this);
    row6.add(buttonDec);
    buttonPlusMinus.addActionListener(this);
    row6.add(buttonPlusMinus);
    buttonDiv.addActionListener(this);
    row6.add(buttonDiv);
    //add row to panel
    p.add(row6);
    row7.setLayout(grid);
    buttonEq.addActionListener(this);
    row7.add(buttonEq);
    //add row to panel
    p.add(row7);
    // add panel and textField2 to the container
    con.add(p,BorderLayout.CENTER);
    con.add(textField2,BorderLayout.SOUTH);
    public void actionPerformed(ActionEvent e) {
    String buttonPressed = e.getActionCommand();
    try {
    if (buttonPressed.equals( "+/-" )) {
    value = getValue(display.getText());
    value *= -1;
    clearOutput();
    addToOutput("" + value );
    else switch ( buttonPressed.charAt(0) ) {
    case '+':
    case '-':
    case '*':
    case '/':
    buttonEq.setEnabled(true);
    buttonPlus.setEnabled(false);
    buttonMinus.setEnabled(false);
    buttonMult.setEnabled(false);
    buttonDiv.setEnabled(false);
    num1 = getValue(display.getText());
    op = buttonPressed.charAt(0);
    clearNext = true;
    break;
    case '=':
    buttonEq.setEnabled(true);
    buttonPlus.setEnabled(true);
    buttonMinus.setEnabled(true);
    buttonMult.setEnabled(true);
    buttonDiv.setEnabled(true);
    getResult();
    num1 = getValue(display.getText());
    op = 0 ;
    clearNext = true;
    break;
    case 'C':
    float num1 = getValue(display.getText());
    op = buttonPressed.charAt(0);
    getResult();
    clearNext = false;
    break;
    case 'S':
    num1 = getValue(display.getText());
    op = buttonPressed.charAt(0);
    getResult();
    clearNext = false;
    break;
    case 'T':
    num1 = getValue(display.getText());
    op = buttonPressed.charAt(0);
    getResult();
    clearNext = false;
    break;
    case 'c':
    clearOutput();
    op = 0 ;
    num1 = (float) 0 ;
    break;
    default:
    if (clearNext) {
    clearOutput();
    clearNext = false;
    addToOutput(buttonPressed);
    catch( Exception exception) {
    System.err.println(exception.toString());
    public void getResult() {
    float num2 = getValue(display.getText());
    switch (op) {
    case '+':
    num1 += num2;
    break;
    case '-':
    num1 -= num2;
    break;
    case '*':
    num1 *= num2;
    break;
    case '/':
    if (num2 != 0)
    num1 /= num2;
    else
    num1 = 0;
    break;
    case 'C':
    Math.cos(num1);
    break;
    case 'S':
    Math.sin(num1);
    break;
    case 'T':
    Math.tan(num1);
    break;
    clearOutput();
    addToOutput( "" + num1 );
    clearNext = true;
    public void addToOutput( String buttonPressed) {
    String newOutput = display.getText();
    if (buttonPressed.equals(".")) {
    if (newOutput.indexOf(".") == -1)
    newOutput += ".";
    else
    newOutput += buttonPressed;
    int newLength = newOutput.length();
    display.setText(newOutput);
    public void clearOutput() {
    try{
    display.setText( "" );
    catch(Exception c) {
    System.err.println(c.toString());
    public float getValue(String arg) {
    if (arg.equals("."))
    arg = "0";
    Float f = Float.valueOf(arg);
    return f.floatValue();

    I have found your error please change this to the below one
    //add display display
    JTextField display = new JTextField( "0", 15 );
    display.setBackground(Color.black);
    display.setForeground(Color.red);
    display.setEditable(false);
    //add display display
    display = new JTextField( "0", 15 );
    display.setBackground(Color.black);
    display.setForeground(Color.red);
    display.setEditable(false);
    if you noticed, you declared the display as a global variable but did not intialized it that is why u get NullPointerException.
    By declaring JTextField display again in a method it only belong to that method which is init()
    The other textfield also have to be changed if you wish to access it from elsewhere(ex. textfield2 )
    Thanks
    Joey

  • How to make use of *progress bar*?

    I have a progress bar requirement in my swings project,
    i.e on clicking a button, some task should be executed and in parallel to this
    progress should run on progress bar in the same frame and soon after this task
    gets completed the progress on progress bar should come to an end.
    How can i do this in swings?
    could any one help me out from this?

    How to use progress bar
    http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
    If you want an example scroll down to the bottom of the page and download the examples.

  • Using Swing applet to write data to file on SERVER

    Hello,
    I'm in the process of writing an applet using Swing (SDK v1.4.2). Here's the deal. The JApplet calls a JPanel, which will be used by customers on my site to enter data. I'm adding a <Save> button to the "form" which is supposed to write data to a file on the server (in order to preserve the customer's preferences).
    Please note that I am NOT attempting to write data to the customer's hard disk. That requires digital certificates, etc. which I am trying to avoid for now.
    Instead, I am using the URL class to access the file:
    URL page = new URL("http://www.whatever.com/mycustomers/preferences.txt")
    I then use the URLConnection class to establish the connection:
    URLConnection conn = this.page.openConnection();
    conn.setDoInput(true);
    conn.setDoOutput(true);
    conn.connect();
    etc...
    I've created a text file (preferences.txt) on my web site. Using the classes InputStreamReader, BufferedStreamReader, and StringBuffer, I can successfully read the file into a JOptionPane in my applet.
    The problem comes when I try to write data TO this file. I know the file exists because the applet can read it. I've set the permissions on the file to 666. I've got all of the appropriate syntax within a try statment that catches an IOException. I also have JOptionPanes all over the place to let me know where the program is. I've tried different combinations of output streams like BufferedWriter, BufferedOutputStream, StringWriter, but the file does not get updated. When the applet runs, it does not throw any exceptions, not even when I change the URL from "HTTP://www.whatever.com/prefs.txt" to "HTTP:/www.whatever.com/prefs.txt" (only one slash on HTTP, shouldn't I get a MalformedURLException?)
    I apologize for all the background, but I thought you might need it. The bottom line is:
    1) Can an applet write to a file on a remote server (not local hard disk)?
    2) If so, what (if any) caveats are there?
    3) Is there a way to check for file existence or be able to create a new file?
    4) I'm using the HTTP protocol - is there some restriction that prevents an applet from writing to a file using that protocol? If so, is there a workaround?
    5) Assuming that creating/writing a file using the method I've described is possible, what would be the appropriate output streams to use? (Currently, I'm using OutputStreamWriter with BufferedWriter).
    I've been struggling with this for a while. Any help/suggestions would be appreciated.
    Thanks
    P.S. I also posted this message on the Applet development forum, but I've received no response as of yet.

    Http servers support PUT as a mechanism to upload data to a specified URL. Get on the other hand which is what most people are familiar with is how you retrieve that data. The basic URLConnection is an abstraction of the Http connection which can be used for GET and POST operations by default based on doInput(true|false).. If you which to use any of the http methods other than GET|POST you will have to cast the URLConnection to HttpURLConnection so you can gain access to the specific Http functionaility that could not be abstracted.
    Since you are using a hosting service the chances are that you won't be able to use HTTP PUT on their server. Most servers do not support HTTP PUT without configuring them todo so. Now Apache allows localized config through the .htacess file. It might be possible (keep in mind I am not an apache expert) to configure a particular directory to allow HTTP PUT using this .htacess file it may not be possible. You will have to consult the Apache web server documentation for that answer.
    But regardless you can use the HttpURLConnection and the PUT method to send data from your applet to the server. In fact that is the preferred way to do this. If you can not configure your web server to support that method then you will have to develop a Servlet to do it. A servlet has several methods such as doGet(), doPost(), and doPut(). You would override the doPut() method get the URI path create a file and a FileOutputStream to that file, get from the request the inputstream, possibly skip the http headers, and then write byte for byte the incoming data to your OutputStream until you reach the end at which point you would close the OutputStream and send an Http Response of some sort. Typically in HTTP it would be 200 OK plus some web content. You content can be empty so long as your applet recognizes that is what it should expect...
    And away you go...

  • UI 6.7 How could I use Progress bar form?

    Hi all,
    some SAP Business One add-ons use a small form with a progress bar instead of using the progress bar in the status bar. Does anyone knows how to use this form?
    Bernhard

    Hi,
    I think that you have to create your own form.
    In my Addon, I create a form with FormType = ft_FixedNoTitle, add several EditTexts (9) with the property Enabled = False and Visible = False, and the name beginnig with "oEditText" + Number Sequential.
    After, when executing my code, I change the property Visible = True, to the next EditText.
    That way I have a "progress form" like used in others Addons.
    I use the following code to "progress" (after created the form)
        Private Sub WriteProgressInstall(ByVal pMsg As String, ByVal pPosition As Integer)
                Dim oForm As SAPbouiCOM.Form
                Dim oStaticText As SAPbouiCOM.StaticText
                Dim i As Integer
                Try
                    If pMsg <> String.Empty Then
                        oForm = SBO_Application.Forms.Item("frmProgressForm")
    'if we have a StaticText to show the progress message
                        oStaticText = oForm.Items.Item("oMSG").Specific
                        oStaticText.Caption = pMsg
                    End If
                    'Hide all "progress steps"
                    If pPosition = 0 Then
                        For i = 1 To 9
                            oForm.Items.Item("oEditText" + CStr(pPosition)).Visible = False
                        Next
                    End If
                    oForm.Items.Item("oEditText" + CStr(pPosition)).Visible = True
                Catch er As Exception
                    MsgBox(er.Message)
                End Try
            End Sub
    To move to next "progress step" is just call
    WriteProgressInstall("Executing Step 1..", 1)
    HTH,
    Ribeiro Santos

  • System crashes when using Middle Values on a vertical progress Bar

    I've been trying for several days to get a  Vertical Slider/Vertical progress bar  to work using middle values. Sometimes it'll work fine in the High and Low values mode but crashes when you choose the middle values mode.  After many iterations I finally got one verticle slider bar with middle values to work but when I try to add a second slider it crashes again.  I'm getting the error that memory cannot be read.

    Hi Maureen,
    Can you please tell us which version of Xcelsius you are running?
    If it's Crystal Xcelsius 4.5, are you running a Hot Fix?  If so, which version?  This can checked by going to Help --> About Crystal Xcelsius, and then analyzing the Application Version field.
    If it's Xcelsius 2008, which version (Present or Engage) are you using? 
    Are you using Service Pack 1?  To check if you're running SP1, you can go to Help --> About Xcelsius.  The Build Number field should end with 247 if you have it.
    Thanks,
    -david

  • Problem in loading an applet using JRE 1.5

    Hi,
    I have an applet which is working fine under JRE 1.4, but the same applet failing to load by using JRE 1.5
    Problem Description:
    1. The images in the applet fails to load using JRE 1.5
    2. The Username and Password text box are also failing to initialize.
    Can anyone help me out in this.
    Is there any code changes required ?

    I wonder if you have the same problem as me... Maybe we can find a solution for us both, no need for me to open a new thread for this topic then...
    I wrote an applet using Swing and compiled it using JavaSDK 1.4.x. I also installed the 1.4.x JRE for both of my test browsers. In Mozilla 1.1 the applet displays properly all the time. In IE6 SP1 it sometimes works as intended but sometimes the applet simply stops working, as per my Java Console somewhere after invoking the "start" method. Parts of the applet simply become gray and when I resize it - I have a JFrame in my applet - the whole JFrame becomes gray and does not respond to input nor it redraws itself. Shutting down IE does not close the JFrame(although the java console reports normal program termination and cleanup) and the only way to close it is through the task manager. I am using Windows 98SE btw.
    Does it sound similiar to your problem? It happens ONLY with IE, not with Mozilla. Anybody has an idea on what it could be? I doubt there's an error in my code...

  • Applet with swings

    Hi
    I developed a applet using swing componets.But it doesn't work.
    I used jdk1.3.1 for development.And I am using IE 5.0 and Netscape4.7 browsers.
    can any body help me what could be the problem?
    thanks

    Just explain the problem, might be i can help u.
    Any ways u should have the Plugin to run the Swing applet.
    Best of Luck!
    Ahmad Jamal.

  • Please help...Problem with 3D Applet using JRE 1.5

    Hi all,
    I have an applet which uses sun opengl 1.3.1 plugin to render some 3D graphics. It is working fine with JRE 1.4.2_06, but not showing the 3D graphics with the latest JRE 1.5 release. I tried to repaint using available API with no success.
    Please help asap,
    Thanks in advance
    prasad

    I wonder if you have the same problem as me... Maybe we can find a solution for us both, no need for me to open a new thread for this topic then...
    I wrote an applet using Swing and compiled it using JavaSDK 1.4.x. I also installed the 1.4.x JRE for both of my test browsers. In Mozilla 1.1 the applet displays properly all the time. In IE6 SP1 it sometimes works as intended but sometimes the applet simply stops working, as per my Java Console somewhere after invoking the "start" method. Parts of the applet simply become gray and when I resize it - I have a JFrame in my applet - the whole JFrame becomes gray and does not respond to input nor it redraws itself. Shutting down IE does not close the JFrame(although the java console reports normal program termination and cleanup) and the only way to close it is through the task manager. I am using Windows 98SE btw.
    Does it sound similiar to your problem? It happens ONLY with IE, not with Mozilla. Anybody has an idea on what it could be? I doubt there's an error in my code...

  • Progress bar in 10g

    How to create progress bar in 10g using timer

    I want to manually code for rpogressbar using timer.Could anyone help me on this
    I want to create two text items and one pushbutton .Help me in this

  • About progress bar and Photoshop

    I have been reading a lot about how to make a progress bar in photoshop (scripting) and my conclusion is that it is not worthy. The only way to make a progress bar is by using Palette window but Photoshop does not support it. If we use a dialog window, since it is modal, it will freeze whatever your script is doing so, you cannot use it (how to track the progress of a script if the script is paused while the dialog is being shown?). Although Photoshop does not support Palette, there are two workarounds that would make it work and they are using either app.refresh() or waitForRedraw() (and undocumented function that seems to me to do exactly the same thing that app.refresh() does). But as the manual says, app.refresh() will slow down considerably your code. According to my experimentation, each time you call app-refresh(), your script will waste about 1 second (no matter how powerful your computer is). That is a lot of time! In practical terms, you would use app.refresh() only a few times so your progress bar could be refreshed only a few times during the whole duration of your script, still one second lost for each time you use it. In other words, there is no good way of making a progress bar in photoshop scripting.
    My question is: am I right? Is there a way to code a progress bar in PS that would not delay the code unreasonably?

    Since I wrote that post I've learnt that BridgeTalk is pretty sensitive - for instance to binary code: instead to let .toSource() functions that needs to go to the message, you'd better of wrapping them into a String literal.
    True, AM is lightning fast compared to DOM! But I won't use BridgeTalk for a Palette if the Palette is needed just for a progress bar. Such a Palette will stay alive while your script does all the things it's supposed to do without the need of waitForRedraw().
    In my snippets library I've found this one that might help:
    * Create a progress window
    * @param  {String}  title           = title
    * @param  {String}  message         = message (updatable)
    * @param  {Boolean} hasCancelButton = add a Cancel button (default: false)
    * @usage          w = new createProgressWindow "Title", "Message", true
    createProgressWindow = function(title, message, hasCancelButton) {
      var win;
      if (title == null) {
        title = "Work in progress";
      if (message == null) {
        message = "Please wait...";
      if (hasCancelButton == null) {
        hasCancelButton = false;
      win = new Window("palette", "" + title, undefined);
      win.bar = win.add("progressbar", {
        x: 20,
        y: 12,
        width: 300,
        height: 20
      }, 0, 100);
      win.stMessage = win.add("statictext", {
        x: 10,
        y: 36,
        width: 320,
        height: 20
      }, "" + message);
      win.stMessage.justify = 'center';
      if (hasCancelButton) {
        win.cancelButton = win.add('button', undefined, 'Cancel');
        win.cancelButton.onClick = function() {
          win.close();
          throw new Error('User canceled the pre-processing!');
      this.reset = function(message) {
        win.bar.value = 0;
        win.stMessage.text = message;
        return win.update();
      this.updateProgress = function(perc, message) {
        if (perc != null) {
          win.bar.value = perc;
        if (message != null) {
          win.stMessage.text = message;
        return win.update();
      this.close = function() {
        return win.close();
      win.center(win.parent);
      return win.show();
    Cheers,
    Davide

  • Time Machine progress bar

    I recently upgraded from an iMac G5 running Leopard to an i5 MacBook Pro, and I had a specific issue with time machine that I would like to resolve.
    With the G5, after activating TM, I always got a small Finder-like window showing the progress of the backup. When I started using TM in the new computer I also got this progress bar showing on the desktop (not part of TM Preferences window), but suddenly it disappeared and now I cannot find a way to make it appear on the desktop.
    I cannot think of anything in particular that I did to make the window not to display. This progress bar is quite useful for me and would appreciate any help to have it display again.

    Thanks, the question has been moved to the correct forum now.
    It seems the TM progress bar cannot be selected/de-selected from the menu bar, nor the TM preferences panel. Based on some other discussions it seems I'm not the only one that has observed this problem, but haven't seen yet a posting with the solution.

  • Progress bar does not display

    Hello. I have a class which display a progreess bar progresssing when run from main. But same class when run from another class it does not display. When the progress is over then it displays.
    The same prob i had with my splash. run from main everything alright. But from another class image in splash is not loaded. Do u have an answer?
    progress bar class
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.sql.*;
    import javax.swing.border.*;
    public class progress extends JFrame
    static final int MY_MINIMUM=0;
    static final int MY_MAXIMUM=100;
    JProgressBar pbar;
    progress()
    pbar = new JProgressBar();
    pbar.setMinimum(MY_MINIMUM);
    pbar.setMaximum(MY_MAXIMUM);
    JLabel label =new JLabel("Timetable Generation in Process");
    label.setFont(new Font("Garamond",Font.BOLD,21));
    JTextField text=new JTextField();
    // JPanel_Background mainpanel=new JPanel_Background();
    JPanel mainpanel=new JPanel();
    JPanel pan=new JPanel(new GridLayout(3,1,20,40));
    JPanel pan1=new JPanel();
    JPanel pan2=new JPanel();
    JPanel pan3=new JPanel();
    double value =pbar.getPercentComplete();
    // text.setText(value);
    pan2.setSize(100,20);
    pan.setOpaque(false);
    pan1.setOpaque(false);
    pan2.setOpaque(false);
    pan3.setOpaque(false);
    pan1.add(label);
    pan2.add(pbar);
    // pan3.add(text);
    pan.add(pan1);
    pan.add(pan2);
    pan.add(pan3);
    mainpanel.add(pan);
    getContentPane().add(mainpanel);
    public void updateBar(int newValue)
    pbar.setValue(newValue);
    public static void main(String args[])
    final progress m=new progress();
    m.setSize(200,200);
    m.setVisible(true);
         for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++)
         final int percent=i;
         try
         SwingUtilities.invokeLater(new Runnable() {
         public void run() {
         m.updateBar(percent);
         java.lang.Thread.sleep(100);
         catch (InterruptedException e)
    now run from another class extending a JFrame
    final progress m=new progress();
                                  m.setSize(200,200);
                                  m.show();
                                       for (int i = 0; i <= 100; i++)
                                       final int percent=i;
                                       try
                                       SwingUtilities.invokeLater(new Runnable() {
                                       public void run() {
                                       m.updateBar(percent);
                                       java.lang.Thread.sleep(100);
                                       catch (InterruptedException en)

    Stay out of the swing event thread.
    Read: http://java.sun.com/docs/books/tutorial/uiswing/overview/threads.html

Maybe you are looking for

  • Permissions repair error

    I keep getting the following Disk Utility error message after a permissions repair, even after using DU from the Leopard installation DVD: Repairing permissions for "Michael" Warning: SUID file "usr/libexec/load_hdi" has been modified and will not be

  • ITunes cutting off songs

    I have a music collection over 60 Gig on iTunes and I have been noticing lately that certain songs just cut off in the middle and skip to the next song. Now when I go back to the song that skipped I try to play it to the part it skipped and it is com

  • Selling powermac G4 with display

    Hello, We are going to sell (2) Powermac G4 with OSX 768mb DDR SDRAM, 60HD with (2) 20" Displays. How much roughly should we be asking for? Both the computer and display are in good condition and will be wiped clean. Thanks

  • Abt module pool

    Hi,      can i declare a selection screen in module pool program?      can i use at selection-screen event in module pool program?

  • PDF security

    Hi everyone, I create artwork for a print shop and provide the owner with a pdf file which she then emails to her customers to get their approval for printing. She tells me that she's worried that if she sends high-res pdf files to her clients that t