One thread starts one does not

hello
still i'm learning threads.
i've got an applet "pingpong".
there are two threads
1. pingThread pt
2. Thread sammelThread
pingthread makes some int-values
sammelThread collects them and repaints the applet.
i've got 2 problems:
1. -- sammelthread does not start
2. -- if paint() gets the right value, (see commented line in paint())it does not repaint the rectangle
the source:
public class pingThread extends Thread{
     private int hoehe = 10;
     private boolean up = true;
     public void run(){
                        while(true){
                                if (isInterrupted()){
                                        break;
                                }//if
                                if (up){
                                        hoehe = hoehe +10;
                                        if (hoehe == 200){
                                                up = false;
                                        }//if
                                }else{
                                        hoehe = hoehe -10;
                                        if (hoehe == 10){
                                                up = true;
                                        }//if
                                }//if-else
                                System.out.println("hoehe/up: " + hoehe + ", " +up);
                                try {
                                        Thread.sleep(400);
                                } catch (InterruptedException e) {
                                        interrupt();
                        }//while
                }//run
                public int gethoehe(){
                        System.out.println(" und nun :  gethoehe() = " +hoehe);
                        return hoehe;
}//class
import java.awt.*;
import java.awt.event.*;
import java.awt.Graphics;
public class pingpong extends java.applet.Applet implements Runnable, ActionListener{
        Button btn;
        pingThread pit = new pingThread();
        Thread sammelThread;
        int pinghoehe;
        public void init() {
                setLayout (new FlowLayout() );
                btn = new Button("Stop");
                btn.addActionListener(this);
                add(btn);
                setVisible(true);
                pit.start();
                repaint();
        }//init()
        public void actionPerformed(ActionEvent event){
        Object obj = event.getSource();
                if (obj == btn){
                        System.out.println("Button : Stop");
                        pit.interrupt();
        }// actionPerformed
        public void paint(Graphics g){
                 //zum testen:
                 //pinghoehe = pit.gethoehe();
                System.out.println("paint - pinghoehe = " +pinghoehe);
                g.fillRect(10,pinghoehe, 5, 5);
        public void start(){
                System.out.println("pingpong - start");
                if (sammelThread == null){
                        sammelThread = new Thread();
                        System.out.println("pingpong - start -start");
                        sammelThread.start();
        }//start
        public void stop(){
                if (sammelThread != null) {
                        sammelThread = null;
        }//stop
        public void run(){
                System.out.println("sammelthread.run()");
                while(true){
                        pinghoehe = pit.gethoehe();
                        System.out.println("sammelthread - pinghoehe = " +pinghoehe);
                        repaint();
                }//while
        }//run
} //pong()

With
sammelThread = new Thread();
sammelThread.start();
you are creating a new Thread, which will do nothing.
If you want to call the run-method of your own Runnable "pingpong" (better with uppercase "Pingpong", because it's a classname!), you have to write:
sammelThread = new Thread(this);
sammelThread.start();
The method start of sammelThread will call the run-method of the Runnable this (pingpong).

Similar Messages

  • Asking the Bridge Team:  Bridge "working color space" setting when one does not have the Suite?

    Common sense tells me there is really no such thing as a
    "working color space" in Bridge, because
    Bridge is not an image editor, just a browser
    Therefore, this may turn out to be a purely academic question; but that doesn't keep my curiosity from forcing me to ask it anyway. ;)
    Is there a way to set the Bridge
    "color settings" when one does not have the suite?
    The only Adobe program I keep up to date is Photoshop, so I've never had the suite. My version of Photoshop is 11 (CS4) and I run updated
    (not upgraded) versions of Adobe Acrobat 7.x, Illustrator 10.x and InDesign 2.x. Consequently, the Synchronize color settings command is not available to me.
    It seems to me that Bridge is behaving like a proper color-managed browser (e.g. Firefox with color management enabled), in that it displays tagged image files correctly and assumes sRGB for untagged image files. This normally works fine.
    But what if I wanted Bridge to assume my
    Photoshop color working space for untagged images
    so that it behaves the same as Photoshop? I'm just curious, as I deal with a minuscule, practically negligible amount of untagged files.
    My reason for bringing it up now is that I don't recall this being explicitly mentioned in forum replies when users inquire about color settings in Bridge. A recent post regarding Version Cue in the Photoshop Macintosh forum got me thinking about this. Just wanting to make sure that I'm right in my assumption that
    there is really no such thing as a
    "working color space" in Bridge, because Bridge is not an image editor, just a browser.
    Thanks in advance.

    Hi Ramón,
    Thanks for sharing the outcome of your tests. However, I may have found a bug/exception to Bridge's colour management policy!
    It appears that CMYK EPS photoshop files are not colour managed in Adobe Bridge, even if they contain an embedded ICC profile.
    I've tried every combination in the EPS 'Save As' dialogue box, so it doesn't seem to be an issue with file encoding. Also, Bridge doesn't rely on the low-res preview that is held within the EPS itself.
    My guess is that Bridge is previewing the CMYK EPS with a Bridge-generated RGB image, but it's being displayed as monitor RGB (assigned) rather than colour managed (converted to monitor RGB). For most users the difference will be barely perceptible, but the problem became very noticeable when using Bridge to preview Newsprint CMYK images on a wide-gamut monitor (images that should have appeared muted really leapt off the screen!).
    How do I report this to the Colour Police at Adobe?!?

  • Cannot find anyplace to tell a page to wrap within browser margins, so one does not have to slide it back and forth to read each line.

    Cannot find anyplace to tell a page to wrap within browser margins, so one does not have to slide it back and forth to read each line::::::::::::
    Yes, there are so many pages on-line that -- when made small enough to fit within the margins so one does no have to use a scroll bar on EVERY line, moving it back and forth, back and forth -- look like a FINE-print Bible page (!! tiny !!) if you keep reducing it to fit within the margins.
    ALL because we cannot find a place to tell it to WRAP to FIT. Could have sworn I've seen some feature like that somewhere at one time, but if it is here, I cannot find it.
    Thank you.
    gina

    Maybe use a style.
    Add code to userContent.css
    * http://kb.mozillazine.org/userContent.css
    <pre><nowiki>body, body *{ white-space:pre-wrap!important; word-wrap:break-word; }
    </nowiki></pre>
    You can use the ChromEdit Plus or Stylish extension to have easier access to the customization files.
    * ChromEdit Plus: http://webdesigns.ms11.net/chromeditp.html
    * http://kb.mozillazine.org/Editing_configuration

  • Installed HP Officejet 4100 All-in-one does not appear in Control Panel printer selection window.

    My HP Officejet 4100 Series 'All-in One' DOES NOT APPEAR in the Control Panel window even after several re-installs. The diagnostics indicate that the 4100 is not connected and dos NOT point to any path for a solution.
    Attempts to download a current Driver, ( or re-load the 4100 "software" ), WILL NOT work because the 'help' page states the driver already comes with the 4100 software and therefore does not provide for any download update, (driver or software) for the 4100 printer.
    I have reinstalled from the original Disk for the 4100 and also attemped install with Windows Update requested driver. Nothing works.

    Hi there @Past77 
    Welcome to the forums
    I read your message about your Officejet 4100 not showing that it's connected, and that you have attempted to run the Windows Update to see if that would help get the printer working again. You are correct that this model does not have a downloadable driver for Windows Vista, so your best bet would be to try running the Print and Scan Doctor tool, to see if it can kick the printer into gear and have it functioning again.
    If the tool does not work, I would then recommend looking in to a printer upgrade. Consider giving us a call to see what your options are with HP.
    Please call our technical support at 800-474-6836. If you live outside the US/Canada Region, please click the link below to get the support number for your region. http://www8.hp.com/us/en/contact-hp/ww-phone-assist.html
    Best wishes to you,
    R a i n b o w 7000I work on behalf of HP
    Click the “Kudos Thumbs Up" at the bottom of this post to say
    “Thanks” for helping!
    Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution!

  • 2 MP4 Videos one plays one does not

    I have two MP4 Videos one playes and one does not. Both are h.264 Baseline profile,  Level 3,  AAC 2 channel audio
    Every transcode of the movie that will not play fails also. Any help on h.264 setting that Media Manager will take.

    I have two MP4 Videos one playes and one does not. Both are h.264 Baseline profile,  Level 3,  AAC 2 channel audio
    Every transcode of the movie that will not play fails also. Any help on h.264 setting that Media Manager will take.

  • I have lost the remote that was paired. I bought another remote, but the procedure to pair the new one does not work. I suspect the the AT will work with only one remote at-a-time and i have to unpaid the first before pairing the second. How do I unpair?

    I have lost the remote that was paired. I bought another remote, but the procedure to pair the new one does not work. I suspect the the AT will work with only one remote at-a-time and i have to unpair the first before pairing the second. If this is true, how do I unpair? If not, what can I do?

    I was premature in posting the question. I found the answer in andother posting, and it was successful.
    Thanks, and sorry for the false alarm.

  • Iphone Webclips Icon Problem (One works, one does not)

    I have two websites with two different hosts. One is Teamkong.net and the webclip I created works fine. The other one is d2football.com and the webclip does not work. I did them the same, put them in the same place and one works and the other one does not. Has to be a server setting or something, right? Suggestions are appreciated.
    Here is the instructions I followed do the process:
    http://vjarmy.com/archives/2008/01/h...clip_icons.php

    that link doesn't work, so cannot really tell you.
    But can say this you should have a reference to it in page and not rely on it just finding it by name as icons such as it and favicons for browsers, rely on finding them at the root...and your provider may be giving you a URL that makes it look like you are at your own root, but in reality you are on a shared server with other sites all subsites off a real root thus cannot be found.
    So add a reference to it to your pages like this
    <link rel="apple-touch-icon" href="/traffic.png"/>
    Add that to your head section and replace the name of the file.
    Can see it working at one of my simple webapps for traffic cameras where I live at http://vcreations.net/traffic/
    Doing it at the page level also allows you to control a bit more each page if you want.

  • I have two ipod nanos.  And i have 2 itunes accounts and we are accessing both accounts from the same PC.  One of my ipod works fine, it gets detected as a device and sync fine.  The other one does not.  Need help.

    I have two ipod nanos.  And i have 2 itunes accounts and we are accessing both accounts from the same PC.  One of my ipod works fine, it gets detected as a device and sync fine.  The other one does not.  Anyone knows what this may be?

    The music sync is one way - computer to ipod.  The only exception is ituens purchases.  The ipod is not a backup device.
    Copy everything from the old computer or your backup copy of your old computer, to the new one.

  • My HP LaserJet 3055 All In One does not scan using Windows 7 - 64bit.

    My HP LaserJet 3055 All In One does not scan using Windows 7 - 64bit. I can copy and print only. Thanks.
    This question was solved.
    View Solution.

    Hi,
    Is the printer connected to your PC by USB or network?
    By using USB connection, you may scan using the Windows Fax and Scan software integrated into your OS.
    Scanning through a network connection unfortunately supported on Windows7 32 bit only, as you  may find listed within the About network scanning section below:
    http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?&objectID=c02539136#A2
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • When I plug in my iPhone to sync, it starts but does not complete the process and several pieces of data are not being transferred to my iPhone from my MacBook Air.

    Problem:
    When I plug in my iPhone to sync, it starts but does not complete the process and several pieces of data are not being transferred to my iPhone from my MacBook Air.
    Any help that you can provide in helping my iPhone accurately sync with iPhoto and iTunes will be greatly appreciated.
    Symptoms:
    1)   Sync:  It’s not completing the sync.  Below, I’ve provided all of my settings from the iTunes Summary tab so that you might tell me if I’ve selected any incorrect options.  I prefer to sync the “old school” way – by connecting to the computer – as opposed to syncing over the cloud. Perhaps this is what’s causing the problem? Here is a list of the steps displayed in the iTunes window as the sync progresses:
    waiting for sync to start (step 1 of 7)
    backing up (step 2 of 7)
    preparing to sync (step 3 of 7)
    determining apps to sync (step 4 of 7)
    preparing apps to sync (step 5 of 7)
    importing photos (step 6 of 7)
    waiting for changes to be applied (step 7 of 7)
    syncing apps / copying 1 of 4 (App name) (step 7 of 7)
    canceling sync
    apple icon
    2)   Photos: I've selected only certain of my iPhoto albums to sync to my iPhone.  All of the albums are correct/complete in iPhoto.  All of the albums are listed on my iPhone, both before and after the sync, but the albums are empty (no actual photos) before and after the sync. Perhaps this is tied to the fact that the sync isn’t completing, but because “importing photos” is one of the steps that the incomplete sync displays, I don’t know.
    3)   Apps: When I launch iTunes and click on the Apps folder under the Library listing, then click on the Updates tab, iTunes searches for any Apps needing to be updated and provides a list.  If I click on Update All, the Apps are successfully updated in iTunes.  But, when I plug in my iPhone so that the updates will transfer to the apps on my iPhone, the updates don’t transfer to the apps on my iPhone and those apps still reflect that they need updating on the iPhone.
    Other Potential Pertinent Info:
    The flash memory hard drive on my MacBook Air recently died (perhaps a month or two ago).  Apple had emailed me about a known issue and literally the next day, my MacBook Air crashed.  I installed a new flash memory drive and re-installed everything from a backup off of an external hard drive.  Everything seems to be working fine; it recreated accurately all of my software and data, including iPhoto and iTunes, the pictures and songs (respectively) for which are stored on that hard drive, as opposed to being on the flash memory in the MacBook Air itself.  However, I don’t recall if the start of the sync problem described herein started happening at the same time that I replaced the flash memory drive.  All I know is that the computer is working perfectly in all respects and that even as the sync is failing, it at least says that it’s doing the right things and looking in the right places (e.g., the list of albums on my iPhone matches the list of albums in iTunes, etc.).
    Settings/Status:
    MacBook Air
    OSX v. 10.9
    iPhoto ’11 v. 9.5 (902.7)
    iPhone iOS 7.0.4
    iTunes v. 11.1.3 (8)
    Summary Tab
    Backups (This Computer)
    Options
    Automatically sync when this iPhone is connected
    Sync only checked songs and videos
    Photos Tab
    Sync Photos from iPhoto (429 Photos)
    Selected albums, Events, and Faces, and automatically include (no Events)
    Albums – 9 are selected

    You need to download iTunes on your computer. iOS 6 requires the latest version of iTunes which is 10.7.

  • I have a new Macbook pro, about 2 months old, and at times running video, the fans starts and does not stop. how do you get it to stop.

    I have a new Macbookbook, about 2 months old, and at times running video, the fans starts and does not stop. how do you get it to stop. Also i am thinking once the video is done  the fan should be slowing down and getting quiet on its own.

    Your fan(s) will run at high speed (i.e., loudly) while video is playing, and you can't get around that.
    If your fans are not slowing down within 2-4 minutes after CPU- and/or GPU-intensive usage ends, and the application that was showing the video is still running, Quit that application. (In fact, if you're accustomed to Windows, you may not realize that simply closing a Mac application's window does not quit the application. You still need to use the Quit command in the application-name menu. There will always be a bright dot beside or below the application icon in your Dock for each application that is open.) Quit the ones you aren't using, and see whether that allows the fans to slow down without restarting the machine. If that doesn't do the trick, reset the SMC:
    http://support.apple.com/kb/HT3964?viewlocale=en_US&locale=en_US

  • After installing or upgrading to Firefox 31, starting Firefox does not show homepage, customize shows a blank page and the option button does not work

    I am the Windows admin for a university department and install PCs with Firefox all the time. This problem does not happen with every PC I maintain, only a select few (different model laptops with Windows 8.1 and update 1.) Until today, it only happened with new user accounts (with admin rights) that I setup on the laptops for our staff. Today this happened with The Administrator account while setting up a new laptop. In all cases so far, I install Windows from a saved image that was created using sysprep.
    I have tried the many suggestions of resetting Firefox, deleting the users Firefox profile, deleting the users Windows profile, uninstalling/reinstalling Firefox, uninstalling/reinstalling Firefox and the latest Java, but nothing helps. After uninstalling, I run an app to delete temp files and caches and will even manually remove registry keys HKLM\SOFTWARE\Mozilla and HKCU\SOFTWARE\Mozilla. Plus I reboot and make sure the install folder is deleted after uninstall.
    Results are the same: after installing Firefox 31, the initial setup window for migrating IE and/or Chrome pops up and after clicking the Finish button, Firefox starts, but does not show the initial new user page, only a blank page. Clicking on the Options button (3 bars) does nothing. Right-clicking in the proper area, the popup menu appears so I can choose to Customize, but that only opens another tab with about:customize in the URL and the page is blank. From the right-click popup menu, I can enable the Menu Bar and get to Options from that.
    My latest attempt has helped a little. I uninstalled Firefox 31, cleaned up, deleted user Firefox profile, rebooted and then installed Firefox 30. Inital startup runs, and tells me I'm not up to date, and the Options button works. But I still cannot customize.
    I then upgraded to Firefox 31, but then it's back to no startup page, no options button and no customize. I can downgrade to 30 and get all but customize working again.
    Only Addon is one for McAfee Scriptscan for Firefox 15.1.0, which just after installing is disabled.
    Any help would be appreciated. Thank you.

    Ok. I disabled hardware acceleration. The only extension is the McAfee Scriptscan for Firefox 15.1.0, which was already disabled. I then disabled all plugins (Acrobat, Google Update, Intel Identity Protection (2x), Java Deployment Toolkit, Java Platform, MS Office 2013, Quicktime, Shockwave, Silverlight), which were all up to date.
    Normal or safe mode still has same result. No startup, no option button and no customize.
    Thanks for your help. Got any other suggestions?

  • Premiere elements 12, new installation, serial no. accepted, installation completed and new started, but does not run. I get following msg-box: "LoadLibrary failed with error 126: Das angegebene Modul wurde nicht gefunden."

    premiere elements 12, new installation, serial no. accepted, installation completed and new started, but does not run. I get following msg-box: "LoadLibrary failed with error 126: Das angegebene Modul wurde nicht gefunden."   Installation in German Language on WIN7 professional 64bit, Samsung SSD. What can I do to run that program?

    Jurgen Freund
    Premiere Elements 12 on Window 7 64 bit. What video card/graphics card does your computer use - AMD Radeon?
    I have found this YouTube video on the subject of Error 126 with details for resolving the problem.
    How to fix the ERROR 126 when you open OpenGL programs - YouTube
    The link was contributed in an old 2013 thread here by the ID danneomarre (see post 6 of the following thread)
    LoadLibrary failed with error 126: cant find the required
    Please let us know if that worked for you.
    Thank you.
    ATR
    Add On...When all is OK and working, please update 12 to 12.1 Update using an opened project's Help Menu/Update.

  • Windows 8.1 - Upgrade from 8, Start Button Does Not Work

    I cannot find a fix for my 8.1 start button.
    It works when I move the task bar to the top, right or left but not at the bottom. I ran all windows updates and there are no missing/unknown drivers in device manager. No errors in the event log. I've restarted multiple times and created a new local profile.
    I've also tried: 
    Copy WinX folder under C:\Users\Default\AppData\Local\Microsoft\Windows into C:\Users\[your user name]\AppData\Local\Microsoft\Windows.
    dism /online /cleanup-image /restorehealth
    Any ideas? I would prefer not to do a clean install. Thanks in advance. 
    HP Touchsmart 23 series
    i5-3475S 2.90GHz
    16GB RAM
    1TB HDD

    Could you please describe a little more detailed about “Start Button does not work”? What is the symptom?
    Yes, when the taskbar is at the bottom of the screen, I cannot left click on the start button. The machine is also a touch-screen, which does work when I touch the start button. If I move the task bar to the left, right or top; the start button does work.
    And what is the kind of the account, Domain? Local? Or both?
    This is local machine.
    It still doesn’t work in a new account?
    Same issue happens with a new account.
    What happens if you use win + "X"?
    Win + "X" works fine; displays options.
    Regarding to the “doesn’t work, both for screen touch and mouse?
    Left-click via the mouse does not work. Touch works fine.
    Can you try to copy the WinX folder from a working PC to your PC for a test?
    I do not have another Windows 8.1 machine available to me.

  • Start screen does not exist in batch input data

    I'm using .NET Connector calling Rfc_Call_Transaction funtion throught a proxy, i stablished all the params as you can see in the code below, but i get the message cited in the subject 'Start screen does not exist in batch input data'.
    What do you think is happening? or Where can i get the samples needed for perform this type of request?
            private BDCDATA FillBDCDATA(string Program,
                                        string Dynbegin,
                                        string Dynpro,
                                        string Fnam,
                                        string Fval)
                BDCDATA st_DATA = new BDCDATA();
                st_DATA.Program = Program;
                st_DATA.Dynbegin = Dynbegin;
                st_DATA.Dynpro = Dynpro;
                st_DATA.Fnam = Fnam;
                st_DATA.Fval = Fval;
                return st_DATA;
            private void button3_Click(object sender, System.EventArgs e)
                SAPProxy proxy = null;
                try
                    proxy = new SAPProxy("ASHOST="  + txtHost.Text +
                        " SYSNR="  + txtSysnr.Text +
                        " CLIENT=" + txtMand.Text +
                        " LANG="   + txtLang.Text +
                        " USER="   + txtUser.Text +
                        " PASSWD=" + txtPass.Text);
                catch(Exception excpt)
                    txtMsg.Text = excpt.Message;
                if (proxy == null)
                    return;
                BDCDATATable tblBDCDATA = new BDCDATATable();
                MESSAGEINF infMessage = new MESSAGEINF();
                //BDCDATA st_DATA = new BDCDATA();
                tblBDCDATA.Add(FillBDCDATA("SAPMKBUA", "0111", "0111", "BDC_OKCODE", "/00"));
                tblBDCDATA.Add(FillBDCDATA("SAPMKBUA", "0111", "0111", "BPDY-BLDAT", "30.12.2004"));
                tblBDCDATA.Add(FillBDCDATA("SAPMKBUA", "0111", "0111", "BPDY-VERSN", "0"));
                tblBDCDATA.Add(FillBDCDATA("SAPMKBUA", "0111", "0111", "FMPS-FIKRS", "ente"));
                tblBDCDATA.Add(FillBDCDATA("SAPMKBUA", "0111", "0111", "BPDY-JAHR",  "2005"));
                proxy.Rfc_Call_Transaction("FM9J","", out infMessage, ref tblBDCDATA);
                txtMsg.Text = infMessage.Msgtx;

    Jose,
    I imagine you are passing, for the Dynbegin parameter of the private method FillBDCDATA, invalid values.
    Why don't you try this way:
    tblBDCDATA.Add(FillBDCDATA("SAPMKBUA", "X", "0111", " "," "));
    tblBDCDATA.Add(FillBDCDATA(" ", " ", " ", "BDC_OKCODE", "/00"));
    tblBDCDATA.Add(FillBDCDATA(" ", " ", " ", "BPDY-BLDAT", "30.12.2004"));
    tblBDCDATA.Add(FillBDCDATA(" ", " ", " ", "BPDY-VERSN", "0"));
    tblBDCDATA.Add(FillBDCDATA(" ", " ", " ", "FMPS-FIKRS", "ente"));
    tblBDCDATA.Add(FillBDCDATA(" ", " ", " ", "BPDY-JAHR", "2005"));
    I hope I could help you.
    Regards,
    Daniel Carvalho

  • GA749 start date does not include any senders in FAGLGA35

    Hello Guru:
    I do FAGLGA31  for sender  =  account 1-99999 profit center 1  and receiver = profit center 2
    version = 1 .
    when run cycle execute message "GA749 start date does not include any senders"
    I check in table FAGLFLEXT , there is data in  Sender cost center and Profit center  according to my criteria.
    Please advise where to check up and thanks in advance

    HI,
    please check the following:
    The problem could be caused by the cycle header definition. Instead of
    '0' you have to enter '1' as a version. All actual data gets posted
    under version 001 in NewGL by system default, so if you specify the
    version other than '1', the sender value is not found when executing the
    cycle.
    Regards
    Madhu M

Maybe you are looking for