Refreshing problems for an online dice

here's the problem
http://www.geocities.com/nsmela/java/onlinedice.html
notice how you can't roll afterwards? how can i change this?

ok, i tried doing a while(countIng=0) with counIng=0 in the beginning
i got 4 errors i can't figure out.
code:
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class OnlineDice extends Applet implements ActionListener
          int inputNumber;
          double resultNumber = 0;
          int numberOfTimes;
          int countIng=0;
          TextField textField = new TextField(5);
          Button button = new Button("Roll Now");
          Label label = new Label("Click the button after entering the amount of sides into the field above");
          TextField textField2 = new TextField(5);
          public void init()
               add(textField);
               add(textField2);
               add(button);
               add(label);
               button.addActionListener(this);
          do; //attempt at trying to make this @#$#!!!! thing loop
          public void actionPerformed (ActionEvent e)
               String textFieldText = textField.getText();
               String textFieldText2 = textField.getText();
               inputNumber =Integer.parseInt(textFieldText);
               numberOfTimes =Integer.parseInt(textFieldText);
               for (int count=1; count <=numberOfTimes; count++){
               while (resultNumber>inputNumber || resultNumber<1)
                    resultNumber=(Math.random()*inputNumber+1);
               label.setText(Long.toString(Math.round(resultNumber)));
label.setText(" is your result");
/*basicly, i'm trying to make this have 2 fields, one to enter the amounts of sides the dice will have
the other is how many times
and the error i get is:
C:\java\diceroller\RollingDice\OnlineDice2.java:26: illegal start of type
          do; //attempt at trying to make this @#$#!!!! thing loop
^
C:\java\diceroller\RollingDice\OnlineDice2.java:26: <identifier> expected
          do; //attempt at trying to make this @#$#!!!! thing loop
^
C:\java\diceroller\RollingDice\OnlineDice2.java:28: illegal start of expression
          public void actionPerformed (ActionEvent e)
^
C:\java\diceroller\RollingDice\OnlineDice2.java:6: class OnlineDice is public, should be declared in a file named OnlineDice.java
public class OnlineDice extends Applet implements ActionListener

Similar Messages

  • JTable Refreshing problem for continuous data from socket

    Hi there,
    I am facing table refreshing problem. My table is filled with the data received from socket . The socket is receiving live data continuously. When ever data received by client socket, it notify table model to parse and refresh the data on specific row. The logic is working fine and data is refresh some time twice or some thrice, but then it seem like java table GUI is not refreshing. The data on client socket is continuously receiving but there is no refresh on table. I am confident on logic just because when ever I stop sending data from server, then client GUI refreshing it self with the data it received previous and buffered it.
    I have applied all the available solutions:
    i.e.
         - Used DefaultTableModel Class.
         - Created my own custem model class extend by AbstractTableModel.
         - Used SwingUtilities invokeLater and invokeAndWait methods.
         - Yield Stream Reader thread so, that GUI get time to refresh.
    Please if any one has any idea/solution for this issue, help me out.
    Here is the code.
    Custom Data Model Class
    package clients.tcp;
    import java.util.*;
    import javax.swing.table.*;
    import javax.swing.*;
    public class CustomModel extends DefaultTableModel implements Observer {
    /** Creates a new instance of CustomModel */
    public CustomModel() {
    //super(columnNames,25);
    String[] columnNames = {"Sno.","Symbol","BVol","Buy","Sale",
    "SVol","Last","..","...","Total Vol...",
    "..","High","..","Low","Change","Average","..."};
    super.setColumnIdentifiers(columnNames);
    super.setRowCount(25);
    /*This method called by client socket when ever it recived data as line/record*/
    public synchronized void update(Observable o, Object arg){
    collectData(arg.toString());
    /*This method used to parse, collect and notify table for new data arrival*/
    public synchronized void collectData(String rec){              
    String validSymbol="";
    System.out.println("collectDataRecord :-"+rec);
    StringTokenizer recToken=new StringTokenizer(rec," ");
    Vector rowVector=new Vector();
    for(int i=0;i<25;i++){
    validSymbol=(String)getValueAt(0,1);
    if(rec.indexOf(validSymbol) != -1){
    for(int j=0;recToken.hasMoreTokens();j++){
    super.setValueAt(recToken.nextToken(),i,j);
    //break;
    Client Socket Class
    package clients.tcp;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    public class DataReceiver extends Observable implements Runnable{
    private Socket TCPConnection = null;
    private BufferedReader br = null;
    private String serverName = "Salahuddin";
    private int serverPort = 5555;
    public DataReceiver()
    public void setServerName(String name){
    this.serverName=name;
    public void setServerPort(int port){
    this.serverPort=port;
    //03-20-04 12:30pm Method to open TCP/IP connection
    public void openTCPConnection()
    try
    TCPConnection = new Socket(serverName, serverPort);
    br = new BufferedReader(new InputStreamReader(
    TCPConnection.getInputStream()));           
    System.out.println("Connection open now....");
    //System.out.println("value is: "+br.readLine());
    }catch (UnknownHostException e){
    System.err.println("Don't know about host: ");
    }catch (IOException e){
    System.err.println("Couldn't get I/O for "
    + "the connection to: ");
    //03-20-04 12:30pm Method to receive the records
    public String receiveData(){
    String rec = null;
    try
    rec = br.readLine();          
    catch(IOException ioe)
    System.out.println("Error is: "+ioe);
    ioe.printStackTrace(System.out);
    catch(Exception ex)
    System.out.println("Exception is: "+ex);
    ex.printStackTrace(System.out);
    return rec;     
    public void run()
    while(true)
    String str=null;
    str = receiveData();
    if(str != null)
    /*try{
    final String finalstr=str;
    Runnable updateTables = new Runnable() {
    public void run() { */
    notifyAllObservers(str);
    SwingUtilities.invokeAndWait(updateTables);
    }catch(Exception ex){
    ex.printStackTrace(System.out);
    System.out.println("Observer Notified...");*/
    try{
    Thread.sleep(200);
    }catch(Exception e){
    public synchronized void notifyAllObservers(String str){
    try{
    setChanged();
    notifyObservers(str);
    }catch(Exception e){
    e.printStackTrace(System.out);
    Regards,
    Salahuddin Munshi.

    use your code to post codes more easy to read, lyke this:
    package clients.tcp;
    import java.util.*;
    import javax.swing.table.*;
    import javax.swing.*;
    public class CustomModel extends DefaultTableModel implements Observer {
    /** Creates a new instance of CustomModel */
    public CustomModel() {
    //super(columnNames,25);
    String[] columnNames = {"Sno.","Symbol","BVol","Buy","Sale",
    "SVol","Last","..","...","Total Vol...",
    "..","High","..","Low","Change","Average","..."};
    super.setColumnIdentifiers(columnNames);
    super.setRowCount(25);
    /*This method called by client socket when ever it recived data as line/record*/
    public synchronized void update(Observable o, Object arg){
    collectData(arg.toString());
    /*This method used to parse, collect and notify table for new data arrival*/
    public synchronized void collectData(String rec){
    String validSymbol="";
    System.out.println("collectDataRecord :-"+rec);
    StringTokenizer recToken=new StringTokenizer(rec," ");
    Vector rowVector=new Vector();
    for(int i=0;i<25;i++){
    validSymbol=(String)getValueAt(0,1);
    if(rec.indexOf(validSymbol) != -1){
    for(int j=0;recToken.hasMoreTokens();j++){
    super.setValueAt(recToken.nextToken(),i,j);
    //break;
    Client Socket Class

  • UWL refresh problem for ABAP BOR custom attributes

    Hi all,
    we are facing an issue with an UWL iView. We wanted to display custom attributes from an ABAP Business Object (ABAP_BOR).
    The feature is working but when an end-user receives a new task in his UWL view, he needs to click on the refresh button in order to have all the custom attributes correctly displayed.
    We have only the problem with custom attributes, for the columns containing standard workflow decision task attributes, the data are displayed directly without the need to push the refresh button.
    We are on EP 7 SPS11 and the back-end is an ECC6 version.
    We have followed the methodology described in the How to configure and customize the Universal Worklist pdf document:
    ABAP BOR
    <CustomAttributeSource id="ABAP_BOR"
    objectIdHolder="externalObjectId"
    objectType="FORMABSENC"
    cacheValidity="final">
    <Attribute name="COSTCENTER" type="string"
    displayName="Cost Center"></Attribute>
    <Attribute name="FIRSTDAYOFABSENCE" type="date"
    displayName="First day of absence"></Attribute>
    <Attribute name="LASTDAYOFABSENCE" type="date"
    displayName="Last day of absence"></Attribute>
    </CustomAttributeSource>
    Do you have an idea where this problem come from and how it could be solved?
    Thanks in advance and regards,
    Sébastien BODSON

    Hi Chintan,
    This parameter has no impact on the problem we face. I found an exact description of our problem on SAP Help portal, in the UWL pages:
    CustomAttributes, CustomAttributeSource and Attribute
    Extract from SAP Help portal:
    Every item type can have custom attributes defined, which can be filled from Business Object or Provider Data Containers like the Business Workflow Container or the Alert Container. These attribute sources are defined within the CustomAttributeSourcetag, which contains information on which attribute connector brings the custom attributes, how to identify these custom attributes in the provider system and how long the cache is valid.
    Note that once an item arrives, these custom attributes are retrieved in additional calls to the backend. For performance reasons, in order to minimize responses times to the end user, this may happen while the item is displayed to the end user - causing such attributes to be empty initially and only to appear in subsequent requests.
    The display names of the attributes for column headers and labels are defined in the display attributes of the default view of the item type.
    Does anyone know a workaround in order to have directly the complete information displayed?
    Sébastien BODSON

  • ALV grid Refresh problem  for one user

    Have an ALV with editable columns. Validation and save works for all columns for one user but not for the other. The user with the issue is able to modify the values and save to the database fine.The problem is it doesn't display in the ALV once refreshed. Please suggest any ideas of how to look into this issue as it works for one and not other user.

    Strange work for one user not for other.
    Once you save the data, rebind the data to table. so that new data will display. ( that use set_initial_elements as true, so that old values not display ).
    Regards
    Srinivas

  • Divx 1.4 problems for movies online

    I recently bought a macbook pro and I like to watch movies at icefilms online. It needs the older version of Divx but when I try to install it I can't? It says it is installed but I don't actually have the application.
    I am new to mac. Is there another program I need to be able to actually install Divx? I am able to install the new version of Divx but I need the 1.4 for mac.

    Uninstalling DIVX on Mac OS
    To completely uninstall DWP 2.0 on Mac
    1) Delete /Library/Internet Plug-Ins/DivXBrowserPlugin.plugin
    2) Delete /Library/Internet Plug-Ins/npdivx.xpt
    3) Delete Movies/DivX Movies/Temporary Downloaded Files under your home folder
    4) Delete Preferences/ByHost com.divx.DivXBrowserPlugin..plist from under your home folder
    After following these steps, you should be able to install version 1.4 from the link above with no problems.
    here u get the old version of Divx 1.4
    http://labs.divx.com/node/14970
    or direkt download link:
    http://download.divx.com/divx/oldversions/DivXWebPlayerMacv14.dmg
    Dirk

  • Refresh problem for swf website

    I have a web site which is swf movies based on html.
    to be refreshed (the swfs) every time I re-ender it(not
    every 10 or 20 seconds). Think of it like a news site which needs
    to be refreshed constantly to keep up to date. What coding should I
    use?Should it be on the html page or in the swf?
    It loads the swf from the cashe of the browser even when I
    have made changes to the server files.
    Please I need some help
    Thanks

    Do you mean that the 'news' or 'updates' are actually made to
    the swf file itself?
    That would be unusual for a data driven site although its not
    impossible. There's even a reasonably 'new' data exchange format
    based on a simplified swf format that is used for loading data. But
    it doesn't sound like that's what you're doing.. it seems like you
    want to reload the original swf itself. I hope thats via some CMS
    or something that's generating the swf files. Its seems impractical
    for a 'news' type site otherwise.
    Either way I imagine you can reload the swf into the _root
    level. You might need to use the same type of anti-cacheing
    approach as before.
    _root.loadMovie("sameSwf.swf?dontCache="+getTimer());
    How often you do that... well that would depend on how often
    you think it would change. AFAIK there's no way to know if the file
    on the server has physically changed without polling the server
    separately e.g. via LoadVars .

  • How do i fix 'error; texture load failure' problems for an online game?

    i play chaoticgame.com online. it currently has no admin staff to help. the problem is that the website pages do not fully load. there is a function i can access that shows me all the errors im getting, most are- error; texture load failure and error; failed downloading....
    this is a recent problem. also if i access the website via iphone using wifi from my home connection i get the same errors, so i dont know if this is a interent connection problem because ive had no other problems with websites.
    i believe it has something to do with texture memory?

    Hi Lorne.V.,
    How exactly are you installing NI DAQmx on the target machines?  Even if you include the DAQmx merge module in your build, you will still need to install DAQmx on the target machine separately. 
    Can you also confirm that the DAQmx.dll is installed in the same directory on both the development and deployment machines?  And that you have the same version of DAQmx on both machines?
    Regards,
    Lindsey W. | Applications Engineer | National Instruments

  • For last one month I am facing problem in watching online videos on my iPod touch. It is opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

    For last one month I am facing problem in watching online videos on my iPod touch. It is opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

    For last one month I am facing problem in watching online videos on my iPod touch. It is not opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

  • Audio problems for online videos played with HDMI hookup

    I have a pavilion dv4 1155se notebook with vista os, and i have been having some sound problems when i hook my computer up to my hdtv. my knowledge about computers is fairly limited so bear with me please. whenever i hook my notebook up to my tv (using hdmi) to play online videos the sound will only come out of the speakers on my laptop, not the tv. the sound comes through the tv's speakers for everything else (music, games, etc) and it used to work for the online videos but the last couple times i've hooked my laptop up the sound only comes out of the notebooks speakers. the digital output device is enabled like it should be, it's just this one thing that is not working right. if anyone could help me out with this i would really appreciate it.

    Re-export the .mov using QT Pro's iPod preset. If you song is in there, it will play. Make sure that 'Make Self Contained' is checked.

  • Hi all, I upgraded my MBP to Lion , but on the screen where i need to type my password, click  on my photo and it does not appear the place for me to type my password and it stay stuck there. Can anyone solve this problem for me?

    Hi all, I upgraded my MBP to Lion , but on the screen where i need to type my password, click  on my photo and it does not appear the place for me to type my password and it stay stuck there. Can anyone solve this problem for me?

    Reboot the machine holding Command and r keys down, you'll boot into Lion Recovery Partition
    In there will be Disk Utility, use that to select your Lion OS X Partition and Repair Permissions.
    After that is done reboot the machine and see if you can log in.
    If not repeat the above steps to get into Lion Recovery, get online and reinstall Lion again, it will overwrite the installed version and hopefully after that it wil work.
    Reboot and try again.
    If not follow my steps to create a Snow Leopard Data Recovery drive, then option boot from it and grab a copy of your files off the machine.
    Then reinstall all your programs onto the external drive like setting up a new machine, then use Disk Utility to erase the entire internal boot drive (select the drive media on the far left, not the partiton slightly indented) format Option: GUID , 1 partition OS X Extended and then use Carbon Copy Cloner to clone the external to the newly formatted internal drive. Once that is finished reboot and disconnect the external drive.
    Once you go that, boot into Snow Leopard and update to 10.6.8, use the AppStore and option click on Purchases and download Lion again and install.
    Lots of work, but there is no Lion disks.
    https://discussions.apple.com/message/16276201#16276201

  • I have been using Elements 12 without a problem for 9 months.  Now when I try to open the program, I get an error message  "Adobe Photoshop Elements 12 quit unexpectedly" and it will not open at all.  What can I do to open the program?

    I have been using Elements 12 without a problem for 9 months.  Now when I try to open the program, I get an error message  "Adobe Photoshop Elements 12 quit unexpectedly" and it will not open at all.  What can I do to open the program?

    Thank you for responding.  Nothing actually worked!  After reading the posts online, I called Apple.  They indicated they have seen problems with some software after their upgrades.  The technician was able to fix the problem on my computer remotely, but I have no clue what he did!  But, it was definitely related to their recent upgrade to my computer.

  • Smartview 11.1.2.1.102 Refresh problems

    I have multiple users experiencing severe refresh problems after upgrading to smartview version 11.1.2.1.102.
    Users state Refresh is taking 10-15mins+ when in old version 9x it only takes 1-2mins. In addition users have rebuilt the excel files (copy in new workbook) then all is working fine but when saved/the next day the refresh goes very slow again!
    Please can any help?

    1. Deleting the Sheet Info fixes the problem for the moment - but the problem soon returns. Do you know what causes the problem, so we can cut the repeating cycle? Is this strictly a multi-user issue? We do have several users that may use the file. Some have version 11.1.2.1.000 (not 103). Oracle's tips doc (http://www.oracle.com/technetwork/middleware/bi-foundation/epm-tips-issues-73-102-1612164.pdf) mentions uncompressed metadata stored in the worksheet.
    2. Is there a specific version that allows the Sheet Info fix? Oracle's tip sheet says they need Some have version 11.1.2.1.103, but the users we have seen so far can use this workaround on Some have version 11.1.2.1.000. I'd like to know when at what version this fix starts so I can push other users to update. It would be good to know at which version this issue starts.
    Thank you - great information in the thread!
    P.S. for reference:
    From http://www.oracle.com/technetwork/middleware/bi-foundation/epm-tips-issues-73-102-1612164.pdf
    In EPM System Release 11.1.2.1, I am opening .xls files with Smart View functions in Excel 2010, but it’s very slow or seems to freeze Excel. How can I fix this?
    This is most likely due to an issue with uncompressed metadata stored in the workbook. In most cases, the issue can be found in the first sheet in hidden shapes. Note that the file will open but it may take a very long time, and in some cases the file will open fine with Smart View disabled. In other cases it will not matter. To solve this problem, save a copy of the file and follow the steps below for the version of Smart View you have.
    If you are using Smart View 11.1.2.1.103 or above, follow these steps:
    1 Open the file (this may take a while) with Smart View enabled.
    2 From the Smart View Ribbon, select Sheet Info.
    3 Select Delete Smart View Info.
    4 Select Workbook and all Sheet Info.
    174 Miscellaneous and Product-Specific Tips
    5 Click OK.
    6 Save the modified workbook.
    7 Reopen the workbook.
    If you are not using Smart View 11.1.2.1.103 or above, follow these steps:
    1 Open the file (this may take a while).
    2 Right-click on the tab of the first worksheet and select Select All Sheets.
    3 Right-click on the tab of the first worksheet and select Move or Copy.
    4 In the drop-down box, select (new book) and check Create a Copy.
    5 Save the workbook.
    6 Open the new workbook.
    7 Refresh the data.

  • The underlying connection was closed: An unexpected error occurred on a receive..Exception.Message - while executing powershell command for sharepoint online site

    " +The underlying connection was closed: An unexpected error occurred on a receive..Exception.Message " OR sometimes
    "The remote server returned an error: (503) Server Unavailable..Exception.Message"
    Getting exception above when performing various operation (site coll creating, group creation, adding users to group) for sharepoint online (Office 365) site using powershell script.
    I want to create 3500 site collections using PS script. In-between getting above exception so it will skip one site collection creating and working again. for eg. after creating 11 site coll, script will through above exception and so 12th site coll will
    not be create but working fine from 13 and so on...

    Remote server seems working to me...any additional check?
    if problem with remote server then may be loop to create site provisioning should not start again..Right?
    any idea?

  • TS1811 Hi!! I am a user of i Pod 5g 32GB....I got the same problem for which the solution is given above....but the thing is that.......in my laptop I have a windows operating system....that is windows 7....so can you explain how to do settings in Windows

    Hi!! I am a user of i Pod 5g 32GB....I got the same problem for which the solution is given above  "
    iTunes for Mac reports error -50 when trying to authorize iTunes Store purchases
    "....but the thing is that.......in my laptop I have a windows operating system....that is windows 7....so can you explain how to do settings in Windows 4 same

    Archived - iTunes for Mac reports error -50 when trying to authorize iTunes Store purchases
    Products Affected
    iTunes 7 for Mac, iTunes 8 for Mac, iTunes 9 for Mac
    This article has been archived and is no longer updated by Apple. 
    Symptoms
    After installing the Mac OS X 10.4.9 Update, iTunes may be unable to properly authorize your computer to play your iTunes Store purchases.
    Resolution
    The following steps will delete your network preferences. Most broadband connections do not require any special settings to connect, but if your connection does or if you are not sure, please contact your ISP or network administrator for further assistance.
    Important: You must be logged in as an Administrator.
    Click the Finder icon in the Dock.
    Choose Go to Folder from the Go menu.
    Type /Library/Preferences/SystemConfiguration
    Click Go.
    In the Finder window, locate the file named NetworkInterfaces.plist.
    Drag this file to the Trash.
    Restart the computer.
    Once your computer has restarted. You will not be able to connect to the Internet. Now you will need to refresh your network settings to be able to connect again.
    Choose System Preferences from the Apple menu.
    Choose Network from the View menu.
    To refresh your network settings, from the Location pop-up menu, choose New Location.
    Type a name for your location and click OK.
    Click the Apply Now at the bottom right to accept the changes.
    If your network connection requires any special settings, you will need to put them back in at this point. Once you have made these changes you should be able to connect to the Internet again and authorize your computer to play your iTunes Store purchases.

  • Screen refresh problem where data is entered and the screen doesn't refresh

    Many people in the company are experiencing the odd screen refresh problem where data is entered and the screen doesn't refresh to show the updated result in corresponding cell formulas.
    Microsoft have issued a hotfix to fix the issue for Excel 2003 as shown. Microsoft released a hotfix for this problem (<a href="advisory?ID=978908">KB978908</a>). Display memory tends to pick up data from hidden sheets and pastes it
    into the active screen. No impact on the file. This occurs when protecting and unprotecting worksheets in VBA. I also suspect that enabling and disabling screen refresh contributes to this problem. In any case there is a fix, albeit with the following disclaimer:
    As of yet I have not been able to find a fix for this for office 2010 and 2013, Any suggestions would be great.

    Hi,
    Based on your description, Excel does not show the text strings when you typing. It may be caused by the cell format, if we set the cell format as ";;;" in custom format, it will not display the text that you typed. 
    And the issue may be caused by the third-party input method, there are some compatibility issue between them.
    If the issue still exits, please try the following methods
    Verify/install the latest updates
    Repair your Office program
    Regards,
    George Zhao
    TechNet Community Support

Maybe you are looking for

  • Creative, if you can't help me or let me know if I should buy elsewhe

    OK after having my last thread Hijacked by someone else and my problem going unheard, I need to know if I should rip out your soundcard and buy somewhere else or if there is hope that maybe this can be fixed. http://forums.creative.com/creativel...es

  • Bug Report & New Release

    HI, I'd want to know where can I signal a bug of BIBeans (should I open a Tar?...How can I do it?) and if is going to come out a new release of BIBeans.. Thank you very much in advance Antonio

  • Need help with local authentication - WLAN 2100

    Hello, Please be gentle, I am not an experienced Cisco user.  My organisation has inherited a Cisco 2100 WLAN controller as a couple of Aironet 1130 access points.  I have been able to get a basic configuration into the 2100, as well as the access po

  • Outbound delivery printout issue.

    Hi all, Onreleasing an outbound delivery, Output form should be sent to Print Queues, without any manual intervention. it will Possible in system? Regards RK

  • Smoothing of 3D object and render noise

    Why is my object so blocky? How can I smooth that visible polygons? I'm not a 3D modeler, I just want to draw textures on smooth model. Also when I press render, final result is very noisy. Why? Please, look at screen-shot. Thanks for any suggestions