Problem with GUI in applet

Hai to all,
I am having a problem with GUI in applets
My first class extends a JPanel named A_a
import javax.swing .*;
import java.awt.*;
import java.awt.event.*;
public class A_a extends JPanel
JButton jb;
JTextArea text;
public A_a()
setLayout(new FlowLayout());
jb=new JButton("Click me");
//add(jb);
text=new JTextArea(5,20);
add(text);
public void text_appendText(String aa)
System.out.println("I AM IN A_a");
text.append(aa);
text.revalidate();
revalidate();
/*public static void main(String ags[])
A_a a = new A_a();
JFrame frame=new JFrame();
frame.getContentPane().add(a);
frame.pack();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
frame.setSize(200,200);
frame.show();
and then I am using other class B_b which is an applet carries a exitsing panel (A_a) inside it .
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class B_b extends JApplet
public A_a a;
public void init()
a=new A_a();
getContentPane().add(a);
public void text_appendText(String aa)
final String aaa =aa;
new Thread(new Runnable()
public void run()
a=new A_a();
a.setBackground(new java.awt.Color(255,200,200));
System.out.println("I AM IN B_b");
a.text.append(aaa);
a.text.revalidate();
getContentPane().remove(a);
resize(500,500);
}).start();
and the I am using the second applet C_c in which by performing a button action the old panel A_a should get removed and replace the new panel D_a (which is not here )in the applet B_b with all other components(namely button , text fields etc)
import javax.swing .*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
public class C_c extends JApplet implements ActionListener
JButton jbt;
JTextArea jta;
public void init()
getContentPane().setLayout(new FlowLayout());
jbt=new JButton("Click me");
jbt.addActionListener(this);
getContentPane().add(jbt);
jta=new JTextArea(5,20);
getContentPane().add(jta);
public void actionPerformed(ActionEvent ae)
Enumeration e = getAppletContext().getApplets();
Applet applets = null;
while(e.hasMoreElements())
applets=(Applet)e.nextElement();
if ( applets instanceof B_b)
System.out.println("I AM CLASS C_c");
((B_b)applets).text_appendText(jta.getText());
((B_b)applets).remove());
((B_b)applets).getContentPane().add(D_d);
both the applets C_c and B_b are in same browser page
How can i achive that pls help .

Just to make the code readable...
import javax.swing .*;
import java.awt.*;
import java.awt.event.*;
public class A_a extends JPanel
JButton jb;
JTextArea text;
public A_a()
setLayout(new FlowLayout());
jb=new JButton("Click me");
//add(jb);
text=new JTextArea(5,20);
add(text);
public void text_appendText(String aa)
System.out.println("I AM IN A_a");
text.append(aa);
text.revalidate();
revalidate();
/*public static void main(String ags[])
A_a a = new A_a();
JFrame frame=new JFrame();
frame.getContentPane().add(a);
frame.pack();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
frame.setSize(200,200);
frame.show();
}and then I am using other class B_b which is an applet carries a exitsing panel (A_a) inside it .
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class B_b extends JApplet
public A_a a;
public void init()
a=new A_a();
getContentPane().add(a);
public void text_appendText(String aa)
final String aaa =aa;
new Thread(new Runnable()
public void run()
a=new A_a();
a.setBackground(new java.awt.Color(255,200,200));
System.out.println("I AM IN B_b");
a.text.append(aaa);
a.text.revalidate();
getContentPane().remove(a);
resize(500,500);
}).start();
}and the I am using the second applet C_c in which by performing a button action the old panel A_a should get removed and replace the new panel D_a (which is not here )in the applet B_b with all other components(namely button , text fields etc)
import javax.swing .*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
public class C_c extends JApplet implements ActionListener
JButton jbt;
JTextArea jta;
public void init()
getContentPane().setLayout(new FlowLayout());
jbt=new JButton("Click me");
jbt.addActionListener(this);
getContentPane().add(jbt);
jta=new JTextArea(5,20);
getContentPane().add(jta);
public void actionPerformed(ActionEvent ae)
Enumeration e = getAppletContext().getApplets();
Applet applets = null;
while(e.hasMoreElements())
applets=(Applet)e.nextElement();
if ( applets instanceof B_b)
System.out.println("I AM CLASS C_c");
((B_b)applets).text_appendText(jta.getText());
((B_b)applets).remove());
((B_b)applets).getContentPane().add(D_d);
}

Similar Messages

  • Problem with focus on applet  - jvm1.6

    Hi,
    I have a problem with focus on applet in html page with tag object using jvm 1.6.
    focus on applet work fine when moving with tab in a IEbrowser page with applet executed with jvm 1.5_10 or sup, but the same don't work with jvm1.6 or jvm 1.5 with plugin1.6.
    with jvm 1.5 it's possible to move focus on elements of IEbrowser page and enter and exit to applet.
    i execut the same applet with the same jvm, but after installation of plugin 1.6, when applet gain focus don't release it.
    instead if i execute the same applet with jvm 1.6, applet can't gain focus and manage keyevent, all keyevent are intercepted from browser page.
    (you can find an example on: http://www.vista.it/ita_vista_0311_video_streaming_accessibile_demo.php)
    Any idea?
    Thanks

    Hi piotrek1130sw,
    From what you have described, I think the best approach would be to restore the original IDT driver, restart the computer, test that driver, then install the driver update, and test the outcome of installing the newest driver.
    Use the following link for instructions to recovery the ITD driver using Recovery Manager. Restoring applications and drivers.
    Once the driver is restored, restart the computer and test the audio. If the audio is good you can continue to use this driver, or you can reinstall the update and see what happens. IDT High-Definition (HD) Audio Driver.
    If installing the newest driver causes the issue to occur but the recovered driver worked, I suggest recovering again.
    If neither driver works I will gladly follow up and provide any assistance I can.
    Please let me know the outcome.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • Problem with a signed applet and a user machine.

    Hello. I´m having some problems with a signed applet with some dependences.
    In one particular computer the applet doesn´t load.
    The java version installed in that computer is 1.6.0_25.
    The invocation tag:
    <applet name=applet id="applet" code=Applet/RequestApplet.class width=155 height=21 archive="RequestApplet.jar " MAYSCRIPT>
       <param id="parametro1" name="usuario" value="<Computed Value>">
    </applet>The RequestApplet.jar and dependences:
       bcmail-jdk13-145.jar(signed by bouncy castle), jce-ext-jdk13-145.jar(signed by bouncy castle), AbsoluteLayout.jar, plugin.jar, RequestApplet.jar(signed by me)*this files are all in the same folder.
    The requestApplet.jar manifest:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    X-COMMENT: Main-Class will be added automatically by build
    Class-Path: bcmail-jdk13-145.jar jce-ext-jdk13-145.jar plugin.jar Abso
    luteLayout.jar
    Created-By: 10.0-b23 (Sun Microsystems Inc.)
    Main-Class: Applet.RequestApplet
    Name: Applet/ResponseApplet$1.class
    SHA1-Digest: fO5IPiwEH3OhvlprhBecmMIAVJI=
    Name: Applet/NewJApplet.class
    SHA1-Digest: 6XSpm7lQEQRi39TegoUYv2aFJrk=
    Name: Applet/ResponseApplet.class
    SHA1-Digest: v1EbKUFB+QdvO05xx8UzAMNIyRs=
    Name: Applet/ResponseApplet$4.class
    SHA1-Digest: XH4I67psXZTelpz0AMAYc/Ej8QY=
    Name: Applet/RequestApplet$1.class
    SHA1-Digest: KAP5sAC4Thv/6GClkFAdGUVzgYA=
    Name: Applet/ResponseApplet$5.class
    SHA1-Digest: CVPnKrW2SgNEkRzYnVnQe3KGrIU=
    Name: Applet/ResponseApplet$3.class
    SHA1-Digest: SjfW1k1K7BA9m3AxmHi+jvRE+9o=
    Name: Applet/ResponseApplet$2.class
    SHA1-Digest: 3Pu18CZMLuEh7/n3y7XxFSkuNQY=
    Name: Applet/RequestApplet.class
    SHA1-Digest: Tky85es5+o371adetH9XVEI2Z+o=The error:
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
         at java.awt.EventQueue.access$000(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         ... 20 more

    Thanks. I´ll try with your tips. But if i put all the dependences in archive I get this error.
    The tag:
    <applet name=applet id="applet" CODEBASE="." code="Applet/RequestApplet.class" width=155 height=21 archive="bcmail-jdk13-145.jar, jce-ext-jdk13-145.jar, AbsoluteLayout.jar, plugin.jar, RequestApplet.jar " MAYSCRIPT>
       <param id="parametro1" name="usuario" value="<Computed Value>">
    </applet>The error:
    Java Plug-in 1.6.0_25
    Usar versión JRE 1.6.0_25-b06 Java HotSpot(TM) Client VM
    Directorio local del usuario = C:\Documents and Settings\Administrator
    c:   borrar ventana de consola
    f:   finalizar objetos en la cola de finalización
    g:   liberación de recursos
    h:   presentar este mensaje de ayuda
    l:   volcar lista del cargador de clases
    m:   imprimir sintaxis de memoria
    o:   activar registro
    q:   ocultar consola
    r:   recargar configuración de norma
    s:   volcar propiedades del sistema y de despliegue
    t:   volcar lista de subprocesos
    v:   volcar pila de subprocesos
    x:   borrar antememoria del cargador de clases
    0-5: establecer nivel de rastreo en <n>
    basic: Receptor de progreso agregado: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@f39b3a
    basic: Plugin2ClassLoader.addURL parent called for http://desarrollo.isaltda.com.uy/CertReq.nsf/bcmail-jdk13-145.jar
    basic: Plugin2ClassLoader.addURL parent called for http://desarrollo.isaltda.com.uy/CertReq.nsf/jce-ext-jdk13-145.jar
    basic: Plugin2ClassLoader.addURL parent called for http://desarrollo.isaltda.com.uy/CertReq.nsf/AbsoluteLayout.jar
    basic: Plugin2ClassLoader.addURL parent called for http://desarrollo.isaltda.com.uy/CertReq.nsf/plugin.jar
    basic: Plugin2ClassLoader.addURL parent called for http://desarrollo.isaltda.com.uy/CertReq.nsf/RequestApplet.jar

  • Design Problem with GUI sub vi

    Hello community,
    in general, I would like to separate the GUI from the data, but I get
    a problem with this design approach in LabView:
    I often have sub VIs that are supposed to control something.
    Therefore, these VIs consist of a control loop. A GUI window should
    show the regulation process (showing how the tracking error is
    hopefully approaching zero etc.). As I said, this GUI should be a
    separate VI (separate from the control loop VI). Since the GUI has to
    be updated on each sample, it is clear that the GUI VI should be
    inside the control loop, and therefore, it should be a sub VI of the
    control loop VI.
    Now, the problem is that the control loop VI itsself is a sub VI
    because the whole regulation is just a subsystem of the whole program
    (The main VI doesn't have a GUI, but first starts a (GUI) input mask
    for the same reason: separate the GUI from the rest).
    But back to the GUI VI inside the control loop. I must check the 'Show
    Front Panel When Called' option. But I can't check the 'Close
    Afterwards if Originally Closed' option since the GUI VI would appear
    and disappear in the control loop - according to the loop's sample
    rate. However, if I don't check the 'Close Afterwards if Originally
    Closed' option then the GUI VI will continue to show, even after the
    control process is finished.
    So in other words: I need the possiblity to close the GUI VI
    programatically, after the control process is finished.
    Any ideas?
    Regards
    Johannes

    Hi tmh,
    thanks for your answer
    On Tue, 11 Nov 2003 10:26:32 -0600 (CST), tmh wrote:
    >I think you're on the wrong track trying to put your 'GUI VI' inside
    >your control loop. It might be a better design to have the control and
    >GUI handled by separate loops and use an appropriate method to pass
    >data between the two, e.g. a global variable to pass the setpoint from
    >GUI to control...
    I try to avoid globals. Now, suppose I had multiple unrelated control
    loops. I had to suppose a global variable for each of these
    subsystems. I already use globals for the GPIB device IDs. I wouldn't
    like more.
    >and a queue to pass readings from control to GUI. In
    >fact, you could even split the GUI into two loops: one to read user
    >input from the front pa
    nel controls and one to display data returned
    >by the control loop.
    But if I split the GUI: How can I view them simultaneously? The user
    must see input and output simultaneously, in one window.
    >You may find it's more convenient to make the GUI
    >the top-level VI and make the control loop a subVI of that (but
    >outside the GUI loops).
    Your approach sounds interesting. Is there a sample for this
    architecture in the examples?
    Anyway, I have to point out that I have several unrelated GUI windows
    in my application. There is no notion of a main GUI in my application.
    The control loop is just one feature of my application, so it doesn't
    make sense to use the control GUI as the top-level VI. At application
    startup a user input form is displayed (it also has some sort of menu
    selection). But even this window can't be toplevel since it provides
    an Option radio button (that shows and hides controls, accordingly) a
    CONTINUE button, and a STOP button which implies that the input
    form.vi must be
    in a loop.
    The problem is that I can't send messages to windows in LabView as I
    am used to in Win32/VC++.
    Johannes

  • JDeveloper Problem with GUI

    Hi All,
    I'm running JDev 3.1 on Win2000, and I'm having a bit of a problem with redraws of the GUI.
    When I click anywhere on the JDev GUI and trigger and action that involves a GUI redraw the little piece of the GUI under the mouse pointer graphic is not redrawn. It does not effect the functionality but it is annoying and will make the other developers I work with less keen about using it.
    Does anyone else have this problem? Is it a JDev or Win2k problem?
    Cheers
    d

    Probably an issue with the JRE used by JDev. on Win 2k. Have you tried 3.2x? I haven't seen that type of issue with it on Win 2k.

  • Problems with (selfcompiled) gnome-applets

    I have experienced problems with gnome-applets. Those that come with a basic gnome installation work fine and there is no problem adding them to the panel. However, when I use selfcompiled applets I always get the following error when trying to add them.
    The panel encountered a problem while loading "OAFIID:GNOME_HDAPS_STATUSApplet".
    (Where OAFIID: is followed by the applets name.)
    I tried pkgbuilds from the AUR like 'ontv' and 'gnome-hdaps-applet' and I've tried compile applets manually. Always the same issue. I don't know what's wrong. I've found threads where people get that error message on any applet but I didn't find a solution to my problem, as all my other applets work fine. Any ideas?

    Have you done any Gnome updates since this applet was compiled? I seem to recall having a similar problem with an applet I built and, falling back to the Windows days, did a reboot, rebuilt the applet, and then all was well after I reinstalled the applet.
    Not sure if this will help, but it cannot hurt.
    Bob

  • Problem with accessing Signed Applet from javascript method

    Hi,
    I am facing the following problem while accessing Signed Applet from javascript method.
    java.security.AccessControlException: access denied (java.io.FilePermission c:/temp.txt read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at FileTest.testPerm(FileTest.java:19)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
         at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
    I am using jdk1.5 for my development...
    Can anyone help to resolve this security issue. Urgent...
    Thanks in advance.

    Hey thanks. I wasn't able to get it to work with that sample but I did find this very similar code that does allow javascript to call JFileChooser in an applets public method.
    java.security.AccessController.doPrivileged(
    new java.security.PrivilegedAction()
    public Object run(){                           
    //do your special code here
    return null; //return whatever you want
    It seems a bit tempermental in that if you don't select a file quickly, it will hang the browser....no perfect solution but I'm going in the right direction.
    Thanks,
    Scott

  • BEx Analyzer 3.x language problem with GUI 710

    Hi All,
    We are having trouble to login to BEx Analyzer 3.x with GUI 710 with English language, even if we set language as EN in the logon pad by default it is logging into Japanese language. But 7.x Analyser is working fine.
    We have BI 7.0 and BW 3.5 systems. 
    SAP GUI 710 installed with latest available Frontend Patch ( bi710sp10_1000-10004472 , gui710_15-10002995 and bw350gui710_7-10004473 ) and we are using Excel 2003 on XP Professional.
    Installed .Net Framework 2.0, Microsoft office patch - office2003-KB907417
    Your help is very much appreciated.
    Regards,
    MKR

    Hi,
    Are you using different backend systems to connect for 3.x and 7.x? Because the file which prompts the SAP Logon is a common file used by both 3.x and 7.x.It shouldn't behave differently for the same system.
    You can uninstall the SAPGui and Front End patch and then reinstall it.
    The BW 3.5  patch  8  in SAP GUI 7.10 is released to the SMP now and is available for download.
    Rgds,
    Murali

  • Problem With GUI ( Who can help me! )

    Hallo,
    It�s a very simple program to See the Clock on a panel. The program works well, but if I want to include a GUI to my program, it don�t want. I use runable action and I think that is be the problem.
    Here below you can see the code�s. I�m sure there is someone who can help me.
    Thanks a lot,
    Seyyed
    The code:
    public class Clock_maken extends java.applet.Applet
    implements Runnable {
    public volatile Thread clockThread = null;
    JLabel           Datuum_label;
    DateFormat      formatter;
    Locale           locale;
    Date           currentDate;
    String          today;
    public void init(){ 
    locale = Locale.getDefault();
    Datuum_label = new JLabel("date");
    public void start() {       
    Datuum_label.setForeground(Color.black);
    add(Datuum_label);
    if(clockThread == null) {
    clockThread = new Thread(this);
    clockThread.start();
    public void run() {
         Thread myThread = Thread.currentThread();
         while (clockThread == myThread) {
         currentDate = new Date();
    formatter =                     DateFormat.getDateTimeInstance(DateFormat.FULL,
              DateFormat.MEDIUM, locale);
    today = formatter.format(currentDate);
    Datuum_label.setText(today);
    try {
    Thread.sleep(1000);
    } catch (InterruptedException e){ }
    public void stop() {clockThread = null;}
    public static void main(String[] args){
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame      lunarPhasesFrame = new JFrame("Lunar Phases");
    lunarPhasesFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Clock_maken phases = new Clock_maken();
    phases.init();
    phases.start();
    lunarPhasesFrame.pack();
    lunarPhasesFrame.setVisible(true);
    Now i want to create a GUI like folowing, but it dont work. Do u know wat is de probleem of mijn prograam.
    private static void createAndShowGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true);
         /*     JFrame      lunarPhasesFrame = new JFrame("Lunar Phases");
              lunarPhasesFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    */ Clock_maken phases = new Clock_maken();
         /*     phases.init();
              phases.start();
              lunarPhasesFrame.pack();
         lunarPhasesFrame.setVisible(true);*/
    public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }

    Continued here, with formatted code:
    http://forum.java.sun.com/thread.jspa?threadID=725022

  • Problems with RSA Signed Applets methods called by JavaScript

    Hi Folks,
    I need to give all permissions to an Applet used in an Intranet application, so I signed the jar containing it with a RSA self-cert and I did the same for all the other jar files userd by the applet.
    The applet runs under Java Plugin with JRE 1.5.0_06: I am requested by the browser to install the cert and all works fine.
    When a JavaScript function calls a public method of the applet I received a security exception when the code tries to read a system property.
    The same method works fine if called by the applet itself or by a gui event (i.e. a button click) inside the applet, so the problem seems to be related to the fact the applet is used by JavaScript (in Explorer 6).
    Does anyone know some way to overcome this problem????
    Message was edited by:
    piero

    If I may be so bold as to ask you to elaborate on this fix? I have encountered an identical issue, but I have no idea about your reference to your fix, sorry.

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Please help problem with GUI

    Hi
    I have two problems firstly when i try to assign a method to a button to a GUI
         JButton SetPrice = new JButton ("Set Price");
            contentPane.add( SetPrice);
             SetPrice.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) {  SetPrice ();    }This is teh code i am using to set up teh button on teh display.Belwo is the method it should run.
    public double SetPrice( int price)
             if (price <= 199.9){
           Cost= price;
             return Cost;
            else {
              System.out.println ( "Set a price which is less than 199.9");
              return Cost; }
            }When i try to compile it comes up with when i comipile
    SetPrice (int) in Shop cannot be applied to ()The variable has type double.So pelase my someone show me how to make the action listener button run this method.
    Thanks

    JButton SetPrice = new JButton ("Set Price");
            contentPane.add( SetPrice);
             SetPrice.addActionListener(this);
    SetPrice.setActionCommand("setprice");
    public void actionPerformed(ActionEvent e) {
    String action=e.getActionCommand();
    if(action.equals("setprice") {
    //do something
        }

  • [SOLVED] Problem with privileges (nm-applet and mounting devices)

    Hi,
    I have a little problem after a system update made a few weeks ago. (At least I think it started after that update, but I am not sure.)
    It's something related to lack of privileges or sth...
    When I right-click on nm-applet icon some options are greyd out as well as when I try to add a new network - everything in the dialog is grey. But when I "sudo nm-applet", everything works.
    And the next problem is: When I plug my USB stick/drive to NB it is not mounted automatically but I need to open nautilus, mount it manually and an "Authenticate" dialog shows up and my password is required. But why? It didn't use to work that way. I don't understant what might have changed.
    I use SLiM starting my gnome-session.
    My ~/.xinitrc:
    exec ck-launch-session dbus-launch gnome-session
    My /usr/share/gnome-session/sessions/gnome-fallback.session
    RequiredComponents=gnome-settings-daemon;
    RequiredProviders=windowmanager;
    DefaultProvider-windowmanager=compiz
    DefaultProvider-notifications=notify-osd
    DefaultProvider-displaymanager=slim
    (I don't use gnome-shell nor gnome-panel, but Gnome with xfce4-panel )
    Thank you in advance.
    Last edited by mino.sk (2012-06-22 21:25:57)

    Thank you, headkase, you were right about it! Removing "ck-launch-session" solved my problems. I also removed "dbus-launch" because I didn't have it there originally, I had added "dbus-launch" to exec line just today as I had read somewhere that it might help (it didn't)...
    So, I'm going with "exec gnome-session" and everything works, thanks.
    //Edit: Admin can mark this as "[SOLVED]"
    Last edited by mino.sk (2012-06-22 20:22:39)

  • SOS Problem with GUI login

    Please answer me as fast as you can because I have the following serious problem:
    I had install the SAP WEB AS 6.10 (and SAPDB) test version which I took it from the book ABAP OPJECTS THE OFFICIAL REFERENCE. Unfortunatelly, it did not work well when I was off line of the network of my company, I also installed the network adapter of MS LOOPBACK (as the instructions are saying) but again I couldn't login, so I uninstall from my PC the SAP WEB AS. Next day when I went to my company I could not logon to SAP and the error message is: SERVICE 'SAPDP00' UNKNOWN. I check the fileservice which is under the directory C:\WINNT\SYSTEM32\DRIVERS\ETC and there is a line with SAPDP00 3200/tcp. I reinstall GUI 7 times but the problem still exists.
    Well I hope that I will find a solution during weekend because if not I will forced to format my pc and reinstall all my aplication, sth which is very painfull.
    My pc is working with WinXP SP1.
    The error details are:
    service 'sapdp00' unknown
    time: Sat Jul 03 10:51:16 2004
    component: NI(Network Interface)
    release: 620
    version: 36
    module: ninti.c
    line: 428
    method: NiPServToNo
    return code:  -3
    System Call: getservbyname
    counter: 1
    Message was edited by: s0003198291

    Finally I found what cause this problem and the temporary solution plus the permanent one.
    My PC was hit by a virus (new version of QHOSTS-1 see at the end) which is changing the registry file HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
    "DatabasePath"= %SystemRoot%\nsdb
    So it is creating a host file under C:\WINNT\NSDB which it put it to the registry.
    So the permanent solution is to change the Registry.
    The temporary one is to run the following command from the dos:
       sapgui /H/<address of the SAP server>/S/3200.
    You can find more information on:
    http://www.sapfans.com/forums/viewtopic.php?t=83386&highlight=servicesapdp00unknown
      Information about the virus you can find in:
    http://vil.nai.com/vil/content/v_100719.htm
       Thanks

  • Having problems with GUI

    Goodday all, I'm having a problem getting this GUI for a simulation game up and running. I've added four panels which each house components for instance buttons, text area etc. And I've created another panel to house the image that should be set for the background. I've heard that the best way to achieve this is to use getLayeredPane(), but I think that's the problem. The panel simDisplay holds the title for the simulation, simControls hold start and stop simulation buttons, simGrid holds a grid on which the simulation is played (still working on that) and simDisplayControls is a panel that holds a textArea and button to run the simulation again. The textArea is a display area for the status of the simulation (for instance which characters moved, how many are there remaining etc ). The simDisplay was placed NORTH, simGRID CENTER, simControls EAST, and simDisplayContols SOUTH. Before I added the getLayeredPane so that I can view the image as the background, each of these panels were in their respective positions within the layout...now that I have, only some components are visible. As soon as I comment out that line of code with getLayeredPane all the components show exactly how I want them to which is in the positions I specified above (NORTH, SOUTH etc). I'm wondering if the fact that I used the BoxLayout to position the components within their panels is conflicting with the layeredPane. I'm new to this so any help will be greatly appreciated. Thank You ;)
    import javax.swing.*;
    import java.awt.*;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Image;
    public class Simulation extends JFrame{
    //create new panels, image icons and buttons
    JLayeredPane panel = new JLayeredPane();
    JPanel panel2 = new JPanel();
    JPanel simDisplayControls = new JPanel();
    public JButton start = new JButton("Start Simulation");
    public JButton stop = new JButton("Stop Simulation");
    private JTextArea turnDisplay;
    public JButton next = new JButton("Next Time Step");
    JPanel simDisplay = new JPanel();
    JPanel simGrid = new JPanel ();
    JPanel simControls = new JPanel();
    //GUI main function
    public static void main(String[] args){
    Simulation example = new Simulation();
    //GUI constructor
    public Simulation() {
    BorderLayout b = new BorderLayout();
    setLayout(b);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    BorderLayout panelout = new BorderLayout( 0, 0 );
    panel.setLayout(panelout);
    //Set image as simulation background
    ImageIcon myIcon = new ImageIcon("background2.jpg");
    JLabel picLabel = new JLabel(myIcon);
    panel2.add(picLabel);
    picLabel.setBounds(0, 0, myIcon.getIconWidth(), myIcon.getIconHeight());
    getLayeredPane().add(picLabel, new Integer.MIN_VALUE);
    panel.setOpaque(false);
    //set content pane to main panel containing all other panels
    setContentPane(panel);
    simGrid.setLayout (new GridLayout (20, 20));
    // create text area to display status after each time step of the simulation
    turnDisplay = new JTextArea("Doodlebug Turn", 10, 40);
    JScrollPane scrollingDisplay = new JScrollPane(turnDisplay);
    simDisplayControls.add(scrollingDisplay);
    turnDisplay.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    //create horizontal box to house status display and "next time step" button
    Box simDisplayBox = Box.createHorizontalBox();
    simDisplayBox.add(Box.createHorizontalGlue());
    simDisplayBox.add(turnDisplay);
    simDisplayBox.add(Box.createHorizontalStrut(40));
    simDisplayBox.add(next);
    simDisplayBox.add(Box.createHorizontalStrut(30));
    //create vertical box to house "start" and "stop" simulation buttons
    Box simControlBox = Box.createVerticalBox();
    simControlBox.add(Box.createVerticalStrut(80));
    simControlBox.add(start);
    simControlBox.add(Box.createVerticalStrut(60));
    simControlBox.add(stop);
    simControlBox.add(Box.createVerticalGlue());
    //create label containing the title of the simulation
    JLabel title = new JLabel("Sim Title");
    //add title label and box containing simulation control buttons to their respective panels
    simDisplay.add(title);
    simControls.add(simControlBox);
    //add box containing status display and "next time step" button to its coresponding panel
    simDisplayControls.add(simDisplayBox);
    //add panels to the main panel
    panel.add(simDisplay, BorderLayout.NORTH);
    panel.add(simGrid, BorderLayout.CENTER);
    panel.add(simControls, BorderLayout.EAST);
    panel.add(simDisplayControls, BorderLayout.SOUTH);
    //set size of the frame
    setSize(800, 700);
    setVisible(true);// make the frame visible
    }

    Don't put the image on the layeredpane, and in fact don't create a class that subclasses JFrame. You're far better off subclassing a JPanel and drawing the image in the JPanel by overriding its paintComponent method, calling drawImage(...) in the same paintComponent method after checking that the image isn't null. Then adding all of your components to this JPanel. Be sure that the JPanels sitting on top of the main JPanel all have their opaque property set to false.
    Then when you're ready to show the app, create a JFrame on the fly, place your JPanel into the JFrame's contentPane, pack the JFrame, set it's location, and show it.
    for instance:
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.net.URL;
    public class Simulation extends JFrame
      //TODO: change this to point to your desired background image
      private static final String BACKGROUND =
        "http://upload.wikimedia.org/wikipedia/" +
        "commons/8/8e/Nebelostfriesland.jpg";
      JPanel panel = new JPanel()
        protected void paintComponent(Graphics g)
          super.paintComponent(g);
          myPaint(g);
      private BufferedImage image;
      private void myPaint(Graphics g)
        if (image != null)
          g.drawImage(image, 0, 0, panel.getWidth(), panel.getHeight(), panel);
      public Simulation()
        try
          // or if using a file on disk, can use a File here or an InputStream
          image = ImageIO.read(new URL(BACKGROUND));
        catch (IOException e)
          e.printStackTrace();
        panel2.setOpaque(false);
        //panel.setOpaque(false);
        simGrid.setOpaque(false); // etc...
    }Edited by: Encephalopathic on Dec 1, 2008 3:23 PM

Maybe you are looking for

  • Online chat, Nov. 12, on Regular Expressions

    One of the new packages added in J2SE v 1.4 is java.util.regex , which provides classes for handling regular exprssions. A regular expression is a string pattern that can be used to perform sophisticated string searching and replacement. Learn more a

  • How do I empty the download log?

    When you download something using Firefox, this small window pops up, showing everything you`ve downloaded. The button on the bottom left corner isn`t working. How can I make it work again?

  • Generate Data subscription only if data present

    Hi, I would like to create an email only when there is data. It's an exception report, so only need to generate an email if there is data. I could possibly do it by selecting the option 'When the report data is updated on the report server' for deliv

  • Send select apdu with jcoop

    Hi, finally i have been able to install the applet in my nokia 6131 NFC! now i want to send a select apdu command. the card-info says that my applet is loaded. Card Manager AID   :  A000000003000000 Card Manager state :  SECURED     Application:  SEL

  • Apogee 16X, Gigas, Sample Rate Conversion, and Summing/Monitoring

    I'm trying to do an update on my home studio rig. I've decided to get the new Quad Core 3g G5. I've decided on the Apogee 16X/Symphony card combo. I need to rout the outputs of six PCs into Logic; One PC is running KYMA/Capybara, one PC will be runni