SetForeground in Applet does not work (Netbeans under Linux)

I'm attempting to make a Breakout version of java (if I go through with it) and the first issue that I encountered is that I can't change the color of the moving rectangle (you know, the thing you hit the ball with). I tried the code under Textpad on a Windows machine and that worked fine, but not under Netbeans in Linux using jdk 1.6.0_01.
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Breakout extends Applet implements MouseListener, MouseMotionListener{
     int mouse_x, mouse_y;
     Thread t;
     public void init(){
          addMouseListener(this);
          addMouseMotionListener(this);
     public void start(){
          t= new Thread();
          t.start();
     public void run(){}
     public void mouseClicked(MouseEvent me){ }
     public void mouseEntered(MouseEvent me){ }
     public void mouseExited(MouseEvent me){ }
     public void mousePressed(MouseEvent me){ }
     public void mouseReleased(MouseEvent me){ }
     public void mouseDragged(MouseEvent me){ }
     public void mouseMoved(MouseEvent me){
          mouse_x = me.getX();
          if(mouse_x>=400)
               mouse_x=400;
          repaint();
     public void stop() {}
     public void destroy(){ }
     public void paint(Graphics g){
          setBackground(Color.black);
          setForeground(Color.white); //doesn't work              
          g.drawRoundRect(mouse_x, 600, 50, 20, 20, 20);
}I'm wondering if it's because the Applet under Linux uses the Native l&f theme while appets under Windows uses the Windows l&f theme.
Any thoughts would be helpful!

setForeground(Color.white); //doesn't work
g.drawRoundRect(mouse_x, 600, 50, 20, 20, 20);Change this to:
g.setColor(Color.WHITE);
g.drawRoundRect(mouse_x, 600, 50, 20, 20, 20);You can move the background setting into method init(), calling it once is enough.
I'm wondering if it's because the Applet under Linux
uses the Native l&f theme while appets under Windows
uses the Windows l&f theme.You use java.awt.Applet, so you use AWT which means there's no L&F theme (as in Swing) but it's native components being responsible.

Similar Messages

  • Applet does not work after conversion

    Hi,
    A have an html page on with a use an applet. The applet is downloaded in two cab files for the internet explorer.
    The applet and the download works fine without the java plugin.
    When I convert this page to using the html converter the applet does not work
    The error is
    java.lang.ClassNotFoundException: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at oracle.forms.handler.UICommon.instantiate(Unknown Source)
         at oracle.forms.handler.UICommon.onCreate(Unknown Source)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
         at oracle.forms.engine.Runform.startRunform(Unknown Source)
         at oracle.forms.engine.Main.createRunform(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    I think he fails on the downlad of the second cab file....
    Sombody any ideas,
    Thank
    Tom Van de Velde

    I recently moved to programming applets and this problem gave me many
    headaches. I know that the java compiler is supposed to compile with an
    appropriate version, but I suspect that there may be a few flaws in the
    system.
    Try compiling with a command like this to force a 1.1 compilation:
    "javac -target 1.1 yourfile.java"
    This enabled my applets to load in Netscape 4.6, something they wouldn't do before.
    Installing the java plugin seems to fix the problem on other browsers. This might
    be a new bug introduced by Java 1.4, since I had very few problems with
    Java 1.3...I dunno...that's speculation...

  • In iTunes 11.1 (I26) , I cannot find how to delete podcast listings showing undownloaded podcasts. Delete does not work. Option Delete does not work.  Dragging to the trash does not work. Under Edit, Delete is greyed out. Mac OS 10.6.8

    in iTunes 11.1 (I26) , I cannot find how to delete podcast listings showing undownloaded podcasts. Delete does not work. Option Delete does not work. Dragging to the trash does not work. Under Edit, Delete is greyed out. Mac OS 10.6.8.
    Tom at the Genius Bar told me that Option Delete would work. It does not.
    I had to upgrade to iTunes 11.1.(I26) because it is required with OS7 on my iPod Touch (5th Gen). I have tried shutting down iTunes, then shutting down the entire system. This is the first in many visits that the Genius Bar gave me a solution that did not work.
    This is a big awkward computer locked to my desk. I would rather not unlock it and then carry it through a shopping center to the Genius Bar if i can avoid oit.
    When I installed iTunes 11.1, I discovered that Ihad to resubscribe to virtually all of the podcasts that I had previously been subscribed to. That was a surprise.

    Hello Achates:
    I did not read the rather long post. If you wish to reinstall OS X 10.4, use your software install DVD. Backup is essential. To minimize your risk, I would use an archive and install:
    http://docs.info.apple.com/article.html?artnum=107120
    In that way, you will have a fresh copy of OS X and your current settings will be preserved.
    Incidentally, I do not agree that the printer problem is best solved by reinstalling OS X. I have had HP printers for sometime and, on one occasion, had difficulty after an upgrade. HP technical support walked me through uninstalling all traces of the HP driver and then reinstalling.
    Barry

  • Enforcing JRE version for Applet does not work - 1.4.2

    Hi,
    Our application (Applet) requires JRE 1.4.2 .
    I believe I need to use STATIC VERSIONING as we want the client desktop to ONLY use 1.4.2 for our applet.
    So I followed the instructions mentioned in
    http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html#in-ie
    and
    http://java.sun.com/products/plugin/versions.html
    But for some reason the JAVA Installer fails to install the package.
    It comes back with this pop-up error message:
    Error - Java(TM) Installer
    Unable to download http://java.sun.com/update/1.4.2/1.4.2-b28.xml for installation
    Here is the jsp code snippet:
    <center>
    <OBJECT classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA" id="myapplet" NAME="myapplet"
        width="650" height="426" border="1" align="baseline"
        codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0">
        <PARAM name="code" value="com.statestreet.gia.ui.applet.ComponentApplet">
        <PARAM name="codebase" value="/jars">
        <PARAM name="type" value="application/x-java-applet;jpi-version=1.4.2">
        <PARAM NAME="cache_option" VALUE="Plugin">
        <PARAM NAME="cache_archive" VALUE="jar1.jar,jar2.jar">
        <PARAM name="scriptable" value="true">
        <PARAM NAME="mayscript" VALUE ="true">
       <center>
        <P>This page requires the Java Runtime Environment Plug-in. If you see this message,
        the automatic install probably failed. <BR>Please <A href="http://java.sun.com/j2se/1.4.2/download.html">click here
    </A>
        to manually install the environment. If prompted, please choose "Run this file from its current location" or "Open"
    .<BR>
        Accept all of the defaults during the installation. When the installation completes, please click the refresh butto
    n on your browser. <BR>
        If this process does not work, please contact the Help Desk.
        </P>
        </center>
    </OBJECT>
    </center>I have tried changing the codebase by removing the "#Version part.." but still no result.
    Any suggestion is greatly appreciated.
    thanks
    hp

    Yeah, after hours of searching it must be so that my son has a 8GB i.e. a 2G version and mine just happens to be the 3G as I bought mine a month later....did not know how to know the difference but now solved, thnx.

  • Applet does not work with a proxy server.URgent

    Hi,
    I have an asp page being hosted from a IIS server.
    The asp page has an applet which gets data from a server side component which is hosted as a service on the server side.For connection to the server I am using URLConnection object and trying to connect over a TCP connection.
    The problem occurs when I use an proxy in the middle.
    I have changed the browser settings to include the proxy.
    The following is the error I recieve:
    Full :http://172.25.11.63:4590/
    <-------------------------------->
    OPening input stream
    in Run ::::
    ERROR: Created data socket but can't open stream on
    it.172.25.11.63:4590//
    172.25.11.63:4590//
    java.io.FileNotFoundException: 172.25.11.63:4590//
         at com/ms/net/wininet/http/HttpInputStream.connect
         at com/ms/net/wininet/http/HttpInputStream.<init>
         at com/ms/net/wininet/http/HttpURLConnection.createInputStream
         at com/ms/net/wininet/WininetURLConnection.getInputStream
         at TalkClientApplet.rendezvous
         at TalkClientApplet.actionPerformed1
         at TalkClientApplet.start
         at com/ms/applet/AppletPanel.securedCall0
         at com/ms/applet/AppletPanel.securedCall
         at com/ms/applet/AppletPanel.processSentEvent
         at com/ms/applet/AppletPanel.run
         at java/lang/Thread.run
    ...Disconnecting.
    Following is my code.
    url = new URL("http://" + host +":"+i);
    urlconnection = url.openConnection();
    urlconnection.setDoOutput(true);
    urlconnection.setDoInput(true);
    System.out.println("Successfully opened the URL connection at " + "http://" + host + ":" + i );
              System.out.println ("Protocol: " + url.getProtocol());
              System.out.println ("Host :" + url.getHost());     
              System.out.println ("Port :" + url.getPort());
              System.out.println ("File :" + url.getFile() );
              System.out.println ("Full :" + url.toExternalForm());
              System.out.println ("<-------------------------------->");
    os = new BufferedWriter(new OutputStreamWriter(urlconnection.getOutputStream()));
    System.out.println("OPening input stream ");
    // is = new DataInputStream(urlconnection.getInputStream());
         System.out.println(urlconnection.getInputStream());
    is = new DataInputStream(urlconnection.getInputStream());
    The exact place where I get the error is whn i call URLConnection.openInputStream().
    Usually this error comes with a malformed URL.But the same code words without a proxy.Also I am not making any changes to my code in both scenarios that is with or without proxy.
    Please help.This is urgent and a showstopper

    Thanks for your nice solution, but unfortunatelly it does not work with lines longer than 100 chars with Netscape. It works fine with IE and appletviewer too.
    Example:
    I use this code:
    try {
                URL url = new URL(protocol,hostName,portNumber,URLstring);
                InputStream in = url.openStream();
                BufferedInputStream bis = new BufferedInputStream(in);
                StringBuffer input = new StringBuffer(60);
                int c;
                while ((c = bis.read()) != -1){
                    System.out.print((char)c);
                    input.append((char)c);
                bis.close();
                dataFromServer = input.toString();
            catch(Exception ex) {
                ex.printStackTrace();
            }I use input file test.html with exactly 100 chars ('a')
    Netscape Java Console:
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadataFromServer : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaI use input file test.html with exactly 101 chars ('a')
    Netscape Java Console:
    ?JL?yyxk?cedataFromServer : ?

  • Applet does not work with JVM 1.4.1

    Hello all,
    I have a doubt with applets in JVM 1.4.1. I have a html page with has a APPLET tag, which cab file is located local in my computer. This applet connects to a server and establish a TCP/IP connection.
    I read that the security in Java Plug-in 1.4.1 was changed a lot, and now we need a policy file to grant this access. Is that right? If so, how I can change the policy file to grant this kind of access (load java applet from local disk)?
    Thanks a lot,
    Cristiana

    I have a doubt with applets in JVM 1.4.1. I have a
    html page with has a APPLET tag, which cab file is
    located local in my computer.I hope you mean a jar file. SUN's Java implementation does not understand cab files.

  • Applets does not work in Safari (IE,FF,Konqueror,Opera are OK) pls hlp

    I have an applet on http://www.akropolis-uh.cz/html/_emptybody/hry_jimmalovani.html page
    (it is czech site but is not important - applet is graphics only)
    The page is XHTML 1.0 Strict and is valid.
    Applet works in:
    Firefox 2, 3
    Internet explorer 5.5, 6, 7
    Konqueror 3.5.x
    Opera 9.5x
    But in safari 3.3.1 (525.17) not run (on Windows platform ... behind proxy)
    I think, there is a problem where safari loking for the main class (watch in java console).
    I'v tried many changes ... moving to the same directory ... but nothing ...
    The server use mod_rewrite but I'v tried many combination (including RewriteRule to same directory etc.).
    Is there a bug in the html code ? any idea ?
    I'm confused becouse only Safari is not working
    Thank you 4 hlp

    I answer myself.
    It is ok from diferent site without proxy and use Safari 3.1.2 (525.*21*).
    Maybe there was a Safari/Proxy problem. :)
    Sorry and thank you myself :)

  • Ralink RA3290 does not work on Oracle Linux

    I have just bought a new HP Pavilion G6-2213so which seems to have a ralink rt3290 wifi chipset
    (Just so you know I'm not very experienced with linux when it comes to install new drivers etc)
    I have installed:
    Red Hat Enterprise Linux Server release 6.3 (Santiago)
    Linux hp-v074617 2.6.39-300.17.2.el6uek.x86_64
    I have downloaded a driver from mediatek, unzipped it and
    ran
    make
    make install
    modprobe rt3290sta
    When I run i got
    lsmod|grep rt3290
    rt3290sta 1255193 0
    iwconfig
    lo no wireless extensions.
    ra0 Ralink STA
    Link Quality:0 Signal level:0 Noise level:0
    Rx invalid nwid:0 invalid crypt:0 invalid misc:0
    eth0 no wireless extensions.
    rfkill list all
    0: hp-wifi: Wireless LAN
    Soft blocked: no
    Hard blocked: no
    1: hp-bluetooth: Bluetooth
    Soft blocked: yes
    Hard blocked: no
    dmesg|grep rt3290
    rt3290sta: module license 'unspecified' taints kernel.
    (Related to GPL I think but not sure if it has an impact)
    To me it seemes that the system are aware of my wifi card but still I can not get any wifi connection
    Apprecate if someone can tell me if I missed something or what other steps I need to do to make it work
    Best regards
    Magnus

    Support and demand for Wifi on a Linux enterprise server system (RHEL based) is generally limited and usually a desktop system requirement, for which other more suitable Linux distributions exist.
    You need to be 100 % about the model of your Wifi adapter.
    What is the output of lspci -v related to your Wifi adpater?
    Does the driver you download support the Oracle UEK2 kernel (2.6.39)?
    You could try your installation starting the system from the original RHEL kernel at the Grub menu to see if it makes any difference. If HP support nor the OS installation provides a driver for your hardware, check http://elrepo.org/tiki/tiki-index.php which focuses on hardware related packages to enhance Enterprise Linux.

  • Swing applet does not work in IE using java plugin

    I am using applet-servlet communication in my Applet and also using java plugin 1.3 to open that applet in browser.It is working fine in Netscape 4.7 but not in IE 5.0.
    Problem is It could not get any data from the database.
    If you have any solutions it will be appriciated.
    thanks

    did you find your problem with the IE 6.0
    Java problem.Java(TM) Plug-in: Version 1.4.2_01
    Using JRE version 1.4.2_01 Java HotSpot(TM) Client VM
    I have something simular and was looking for a fix.
    .yavs: Yet Another Vertical Scroller, version 1.2
    (c) 1998 Steve Bassler http://www.westol.com/~bassmstr
    yavs: Yet Another Vertical Scroller, version 1.2
    (c) 1998 Steve Bassler http://www.westol.com/~bassmstr
    yavs: Yet Another Vertical Scroller, version 1.2
    (c) 1998 Steve Bassler http://www.westol.com/~bassmstr
    load: class xms.EntryApplet.class not found.
    java.lang.ClassNotFoundException: xms.EntryApplet.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more

  • Ctrl-key not working properly under Linux

    Hello,
    I am using Labview 8.6 under Ubuntu Linux 8.10 (Gnome) with a German keyboard layout.  If I want to enter a backslash "\" and hit the control-key I first get one ore more space-characters. This is very annoying and produces sometimes hard to find typing errors. I don't have such problems with any other applications so the keyboard settings of Gnome/X-server seem to be fine.
    Any help would be appreciated.

    Okay.  It was just a thought of where there might be a problem with LabVIEW and doing a Ctrl-S for save being a problem, but not for other apps.
    I don't have any other ideas right now.  I don't do Linux and it seems like that is where your problem lies.  I don't have the time or desire anymore for the sake of trying to make non-conventional operating system with a myriad of flavors and versions functional, so I stay away from it.
    Good luck.  Hopefully those people who love to dive into the nitty gritty details of an operating system like Linux have some ideas.

  • Adobe Reader 9.1.2 does not maximize correctly under Linux

    This bug was originally reported at http://forums.adobe.com/message/1784395  Unfortunately, the bug seems to remain in the 9.1.2 release.
    Any word on when this bug will be fixed?
    John Perkins
    [email protected]

    How are you installed Reader? Using any package manager, or manualy from Adobe.com? What distribution you use? Have you tried strace? Any debug in command line?

  • Russell Brown " Image Processor Pro " does not work under CC

    I just switched from Photoshop CS 6 to CC and use Russell Brown "Image Processor Pro". Unfortunately does not work that under CC. I also want to install the fix but we probably only applied to CS6.
    Does anyone have a solution to the problem.
    Here the German error message: https://dl.dropboxusercontent.com/u/12684660/CC_IPP.jpg
    Post translated with google Translater from the German.

    I installed Image Processor Pro quite some time ago. I extracted the extension package and just copied the two files "Image Processor Pro.xml" and "Image Processor Pro.jsx" into Photoshop's versions Presets\Scripts. I normally install things I add to Photoshop into my own folders outside any Adobe installation folder.   Image Processor Pro  is an exception because I did not want to modify X's code.  Image Processor Pro is coded in a way to find which version of Photoshop is being run from and looks for its default xml file in that version Presets\scripts\ folder.
    The script may save your modficaions to its defalt xml file into you user ID application data areas. And you can save you own Image Processor Pro presets configurations.
    I run Windows not Mac though.

  • Focus under Win2k does not work correctly

    Hi,
    we've found out that the focus does not work correctly under Windows 2000 in
    Seamless Mode (App is a Windows Application running on Windows Terminal Server
    2003), the same application has no problems under Windows XP, Apple Macintosh
    and Linux.
    Example: The application has a button which pop's up a small calendar window
    giving that window focus. In Tarantella under Win2k however you just see the
    window popping up shortly and then going in the background. As the window is in
    the background and you can't get the window back and you also cannot work
    further in that application as the rest is inactive.
    Only way is to do a right-click on the application in the taskbar, which brings
    the window in the foreground again. What makes this problem even harder to
    analyze is, that it sometimes even works correctly (around 3 of 10 times).
    We've mostly recognized this with modal windows. The native client does not have
    this problem, however as far as I know it does not support seamless mode.
    2. The second problem we got is, that if you click with the mouse into the
    initializing Window while the application starts up after you have clicked on an
    application Link in SGD (I mean the Pre-Login window of Windows which shortly
    shows up just before the Login Process begins),
    the application is not started seamlessly but is started within that window and
    you have no chance but closing an restarting the application to get it in
    seamless mode. This is seen on all Client Operating Systems by us and not only
    Windows 2000.
    The Client runs:
    Windows 2000 SP4 all updates installed
    Java: 1.5.0-5
    Browser: IE6.0 and Firefox 1.0.7
    Server: Windows 2003 Terminal Server (all updates installed)
    Tarantella: 4.20.909
    I hope that someone has at least a workaround.
    Regards
    Carsten

    I have organized some testcases attached are 3 Test Programs which work
    nice natively but got these problems under Tarantella under every Windows
    Operating System (the error is not Windows 2000 as I previously mentioned but
    also occurs on Windows XP).
    The interesting thing is that the Test Program made with .NET does not show this
    problem.
    Could someone please test these and tell if this error is reproducible on your
    systems as well ?
    Run these Testprograms natively, they show no misbehavior.
    Execute this from a SGD Webtop Session in Seamless Mode, see that
    the Modal window is not modal but shifts into the background on every 2 -3 click.
    Regards
    Carsten
    [ModalTestPrgs.zip]

  • Threads does not work correctly

    The follow program working with threads. We have two classses : Producer and Customer which working with the same object (which type is class Q). Producer produces data. Customer should capture the data. The Q class must be synchronized. But code does not work (compile under NetBeans 6.0)
    class Q {
    int number = 0;
    boolean filled = false;
    void put (int n) {
    while (filled){
    try {
    wait();
    catch(InterruptedException e) {
    System.out.println("Interrupted");
    number = n;
    System.out.println("Put : " + number);
    filled = true;
    notify();
    void get () {
    while (!filled) {
    try {
    wait();
    catch(InterruptedException e) {
    System.out.println("Interrupted");
    System.out.println("Got : " + number);
    filled = false;
    notify();
    class Producer implements Runnable {
    Q obj_link;
    Thread t;
    Producer (Q obj_link) {
    this.obj_link = obj_link;
    t = new Thread(this, "Producer");
    t.start();
    public void run () {
    int i = 0;
    while (true) {           
    obj_link.put(i++);
    class Customer implements Runnable {
    Q obj_link;
    Thread t;
    Customer (Q obj_link) {
    this.obj_link = obj_link;
    t = new Thread(this, "Customer");
    t.start();
    public void run () {
    while (true) {
    obj_link.get();
    public class Main {
    public static void main(String[] args) {
    Q common_obj = new Q();
    Producer pr = new Producer (common_obj);
    Customer cs = new Customer (common_obj);
    try{
    pr.t.join();
    cs.t.join();
    catch(InterruptedException e) {
    System.out.println("Interrupted");
    System.out.println("Program Over");
    }

    The follow program working with threads. We have two classses : Producer and Customer which working with the same object (which type is class Q). Producer produces data. Customer should capture the data. The Q class must be synchronized. But code does not work (compile under NetBeans 6.0).
    I.e. i am waiting for the follow result:
    1. pr thread starts with common_obj object
    2. cs thread starts with common_obj object
    3. pr thread tries call common_obj.put(i++) in infinite cycle:
    3.1 these lines does not work because filled now is set to false
            while (filled){
                try {
                    wait();
                catch(InterruptedException e) {
                    System.out.println("Interrupted");       
            }3.2 the follow code will be implemented:
            number = n;    // put value to number
            System.out.println("Put : " + number); // output result to console
            filled = true; // value was put. It can be got.
            notify(); // notify another thread (cs) that it should not waiting anymore.4. pr thread tries call common_obj.get() in infinite cycle:
    4.1 the following code will not be implemented anymore:
            while (!filled) {
                try {
                    wait();
                catch(InterruptedException e) {
                    System.out.println("Interrupted");       
            } since another thread notify current.
    4.2 the follow code will be implemented:
            System.out.println("Got : " + number);
            filled = false;
            notify();So the result of running this program should be:
    Put : 0
    Got: 0
    Put : 1
    Got: 1
    Put : 2
    Got: 2
    Put : 3
    Got: 3
    Put : 4
    Got: 4
    class Q {
        int number = 0;
        boolean filled = false;
        void put (int n) {
            while (filled){
                try {
                    wait();
                catch(InterruptedException e) {
                    System.out.println("Interrupted");       
            number = n;
            System.out.println("Put : " + number);
            filled = true;
            notify();
        void get () {
            while (!filled) {
                try {
                    wait();
                catch(InterruptedException e) {
                    System.out.println("Interrupted");       
            System.out.println("Got : " + number);
            filled = false;
            notify();
    class Producer implements Runnable {
        Q obj_link;
        Thread t;
        Producer (Q obj_link) {
           this.obj_link = obj_link;
           t = new Thread(this, "Producer");     
           t.start();
        public void run () {
            int i = 0;
            while (true) {           
                obj_link.put(i++);
    class Customer implements Runnable {
        Q obj_link;
        Thread t;
        Customer (Q obj_link) {
           this.obj_link = obj_link;
           t = new Thread(this, "Customer");     
           t.start();
        public void run () {
            while (true) {
                obj_link.get();
    public class Main {
        public static void main(String[] args) {
            Q common_obj = new Q();
            Producer pr = new Producer (common_obj);
            Customer cs = new Customer (common_obj);
            try{
                pr.t.join();
                cs.t.join();
            catch(InterruptedException e) {
                System.out.println("Interrupted");
            System.out.println("Program Over");
    }the follow result of implementation I found:
    run:
    Put : 0
    Exception in thread "Producer" java.lang.IllegalMonitorStateException
    Got : 0
    at java.lang.Object.notify(Native Method)
    at threadstudy2.Q.put(Main.java:19)
    Program Over
    at threadstudy2.Producer.run(Main.java:50)
    at java.lang.Thread.run(Thread.java:619)
    Exception in thread "Customer" java.lang.IllegalMonitorStateException
    at java.lang.Object.notify(Native Method)
    at threadstudy2.Q.get(Main.java:33)
    at threadstudy2.Customer.run(Main.java:68)
    at java.lang.Thread.run(Thread.java:619)
    BUILD SUCCESSFUL (total time: 1 second)

  • Flash player does not work under one user account.

    Flash player does not work under one of my user accounts.
    My system: I work with a mac mini with Mac OS X 10.6.8.
    What I have done:
    I installed the flash player maybe one year ago under my "first" user account. At that time this user account had had administrator authorization. In the meantime I had to change this "first" user account in an account without administrator authorization and created an administrator user with which I installed different programms. Lately, the message came up that it would be necessary to update the flash player. I did it; under the "first" user account, but of course with the administrator's password for installing. The installation had been "successful" - so I was told. But it did not run. I tried it again and again. Each time with "deinstallation" first. No way; it did not work.
    After asking Adobe for the reason of the problem, they suggested to install the programm directly under the administrator user. I did that (of course after deinstalling under the "first" user account) with the result, that flash player runs under my administrator and my "second" user account, but not under the first user account. There I am always told to update my flash player.
    With this result, I talked to Adobe. So they told me to contact the producer of the operating software, since this would be a mistake of the operating software.
    And here I am - full of hope to get help from you.
    Thanks for reading. And thanks in advance for helping me.
    Nanny FS

    Any update to provide at all here guys?  Again, in my situation, it's very much rights-related as a standard user doesn't even report that the flash player exists when testing it on the Adobe Flash Version Detection website (despite it showing up in Control Panel and under Add/Remove Programs).  I've already tried giving the C:\Windows\System32\Macromed and files/subfolders appropriate permissions for the standard user and still nothing.  If I either give the user in question full local admin rights or logon as the domain admin, then the Adobe Flash Version Detection website says Flash is installed and Flash works fine.
    Thoughts???

Maybe you are looking for

  • Converting a web-based text page to XMP

    I have a live, web-based text feed that contains all of the metadata I want to capture. I want to tag this metadata to video and image files, and I want that information to stay with the video and image files throughout the production process (ie. th

  • Why am I overwhelmed by ads that bypass my settings?

    In the past three days, I have been overwhelmed by ads which are full screen and block any other view, are extremely difficult to get rid of, keep coming back after closed.Also, huge number of smaller popups and hyper text links which are activated b

  • Catalog Index doesnt work on alias columns

    We have a table with a text column on which we have created a catalog index. The catalog index doesnt work when I create a view of the table with alias column names. Any ideas suggestions.

  • /etc/resolv.conf problems

    In my conky script, the gmail portion stopped working so I just tried to do a normal wget https://mail.google.com in the terminal. The output was --11:41:41-- https://mail.google.com/ => `index.html' Resolving mail.google.com... 1.0.0.0 Connecting to

  • Alerts from KPI (Performance Point)

    Hi I have installed Performance Point Monitoring Server. Is there anyway, i can set up alerts from KPI.Can some body give me some link having detailed information about setting up alertsalerts? Thanks Deeps