Load swing applet error
hi
when i load the applet, the message displayed in IE status bar is 'load: Test can't be instantiated' and NS status bar message 'Applet Test exception: java.lang.NullPointerException'.
well here's my simple applet code :
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
public class TestEditor extends JApplet {
JButton
b1 = new JButton("Button 1"),
b2 = new JButton("Button 2");
public void init() {
public TestEditor()
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
cp.add(b1);
cp.add(b2);
here is the html applet tag code :
<APPLET name="myapplet" codebase="." CODE="TestEditor.class" WIDTH=420 HEIGHT=570>
</APPLET>
please if anyone can give me any idea...
Hi,
Just install the JRE plugin from java.sun.com/plugin.
Then you to use this following code for running the applet with plugin.
<EMBED type="application/x-java-applet;version=1.3" width="180" height="20"
align="baseline" code="TestApplet" codebase="/javacall"
MAYSCRIPT=true
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
<NOEMBED>
No JDK 1.2 support for APPLET!!
</NOEMBED>
</EMBED>
Also please refer this URL for HTML Converter.
http://java.sun.com/products/plugin/1.3/docs/html_converter.html
Also please refer Java Plugin HTML Specification.
http://java.sun.com/products/plugin/1.3/docs/tags.html
I hope this will help you.
Thanks
Bakrudeen
Similar Messages
-
Appletviewer cannot load Swing Applet
Hi. there
I'm facing the problem that appleviewer cannot load
my swing applet.
Acctually, a few days ago, before I implemented Button Event Handling, appleviewer work properly.
But now It's not working.
java -verbose appletviewer jadmin.html
-> Exception in thread "main" java.lang.NoClassDefFoundError: appletviewer
I already reinstall JDK1.3 because I chaged java.policy file.
and then this is not a source-level problem, I put into source System.out.pritln(), but not printed.
This is my classpath and path.
[classpath]
.;C:\jdk1.3\jre\lib\rt.jar;C:\jdk1.3\lib\tools.jar;C:\jakarta-tomcat-3.2\lib\servlet.jar;C:\jkjdbc\jkjdbc.jar
[path]
.;C:\jdk1.3\bin;C:\jdk1.3\Jre\bin;C:\Program Files\Microsoft SDK for Java 4.0\Bin
Please Let me Know about it.
Thank you for reading.
p.s In Current source, several inner classes(event handling class), but appletviewer work properly with inner class prev. source that I mentioned.Hi,
You don't have to call java to run the appletviewer. You'll onlyhave to run:
appletviewer jadmin.html
to make it work.
Regards,
Kurt. -
Loading swing applet over another swing applet, how?
hi
My problem is that i have to load an applet in a browser. Then i have to load another applet over it. But that does not happen. The applet is loaded on its side, and the earlier applet is not unloaded and is still visible. And i am calling both the applets from a JSP page. So What can i do to unload the earlier applet.
ThanksHi
Actually, i got two partitions in my browser(with help of <table> tag). In one i have all the hyperlinks, and by clicking on these hyperlinks the corresponding applets are to be displayed in the second part. So what is the way by which i can do that. Note that for this i m not loading a new jsp page. -
When I loading an applet in a website, the brower hangs, and there is a JVM error log generated. am posting the content of the error log below. Could anybody here encounter the same problem? Previous the VM in my notebook is 1.4.2_06, and the problem occurs. Thought it was a problem of the VM, so I upgraded it to 1.5.0_06-b05, the problem is still there.
Following is the content of the error log:
======================================
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d0c5783, pid=3528, tid=1636
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing)
# Problematic frame:
# C [awt.dll+0xc5783]
--------------- T H R E A D ---------------
Current thread (0x09ac59d8): JavaThread "AWT-Windows" daemon [_thread_in_native, id=1636]
siginfo: ExceptionCode=0xc0000005, reading address 0x458b0000
Registers:
EAX=0x458b0000, EBX=0x77e7d142, ECX=0x00003b2c, EDX=0x00ad3704
ESP=0x0ff7fa14, EBP=0x00000111, ESI=0x09b2ce00, EDI=0x00003b2c
EIP=0x6d0c5783, EFLAGS=0x00010206
Top of Stack: (sp=0x0ff7fa14)
0x0ff7fa14: 6d0c1ea8 00003b2c 00000000 00000000
0x0ff7fa24: 0ff7fb00 0005052a 0ff7fa8c 00000000
0x0ff7fa34: 00000001 00000000 09ac5a98 09ac5a98
0x0ff7fa44: 6d6b161f 0ff7fa80 77d7390a 77d99b08
0x0ff7fa54: 0ff7fa80 6d0f3348 00000000 6d0c0948
0x0ff7fa64: 00000111 00003b2c 00000000 0ff7fb00
0x0ff7fa74: 6d0c08f0 00000000 0ff7fa70 0ff7fb10
0x0ff7fa84: 6d0f3330 00000000 0ff7fab8 77d43a50
Instructions: (pc=0x6d0c5783)
0x6d0c5773: b9 ef 01 00 85 c0 75 08 b8 02 00 00 00 c2 0c 00
0x6d0c5783: 8b 10 8b c8 ff 52 04 b8 02 00 00 00 c2 0c 00 50
Stack: [0x0fe80000,0x0ff80000), sp=0x0ff7fa14, free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [awt.dll+0xc5783]
[error occurred during error reporting, step 120, id 0xc0000005]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.awt.windows.WToolkit.eventLoop()V+0
j sun.awt.windows.WToolkit.run()V+69
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x09b2c1e8 JavaThread "AWT-EventQueue-2" [_thread_blocked, id=3032]
0x09ac5558 JavaThread "Keep-Alive-Timer" daemon [_thread_blocked, id=3856]
0x09b30008 JavaThread "Thread-5" [_thread_blocked, id=2780]
0x09a73010 JavaThread "thread applet-DBSlogin2" [_thread_in_native, id=1748]
0x09ae0dc0 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=3448]
0x09b2b5f8 JavaThread "AWT-Shutdown" [_thread_blocked, id=3172]
0x09acb230 JavaThread "traceMsgQueueThread" daemon [_thread_blocked, id=2232]
=>0x09ac59d8 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1636]
0x09ac44c0 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3280]
0x00ae5d00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3208]
0x00ae4948 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3684]
0x00ad17b0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3792]
0x00aeafb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3252]
0x00b691e8 JavaThread "Reference Handler" daemon [_thread_blocked, id=2736]
0x00aee308 JavaThread "main" [_thread_in_native, id=2412]
Other Threads:
0x00aada30 VMThread [id=3760]
0x00ae8f40 WatcherThread [id=2348]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 296K [0x20ad0000, 0x20b70000, 0x21230000)
eden space 512K, 45% used [0x20ad0000, 0x20b0a2e8, 0x20b50000)
from space 64K, 99% used [0x20b50000, 0x20b5ffe0, 0x20b60000)
to space 64K, 0% used [0x20b60000, 0x20b60000, 0x20b70000)
tenured generation total 3208K, used 2006K [0x21230000, 0x21552000, 0x26ad0000)
the space 3208K, 62% used [0x21230000, 0x21425800, 0x21425800, 0x21552000)
compacting perm gen total 8192K, used 2272K [0x26ad0000, 0x272d0000, 0x2aad0000)
the space 8192K, 27% used [0x26ad0000, 0x26d083b0, 0x26d08400, 0x272d0000)
ro space 8192K, 63% used [0x2aad0000, 0x2afdb178, 0x2afdb200, 0x2b2d0000)
rw space 12288K, 46% used [0x2b2d0000, 0x2b869fa8, 0x2b86a000, 0x2bed0000)
Dynamic libraries:
0x00400000 - 0x00419000 C:\Program Files\Internet Explorer\iexplore.exe
0x77f50000 - 0x77ff7000 C:\WINDOWS\System32\ntdll.dll
0x77e60000 - 0x77f46000 C:\WINDOWS\system32\kernel32.dll
0x77c10000 - 0x77c63000 C:\WINDOWS\system32\msvcrt.dll
0x77d40000 - 0x77dcc000 C:\WINDOWS\system32\USER32.dll
0x7e090000 - 0x7e0d1000 C:\WINDOWS\system32\GDI32.dll
0x77dd0000 - 0x77e5d000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll
0x70a70000 - 0x70ad5000 C:\WINDOWS\system32\SHLWAPI.dll
0x71700000 - 0x71849000 C:\WINDOWS\System32\SHDOCVW.dll
0x76390000 - 0x763ac000 C:\WINDOWS\System32\IMM32.DLL
0x629c0000 - 0x629c8000 C:\WINDOWS\System32\LPK.DLL
0x72fa0000 - 0x72ffa000 C:\WINDOWS\System32\USP10.dll
0x71950000 - 0x71a34000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
0x37000000 - 0x37013000 C:\WINDOWS\System32\EntApi.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\System32\PSAPI.DLL
0x71c20000 - 0x71c6e000 C:\WINDOWS\System32\NETAPI32.dll
0x71ab0000 - 0x71ac5000 C:\WINDOWS\System32\WS2_32.dll
0x71aa0000 - 0x71aa8000 C:\WINDOWS\System32\WS2HELP.dll
0x63000000 - 0x63096000 C:\WINDOWS\system32\WININET.dll
0x762c0000 - 0x76348000 C:\WINDOWS\system32\CRYPT32.dll
0x762a0000 - 0x762b0000 C:\WINDOWS\system32\MSASN1.dll
0x77120000 - 0x771ab000 C:\WINDOWS\system32\OLEAUT32.dll
0x771b0000 - 0x772d1000 C:\WINDOWS\system32\OLE32.DLL
0x773d0000 - 0x77bc2000 C:\WINDOWS\system32\SHELL32.dll
0x77340000 - 0x773cb000 C:\WINDOWS\system32\comctl32.dll
0x5ad70000 - 0x5ada4000 C:\WINDOWS\System32\uxtheme.dll
0x53000000 - 0x53013000 C:\PROGRA~1\3721\helper.dll
0x77c00000 - 0x77c07000 C:\WINDOWS\system32\VERSION.dll
0x10000000 - 0x10009000 C:\PROGRA~1\3721\scrblock.dll
0x003d0000 - 0x003d7000 C:\PROGRA~1\3721\alrex.dll
0x37210000 - 0x37283000 C:\WINDOWS\DOWNLO~1\CnsMin.dll
0x76c90000 - 0x76cb2000 C:\WINDOWS\system32\imagehlp.dll
0x00ba0000 - 0x00bcb000 C:\WINDOWS\DOWNLO~1\CnsHint.dll
0x71500000 - 0x715fd000 C:\WINDOWS\System32\BROWSEUI.dll
0x72430000 - 0x72442000 C:\WINDOWS\System32\browselc.dll
0x00c10000 - 0x00c35000 C:\PROGRA~1\3721\autolive.dll
0x1a400000 - 0x1a47a000 C:\WINDOWS\system32\urlmon.dll
0x76670000 - 0x76757000 C:\WINDOWS\System32\SETUPAPI.dll
0x00c50000 - 0x00c7d000 C:\PROGRA~1\3721\alLiveEx.dll
0x75f40000 - 0x75f5f000 C:\WINDOWS\system32\appHelp.dll
0x76fd0000 - 0x77048000 C:\WINDOWS\System32\CLBCATQ.DLL
0x77050000 - 0x77115000 C:\WINDOWS\System32\COMRes.dll
0x00ce0000 - 0x00d0b000 C:\WINDOWS\System32\msctfime.ime
0x746f0000 - 0x74716000 C:\WINDOWS\System32\Msimtf.dll
0x74720000 - 0x74764000 C:\WINDOWS\System32\MSCTF.dll
0x00da0000 - 0x00dad000 C:\WINDOWS\DOWNLO~1\cnsplus.dll
0x76f90000 - 0x76fa0000 C:\WINDOWS\System32\Secur32.dll
0x76620000 - 0x7666e000 C:\WINDOWS\System32\cscui.dll
0x76600000 - 0x7661b000 C:\WINDOWS\System32\CSCDLL.dll
0x76170000 - 0x761f8000 C:\WINDOWS\System32\shdoclc.dll
0x74770000 - 0x747ff000 C:\WINDOWS\System32\mlang.dll
0x71ad0000 - 0x71ad8000 C:\WINDOWS\System32\wsock32.dll
0x75a70000 - 0x75b15000 C:\WINDOWS\system32\userenv.dll
0x76c30000 - 0x76c5b000 C:\WINDOWS\System32\wintrust.dll
0x767f0000 - 0x76814000 C:\WINDOWS\System32\schannel.dll
0x71a50000 - 0x71a8b000 C:\WINDOWS\system32\mswsock.dll
0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll
0x76ee0000 - 0x76f17000 C:\WINDOWS\System32\RASAPI32.DLL
0x76e90000 - 0x76ea1000 C:\WINDOWS\System32\rasman.dll
0x76eb0000 - 0x76edb000 C:\WINDOWS\System32\TAPI32.dll
0x76e80000 - 0x76e8d000 C:\WINDOWS\System32\rtutils.dll
0x76b40000 - 0x76b6c000 C:\WINDOWS\System32\WINMM.dll
0x722b0000 - 0x722b5000 C:\WINDOWS\System32\sensapi.dll
0x02230000 - 0x02431000 C:\WINDOWS\System32\msi.dll
0x75e90000 - 0x75f37000 C:\WINDOWS\System32\SXS.DLL
0x0ffd0000 - 0x0fff3000 C:\WINDOWS\System32\rsaenh.dll
0x76fc0000 - 0x76fc5000 C:\WINDOWS\System32\rasadhlp.dll
0x76f20000 - 0x76f45000 C:\WINDOWS\System32\DNSAPI.dll
0x76fb0000 - 0x76fb7000 C:\WINDOWS\System32\winrnr.dll
0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
0x65af0000 - 0x65af7000 C:\WINDOWS\system32\jsproxy.dll
0x18030000 - 0x1803b000 C:\Program Files\Network Associates\VirusScan\scriptproxy.dll
0x12400000 - 0x12466000 C:\Program Files\Network Associates\VirusScan\mytilus.dll
0x12580000 - 0x12585000 C:\Program Files\Network Associates\VirusScan\Res09\McShield.dll
0x12000000 - 0x121e0000 C:\Program Files\Common Files\Network Associates\Engine\mcscan32.dll
0x6b700000 - 0x6b790000 C:\WINDOWS\System32\JScript.dll
0x73300000 - 0x73375000 C:\WINDOWS\System32\VBScript.dll
0x63580000 - 0x63830000 C:\WINDOWS\System32\mshtml.dll
0x325c0000 - 0x325d2000 C:\Program Files\Microsoft Office\OFFICE11\msohev.dll
0x746c0000 - 0x746e7000 C:\WINDOWS\System32\MSLS31.DLL
0x66880000 - 0x6688a000 C:\WINDOWS\System32\imgutil.dll
0x72d20000 - 0x72d29000 C:\WINDOWS\System32\wdmaud.drv
0x72d10000 - 0x72d18000 C:\WINDOWS\System32\msacm32.drv
0x77be0000 - 0x77bf4000 C:\WINDOWS\System32\MSACM32.dll
0x77bd0000 - 0x77bd7000 C:\WINDOWS\System32\midimap.dll
0x0ffa0000 - 0x0ffc1000 C:\WINDOWS\System32\dssenh.dll
0x73d50000 - 0x73d60000 C:\WINDOWS\System32\cryptnet.dll
0x75150000 - 0x75163000 C:\WINDOWS\System32\Cabinet.dll
0x05160000 - 0x05172000 C:\WINDOWS\DOWNLO~1\CnsHook.dll
0x74cb0000 - 0x74d1f000 C:\WINDOWS\System32\mshtmled.dll
0x71d40000 - 0x71d5b000 C:\WINDOWS\System32\actxprxy.dll
0x30000000 - 0x30222000 C:\WINDOWS\System32\Macromed\Flash\Flash8.ocx
0x763b0000 - 0x763f5000 C:\WINDOWS\system32\comdlg32.dll
0x65000000 - 0x65009000 C:\WINDOWS\System32\ddrawex.dll
0x51000000 - 0x51050000 C:\WINDOWS\System32\DDRAW.dll
0x73bc0000 - 0x73bc6000 C:\WINDOWS\System32\DCIMAN32.dll
0x6d590000 - 0x6d5a2000 C:\Program Files\Java\jre1.5.0_06\bin\npjpi150_06.dll
0x5edd0000 - 0x5edea000 C:\WINDOWS\System32\OLEPRO32.DLL
0x6d400000 - 0x6d417000 C:\Program Files\Java\jre1.5.0_06\bin\jpiexp32.dll
0x6d450000 - 0x6d468000 C:\Program Files\Java\jre1.5.0_06\bin\jpishare.dll
0x6d670000 - 0x6d804000 C:\PROGRA~1\Java\JRE15~1.0_0\bin\client\jvm.dll
0x6d280000 - 0x6d288000 C:\PROGRA~1\Java\JRE15~1.0_0\bin\hpi.dll
0x6d640000 - 0x6d64c000 C:\PROGRA~1\Java\JRE15~1.0_0\bin\verify.dll
0x6d300000 - 0x6d31d000 C:\PROGRA~1\Java\JRE15~1.0_0\bin\java.dll
0x6d660000 - 0x6d66f000 C:\PROGRA~1\Java\JRE15~1.0_0\bin\zip.dll
0x6d000000 - 0x6d167000 C:\Program Files\Java\jre1.5.0_06\bin\awt.dll
0x73000000 - 0x73023000 C:\WINDOWS\System32\WINSPOOL.DRV
0x5c000000 - 0x5c0c8000 C:\WINDOWS\System32\D3DIM700.DLL
0x6d240000 - 0x6d27d000 C:\Program Files\Java\jre1.5.0_06\bin\fontmanager.dll
0x6d1f0000 - 0x6d203000 C:\Program Files\Java\jre1.5.0_06\bin\deploy.dll
0x6d5d0000 - 0x6d5ef000 C:\Program Files\Java\jre1.5.0_06\bin\RegUtils.dll
0x6d3e0000 - 0x6d3f5000 C:\Program Files\Java\jre1.5.0_06\bin\jpicom32.dll
0x6d4c0000 - 0x6d4d3000 C:\Program Files\Java\jre1.5.0_06\bin\net.dll
0x6d1c0000 - 0x6d1e3000 C:\Program Files\Java\jre1.5.0_06\bin\dcpr.dll
VM Arguments:
jvm_args: -Xbootclasspath/a:C:\PROGRA~1\Java\JRE15~1.0_0\lib\deploy.jar;C:\PROGRA~1\Java\JRE15~1.0_0\lib\plugin.jar -Xmx96m -Djavaplugin.maxHeapSize=96m -Xverify:remote -Djavaplugin.version=1.5.0_06 -Djavaplugin.nodotversion=150_06 -Dbrowser=sun.plugin -DtrustProxy=true -Dapplication.home=C:\PROGRA~1\Java\JRE15~1.0_0 -Djava.protocol.handler.pkgs=sun.plugin.net.protocol -Djavaplugin.vm.options=-Djava.class.path=C:\PROGRA~1\Java\JRE15~1.0_0\classes -Xbootclasspath/a:C:\PROGRA~1\Java\JRE15~1.0_0\lib\deploy.jar;C:\PROGRA~1\Java\JRE15~1.0_0\lib\plugin.jar -Xmx96m -Djavaplugin.maxHeapSize=96m -Xverify:remote -Djavaplugin.version=1.5.0_06 -Djavaplugin.nodotversion=150_06 -Dbrowser=sun.plugin -DtrustProxy=true -Dapplication.home=C:\PROGRA~1\Java\JRE15~1.0_0 -Djava.protocol.handler.pkgs=sun.plugin.net.protocol vfprintf
java_command: <unknown>
Launcher Type: generic
Environment Variables:
CLASSPATH=C:\Program Files\Agent Software\lib\jack.jar;.
PATH=C:\PROGRA~1\Java\JRE15~1.0_0\bin;C:\texmf\miktex\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\MATLAB701\bin\win32;C:\PROGRA~1\COMMON~1\SONICS~1\;C:\Program Files\Internet Explorer;;.
USERNAME=ahtan
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 9 Stepping 5, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 1
CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 523248k(135244k free), swap 1279140k(917836k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_06-b05) for windows-x86, built on Nov 10 2005 11:12:14 by "java_re" with MS VC++ 6.0
======================================Hi
My applet suffered from the same Exception, using J2SE1.4.2_01 and J2SE1.4.2_02. My Applet consists of three Jars:
1. The Applet (which uses JCE API / signed with my cert)
2. JCE Provider (reduced to the necessary classes / signed by provider)
3. Unsigned classes
I was able to solve the problem by adding a second signature to the second JAR File (JCE Provider).
My humble conclusion:
Allways sign all classes which need to be signed with your own certificate, even sign those classes wich are allready signed by the JCE Provider.
Hope this helps!
Regards,
Ramon Keller -
Load Applet Error on Sun SPE Pages
Hi,
I have a scenario where I am displaying the IDMXExampleEndUser form on the home page when an SPE user logs in. This form has a field definition for listing resources as follows:
<Field name='resources'>
<Display class='MultiSelect'>
<Property name='title' value='Resources'/>
<Property name='availableTitle' value='Available'/>
<Property name='selectedTitle' value='Available'/>
<Property name='allowedValues'>
<invoke name='getResources' class='com.sun.idm.idmx.ui.FormUtil'>
<ref>context</ref>
</invoke>
</Property>
<Property name='codeBase' value='../../applet/'/>
<Property name='command' value='Recalculate'/>
</Display>
</Field>
However, the resources do not get listed on the web page because of the following applet error.
load: class com.waveset.ui.web.applet.multiselect.class not found.
java.lang.ClassNotFoundException: com.waveset.ui.web.applet.multiselect.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
Please note the lower case in "multiselect.class". This class is however available in idmclient.jar. Is this a known issue ? Please help out.
The list does become available when I change the field's display class from "MultiSelect" to "Select". I would assume this is some problem specific to the MultiSelect implementation class.
Thanks,
SrinivasI suspect the culprit is the codebase setting. As you already know the multiselect class exists in the IDMCLIENT.JAR. The codebase setting is telling it to look in the specified path...where i suspect the jar file does not exist...remove the codebase setting or set it for the correct path.
Hope this helps...
-L -
Error Downloading Plugin for Swing Applet
Dear Fellows!
i am using following Java Script in HTML to download Java Plugin for Swing Applet.
<b>But</b>
During download and installation it gives the error that the file is corrupted try to download again...., I have checked it on more than one PC,s and platforms ....
Please guide if there is problem in script or in the available plugin...
Thanking you !!!!!
/////////////////////// HTML /////////////////
<html>
<head>
<title>Swing Applet</title>
</head>
<body BGCOLOR="#ffffff" LINK="#000099">
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.1 -->
<SCRIPT LANGUAGE="JavaScript"><!--
var info = navigator.userAgent; var ns = false;
var ie = (info.indexOf("MSIE") > 0 && info.indexOf("Win") > 0 && info.indexOf("Windows 3.1") < 0);
//--></SCRIPT>
<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
var ns = (navigator.appName.indexOf("Netscape") >= 0 && ((info.indexOf("Win") > 0 && info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
//--></SCRIPT></COMMENT>
<SCRIPT LANGUAGE="JavaScript"><!--
if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 600 HEIGHT = 500 codebase="http://java.sun.com/products/plugin/1.1.2/jinstall-112-win32.cab#Version=1,1,2,0"><NOEMBED><XMP>');
else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.1.2" java_CODE = "Client.class" java_CODEBASE = "./Chat" java_ARCHIVE = "*.class" WIDTH = 400 HEIGHT = 50 pluginspage="http://java.sun.com/products/plugin/1.1.2/plugin-install.html"><NOEMBED><XMP>');
//--></SCRIPT>
<APPLET CODE = "Client.class" CODEBASE = "./Chat" ARCHIVE = "*.class" WIDTH=600 HEIGHT=500 ></XMP>
<PARAM NAME = CODE VALUE = "Client.class" >
<PARAM NAME = CODEBASE VALUE = "./Chat" >
<PARAM NAME = ARCHIVE VALUE = "Client.class" >
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.1.2">
</APPLET>
</NOEMBED></EMBED></OBJECT>
</body>
</html>I remeber there is an example in Sun java toturial,
you may find the answer from there.
peter
JawaBeginer (A powerful JavaIDE tool for Java Programmer, exp: beginer)
http://www.pivotonic.com -
Swing Applet does not load on Mac OS 9
Hello,
I have written a Swing Applet. I deployed it in Apache TOMCAT and tried to access it using my iMac, running Mac OS 9. I have installed swingall.jar on my Mac so I have no problem running some sample Swing Applet from Sun's website. However, when I try to access my Swing applet, the following is shown in the "Java Messages" file:
1/20/2003 @ 11:39:1
An exception occurred:
java.lang.ClassNotFoundException: com.my.package.gui.Main
at com.apple.mrj.JManager.JMAppletClassLoader_IMPL.loadClass (JMAppletClassLoaderOld.java)
at com.apple.mrj.JManager.JMAppletClassLoader_IMPL.loadClass(JMAppletClassLoaderOld.java)
at com.apple.mrj.JManager.JMAppletClassLoader_ROOT.loadClass(JMAppletClassLoaderOld.java)
at com.apple.mrj.JManager.JMAppletViewer_OLD.doLoadCode(JMAppletViewerOld.java)
at com.apple.mrj.JManager.JMAppletViewer_OLD.setState(JMAppletViewerOld.java)
at com.apple.mrj.JManager.JMViewerEvent.post(JMAppletViewerOld.java)
at com.apple.mrj.JManager.AVDispatcherThread.run(JMAppletViewerOld.java)
Does anyone have a clue? Please help.
Thanks,
A.A.aau2002 -- I have a simple applet using swing which I compiled with OSX, moved the class file to my desktop, installed the Swing stuff for OS 9.
My html file is as follows:
<HTML>
<HEAD></HEAD>
<BODY>
<hr>
<applet name="main applet" codebase="." code="DrawField.class" width=200 height=200 </applet>
<hr>
</BODY>
</HTML>
My applet never loads with the ClassNotFoundException
I must not have correctly installed the swing stuff...
Any suggestions? Thanks VERY much in advance. -
I downloaded and installed j2se_1.4.1. Now every time I go to a site which needs the java applet, it gives "error loading java applet" (or something like that). I already uninstalled it and reinstalled it, but I keep getting that error. Can someone help me out please??
I use win XP home and Internet Eplorer 6
thanxI also have the same problem!
can someone help us PLEASE ?!!! -
Loading Java Applet... error
Hi!
When I try to run the Sun demo SwingSet2, IE(5.0) hangs.
First I installed JRE 1.3.1(on advice of the demo site.)
Then it all end up with the text "Loading Java Applet..."
in the grey box.
I have also tried to install different JRE versions but I just can't run a Sun demo applet (neither my own applets).
I would be very happy if someone could solve this problem.
/Jonas
InternetExplorer: 5.00.3315.1000
Windows 2000Hi:
I just have a comment and one last suggestion.
First, I am able to run the SwingSet2Plugin.html with both IE5.0 and IE5.5 on Windows 98SE. I am currently using JDK/JRE1.3.1. A few months ago, I upgraded to 1.3.1_02 and found that some of my applets stopped working for no apparent reason, so I went back to 1.3.1.
If your applets stopped working because of an upgrade in JDK or JRE and you're using Windows, I suggest that you make sure that the previous version of the JDK/JRE were cleanly removed from the system. You can verify this by going to the Control Panel and click on Add/Remove Program to see if there are multiple versions of the software. Also, click start, run REGEDIT and look in the following folder for any remaining references to the JDK/JRE:
HKEY_LOCAL_MACHINE-->Software-->Microsoft-->Code Store Database-->Distribution Units
look for something with {...} or the prefix {CAFE... and remove any remaing older versions (I know most people wouldn't touch regedit with a ten-foot pole but this may be the only way to solve the problem).
I use a lot of applet and am particularly interested in cases where ppl have problems with using applet and find out how the problems are resolved. If my suggestions worked or if you find out what caused the problem, I would appreciate your sharing the info.
Good Luck!
V.V.
-
How to load an applet jar file?
Hello everyone,
I have an applet that uses my own jar file and approximately 6 third party jar files. I set up jar indexing (jar -i) which will download the jar files when they are needed. All seems to work well, but now I want to manually load the jar files which I cannot get working.
When the applet starts, about 1/2 of the jar files are downloaded (because they are needed at startup). I then want to load the additional jar files in the background, after the gui is initialized. I have tried this using the below thread which is executed from within the applet's start method:
// Try to load additional jar files in background by loading a class from each jar file.
Thread loadClass = new Thread() {
public void run() {
System.out.println("Loading classes...");
try {
// Tried loading classes this way, doesn't work.
getClass().getClassLoader().loadClass("pkg1.Class1");
getClass().getClassLoader().loadClass("pkg2.Class2");
getClass().getClassLoader().loadClass("pkg3.Class4");
getClass().getClassLoader().loadClass("pkg4.Class4");
/* Loading classes this way doesn't work either.
Class.forName("pkg1.Class1");
Class.forName("pkg2.Class2");
Class.forName("pkg3.Class3");
Class.forName("pkg4.Class4");
catch(ClassNotFoundException e) {
// First attempt to load a class (pkg1.Class1) throws exception.
System.out.println("Can't find class: " + e.getMessage());
loadClass.start();As you can see from above I am trying to load a class from each of the jar files so that the jar files would load into memory/cache. Unfortunately, it cannot find the classes. These are the errors from the java console:
Loading classes...
Loading: pkg1.Class1
Connecting http://my.server.com/my_dir/pkg1/Class1.class with no proxy
Connecting http://my.server.com/my_dir/pkg1/Class1.class with cookie "JSESSIONID=some_big_long_char_list"
Can't find class: pkg1.Class1
So it appears the jar file is not being downloaded. When I take away the dynamic jar loading (removing the "jar -i" & adding them all to the applet archive list) the thread executes correctly. So I know the class names, etc, are correct. How does one load an applet jar file?
Any help/suggestions are appreciated.The above error I posted was because I forgot to index the jar files. That is why it couldn't find the jar file. I thought I was getting farther along with my problem, but I apparently just forgot to index the jars. I am now getting the problem that I got yesterday...
The applet freezes/hangs when it hits the thread. The GUI never opens (even though I'm running this thread right after the gui shows). The java console quits responding and the applet just stays the grey screen. I also tried the invoke later that you suggested.
public void start() {
// ...initialize gui...
// Applet freezes and remains grey, also the java console freezes.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
System.out.println("Loading classes...");
try {
// When I comment out the below forName calls, the thread will still run evidenced through the done print statement.
Class.forName("pkg1.Class1");
Class.forName("pkg2.Class2");
Class.forName("pkg3.Class3");
Class.forName("pkg4.Class4");
System.out.println("...Done loading classes");
catch(Exception e) {
System.out.println("Can't find class: " + e.getMessage());
} -
Applet Error:java.security.AccessControlException: access denied
Hi,
I just successful deploy an business component project to oralce 8.1.6 as an EJB Session bean, and
the test of application module is successful. In the same workspace, I create an new project with
an applet(which contains only an grid control)as a client of the business component. Everything works
fine within the Applet viewer, however, when I trying to load the applet in IE5.5 I got the following
error message in java console:
Java(TM) Plug-in
Using JRE version 1.2.1
User home directory = D:\Documents and Settings\ERic
Proxy Configuration: no proxy
JAR cache enabled.
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.debugoutput read)'
Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.timing read)'
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.function read)'
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.level read)'
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.linecount read)'
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.trace.threshold read)'
Failed to query environment: 'access denied (java.util.PropertyPermission jbo.jdbc.driver.verbose read)'
java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission org.omg.CORBA.ORBClass read)
at java.security.AccessControlContext.checkPermission(Compiled Code)
at oracle.aurora.jndi.orb_dep.Orb.<clinit>(Orb.java:24)
at oracle.aurora.jndi.sess_iiop.sess_iiopURLContext.<clinit>(sess_iiopURLContext.java:9)
at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:588)
at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:537)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:274)
at javax.naming.InitialContext.lookup(InitialContext.java:349)
at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.connectToService(AuroraEJBAmHomeImpl.java:179)
at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.createSession(AuroraEJBAmHomeImpl.java:152)
at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.initRemoteHome(AuroraEJBAmHomeImpl.java:123)
at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.<init>(AuroraEJBAmHomeImpl.java:59)
at oracle.jbo.client.remote.ejb.aurora.AuroraEJBInitialContext.createJboHome(AuroraEJBInitialContext.java:47)
at oracle.jbo.common.JboInitialContext.lookup(JboInitialContext.java:72)
at javax.naming.InitialContext.lookup(InitialContext.java:349)
at oracle.dacf.dataset.SessionInfo._createAppModule(SessionInfo.java:2330)
at oracle.dacf.dataset.SessionInfo.connect(SessionInfo.java:1799)
at oracle.dacf.dataset.SessionInfo.openProducerObject(SessionInfo.java:1848)
at oracle.dacf.dataset.ProducerObject.open(ProducerObject.java:94)
at oracle.dacf.dataset.SessionInfo.publishSession(SessionInfo.java:1305)
at oracle.dacf.dataset.SessionInfo.publishSession(SessionInfo.java:1287)
at broadcastapplet.myBroadCastApplet.init(myBroadCastApplet.java:70)
at sun.applet.AppletPanel.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479)
The Oracle 8.1.6 runs on Win2000, I put the JAR & related zip files in the same machine's IIS webserver.
Is anyone can help?
ERicHi Shaji,
Are you calling a webservice from within an Xacute Query for your applet? On first glance, it looks like a web service call is being rejected due to security permissions. If you have a webservice call (or HTTP post/get), can you test it separately with the same credentials as the webpage is using?
Regards,
Mike -
Unable to download images in a swing applet (1.3.1) behind proxy
Hi
One of my client have a proxy server and firewall and when they try to access my webserver
then all the AWT applet are downloaded and rendered on client properly. However, the swing applet written
using JDK 1.3.1 is downloaded and rendered but it doesn't display anything properly as images
are not down loaded. I have used media tracker to add images to it like oMediaTracker.addImage( oImage, index );
and then oMediaTracker.waitForAll();
Java console display at client looks as follows:
Java(TM) Plug-in: Version 1.3.1
Using JRE version 1.3.1 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\toy
Proxy Configuration: no proxy
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
q: hide console
s: dump system properties
t: dump thread list
x: clear classloader cache
0-5: set trace level to <n>
Applet Initialization start...
Applet Image Initialization start...
Trace level set to 5: basic, net, security, ext, liveconnect ... completed.
Opening http:MyServer/24/x.gif
Connecting http:MyServer/24/x.gif with no proxy
Connecting
http:MyServer/24/x.gif with cookie "ASPSESSIONIDGQGQQVWC=DLNBDAOABFANEPJFFIGOOIPG;
JSESSIONID=25Ais2tF1eBkevUhAa2akocfShzNdzyL7yC1I7UhJl7Z6BLZrnQK!
-1149265879"
Opening http:MyServer/40/y.gif
Connecting http:MyServer/40/y.gif with no proxy
Connecting http:MyServer/40/y.gif with cookie "ASPSESSIONIDGQGQQVWC=DLNBDAOABFANEPJFFIGOOIPG;
JSESSIONID=25Ais2tF1eBkevUhAa2akocfShzNdzyL7yC1I7UhJl7Z6BLZrnQK!
-1149265879"
Opening http://MyServer/sun/beans/infos/PanelBeanInfo.class
Connecting http://MyServer/sun/beans/infos/PanelBeanInfo.class with no proxy
Connecting http://MyServer/sun/beans/infos/PanelBeanInfo.class with cookie "ASPSESSIONIDGQGQQVWC=DLNBDAOABFANEPJFFIGOOIPG;
JSESSIONID=25Ais2tF1eBkevUhAa2akocfShzNdzyL7yC1I7UhJl7Z6BLZrnQK!
-1149265879"
Opening http://MyServer/java/awt/ContainerBeanInfo.class
Connecting http://MyServer/java/awt/ContainerBeanInfo.class with no proxy
Connecting http://MyServer/java/awt/ContainerBeanInfo.class
Client machine tries to access these images but i never receive a call at web server end when i see
IIS log.
CLient environment:
-Windows 2000/XP/NT
-Internet explorer 6.0 SP1 or IE 5.5 SP2
with connection->LAN Setting->Use Automatic configuration script(only checked)
-Java Plugin configured like proxies->Use Browser Setting
-JDK 1.3.1 plug in at client(downloaded and Installed automatically on demand)
-Object tag used to download applet and plugin
-Firewall and proxy(i don't know about vendor)
My webserver environment
Windows 2000/iis 5.0 with anonymous authentication and
cache-control header set to no-store (so that proxy doesn't cache anything)
QUESTIONS:
~~~~~~~~~
Q.1. When i try from home network that has a proxy then everything works fine. At client site everything except
image download works fine. I mean jars are downloaded and i can see anything drawn using JAVA API.
When i try from home i see following java console trace
Java(TM) Plug-in: Version 1.3.1
Using JRE version 1.3.1 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\wuko
Proxy Configuration: Automatic Proxy Configuration
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
q: hide console
s: dump system properties
t: dump thread list
x: clear classloader cache
0-5: set trace level to <n>
Trace level set to 5: basic, net, security, ext, liveconnect ... completed.
Applet Initialization start...
Applet Image Initialization start...
Opening http://MyServer/24/connec.gif
Connecting http://MyServer/24/connec.gif with proxy=197.168.1.100:808
Connecting http://MyServer/24/connec.gif with cookie "ASPSESSIONIDQQGQQCYU=GBJFAOABCJFPDMGFHEKLDACA; JSESSIONID=26yu5m1b4upVuXoAoDmtMbWXQmetQpyzqjFANszo9vFubujT4qGX!-1149265879"
Opening http://MyServer/24/cool.gif
Connecting http://MyServer/24/cool.gif with proxy=197.168.1.100:808
Connecting http://MyServer/24/cool.gif with cookie "ASPSESSIONIDQQGQQCYU=GBJFAOABCJFPDMGFHEKLDACA; JSESSIONID=26yu5m1b4upVuXoAoDmtMbWXQmetQpyzqjFANszo9vFubujT4qGX!-1149265879"
etc
I can't set the plugin at client to use automatic script just like IE browser uses. This option is not supported in JRE1.3.1. Looks to be supported in JRE1.4.1. My client doesn't want to set manual proxy ip and port in plugin as they don't want to reveal this info to everyone within the company for security reason.
Q.2. Why some classes like PanelBeanInfo.class, JAppletBeanInfo.class are downloaded
from my server while it doesn't exist at my webserver. Any thing stupid IE or plugin doing
at client. Any Idea?
Thanks in advance for any help.
RatanThanks to Mike and other friends who already replied on this topic.
Here is my research analysis:
Answer to Question 1:
~~~~~~~~~~~~~~~~~~~~~
The solution is to bundle all the images with JAR. Bundle with jar whichever needs it. However, it might require duplicacy.
Image img = null;
try
img = Toolkit.getDefaultToolkit().getImage(getClass().getResource(fileName));
catch (Exception e) { }
In this case make sure that you have image at the same location where you access it. For example if you have to access an image in package class com.awt.ui.MyClass then your image should also be at location ..\com\awt\ui
Note: It will require image duplicacy in your JAR but it solves the problem. It gives the advantage of fewer download from server.
Answer to Question 2:
~~~~~~~~~~~~~~~~~~~~~
IE treats applet as an active-X and try to look for these classes in your JAR. SUN has stopped its support in JDK1.3.1 and plus. What one can do is to create dummy classes with these names and bundle it with your JAR. You have to create these dummy classes if you enable Basic authentication on your web server then browser will try to look for these classes on the server and continue to prompt you for login and password. It might bother your customer un-necessarily to enter login and password too many times prompted by plug-in (plug in).
--Ratan -
hi there,
I am a student at the University of Portsmouth in the UK in my third and last year. I am doing my dissertation as a game using applets for a client at the university of which there consits four prototypes. One of the main specification points is that it should work on an apple mac, therefore I am using Swing applets. however with my first prototype it works fine on windows in windows Explorer, firefox and Netscape but i cant get it to work on Mac os 9 or X even with the latest version of java installed on the machine. Can anyone tell me why this is so, I would be very gratefull.
As I cant post the whole applet here as a file download I will just put some code snippets of the main program classes.
Applet ------------------------------
* Class JugglingBalls - A sub class of JApplet that combines the GameInterface and GamePanel into a single application
* @author (Liam Morren)
* @version (v1.0)
import java.awt.*;
import javax.swing.*;
public class JugglingBalls extends JApplet
// instance variables -----------------------------------------------------------------------------------------------------------------------------------
private GamePanel gamePanel; // The game panel including game and render loop
private GameInterface gameInterface; // The swing interface to modify the game scene components
// JApplet methods -------------------------------------------------------------------------------------------------------------------------------------
* Called by the browser or applet viewer to inform this JApplet that it
* has been loaded into the system. It is always called before the first
* time that the start method is called.
public void init()
gamePanel = new GamePanel();
gameInterface = new GameInterface(gamePanel.getGameScene());
Container content = getContentPane(); // The container for components in the applet
setLayout(new BoxLayout(content, BoxLayout.X_AXIS));
content.add(gamePanel);
content.add(gameInterface);
* Returns information about this applet.
* An applet should override this method to return a String containing
* information about the author, version, and copyright of the JApplet.
* @return a String representation of information about this JApplet
public String getAppletInfo()
// provide information about the applet
return "Title: JugglingBalls \nAuthor: Liam Morren \nA simple application showing balls juggling in the air.";
Interface -------------------------------------
* Class GameInterface - Lets you manipulate the game components using swing components
* @author (Liam Morren)
* @version (v1.0)
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class GameInterface extends JPanel
// instance variables -------------------------------------------------------------------------------------------------------------------------------------
private GameScene gameScene; // Reference to the game scene
private JTabbedPane gameTabs; // Tabs for Game, Balls and Background
// Scene panel
JButton pause, start, reset; // Buttons
// Balls panel
JRadioButton redBall, greenBall, blueBall, archBall, figureOfEightBall; // Radio buttons
JCheckBox canSplit; // Check box
JComboBox setAllPaths, setAllTypes, newBall, selectBall; // Drop down boxes
JButton deleteBall; // Button
Ball currentBall; // Current ball being changed
// Background panel
JRadioButton black, white, red, green, blue, hide, show, stop, move, arch, figureOfEight; // Radio buttons
// Constructors -------------------------------------------------------------------------------------------------------------------------------------------
* Constructor for objects of class GameInterface
public GameInterface(GameScene gameSceneIn)
gameScene = gameSceneIn; // Reference to the game scene
gameTabs = new JTabbedPane(); // JTabbedPane to hold different toolbars
gameTabs.setPreferredSize(new Dimension(200, 494)); // Set the preffered size for the tabbed pane
currentBall = gameScene.getBall(0); // First ball
// Add the panels to the tabbed pane
gameTabs.addTab("Scene", makeScenePanel());
gameTabs.addTab("Balls", makeBallsPanel());
gameTabs.addTab("Background", makeBackgroundPanel());
add(gameTabs); // Add the tab to the game interface panel
setPreferredSize(new Dimension(200, 200));
// Other methods ------------------------------------------------------------------------------------------------------------------------------------------
* makeScenePanel
* @return JPanel - The scene panel with buttons added
private JPanel makeScenePanel()
// Make scene panel
JPanel scenePanel = new JPanel();
scenePanel.setLayout(new BoxLayout(scenePanel, BoxLayout.Y_AXIS)); // Change layout
pause = new JButton("Pause"); // Make buttons
start = new JButton("Start");
reset = new JButton("Reset");
// Add button actions
pause.addActionListener(new ActionListener() // Add button listener to pause button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.setPaused(true); // Pause game
start.addActionListener(new ActionListener() // Add button listener to start button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.setPaused(false); // Unpause game
reset.addActionListener(new ActionListener() // Add button listener to reset button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.reset(); // Reset game
updateSelectBallComboBox();
changeSelectedBall(0);
scenePanel.add(pause); // Add buttons to scene panel
scenePanel.add(start);
scenePanel.add(reset);
return scenePanel;
* makeBackgroundPanel
* @return JPanel - The background panel with buttons added
private JPanel makeBackgroundPanel()
// Make scene panel
JPanel backgroundPanel = new JPanel();
backgroundPanel.setLayout(new GridLayout(5, 1, 2, 2)); // Change layout
// Make buttons
// background colour buttons
JPanel backgroundcolour = new JPanel(); // Change backgroundcolour panel
backgroundcolour.setBorder(BorderFactory.createLineBorder(Color.black));
black = new JRadioButton("Black"); // Radio buttons to change colour
white = new JRadioButton("white");
black.setSelected(true); // Set black as already selected
ButtonGroup backColourGroup = new ButtonGroup(); // Group buttons so only one can be pressed at a time
backColourGroup.add(black); // Add buttons to group
backColourGroup.add(white);
backgroundcolour.setLayout(new GridLayout(2, 2, 0, 0)); // Change layout
backgroundcolour.add(new JLabel("Background colour")); // Add label
backgroundcolour.add(black); // Add buttons to colours panel
backgroundcolour.add(white);
// Add radio button actions
black.addActionListener(new ActionListener() // Add button listener to black button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.setBackgroundColour(false); // Background colour = black
white.addActionListener(new ActionListener() // Add button listener to white button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.setBackgroundColour(true); // Background colour = white
// colour buttons
JPanel colours = new JPanel(); // Change colours panel
colours.setBorder(BorderFactory.createLineBorder(Color.black));
red = new JRadioButton("Red"); // Radio buttons to change colour
green = new JRadioButton("Green");
green.setSelected(true); // Set green as already selected
blue = new JRadioButton("Blue");
ButtonGroup colourGroup = new ButtonGroup(); // Group buttons so only one can be pressed at a time
colourGroup.add(red); // Add buttons to group
colourGroup.add(green);
colourGroup.add(blue);
colours.setLayout(new GridLayout(2, 2, 0, 0)); // Change layout
colours.add(new JLabel("Change colours")); // Add label
colours.add(red); // Add buttons to colours panel
colours.add(green);
colours.add(blue);
// Add radio button actions
red.addActionListener(new ActionListener() // Add button listener to red button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (gameScene.getBackgroundEffect().getColour() != 0)
gameScene.getBackgroundEffect().setColour(0); // Background effect colour = red
green.addActionListener(new ActionListener() // Add button listener to green button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (gameScene.getBackgroundEffect().getColour() != 1)
gameScene.getBackgroundEffect().setColour(1); // Background effect colour = green
blue.addActionListener(new ActionListener() // Add button listener to blue button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (gameScene.getBackgroundEffect().getColour() != 2)
gameScene.getBackgroundEffect().setColour(2); // Background effect colour = blue
// hide buttons
JPanel hideShow = new JPanel(); // Change hideShow panel
hideShow.setBorder(BorderFactory.createLineBorder(Color.black));
hide = new JRadioButton("Hide"); // Radio buttons to hide show
show = new JRadioButton("Show");
show.setSelected(true); // Set show as already selected
ButtonGroup hideShowGroup = new ButtonGroup(); // Group buttons so only one can be pressed at a time
hideShowGroup.add(hide); // Add buttons to group
hideShowGroup.add(show);
hideShow.setLayout(new GridLayout(2, 2, 0, 0)); // Change layout
hideShow.add(new JLabel("Hide / Show")); // Add label
hideShow.add(hide); // Add buttons to hideShow panel
hideShow.add(show);
// Add radio button actions
hide.addActionListener(new ActionListener() // Add button listener to hide button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.getBackgroundEffect().hide(); // Hide
show.addActionListener(new ActionListener() // Add button listener to show button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.getBackgroundEffect().unHide(); // Unhide
// stopMove buttons
JPanel stopMove = new JPanel(); // Change StopMove panel
stopMove.setBorder(BorderFactory.createLineBorder(Color.black));
stop = new JRadioButton("Stop"); // Radio buttons to stop move
move = new JRadioButton("Move");
stop.setSelected(true); // Set stop as already selected
ButtonGroup stopMoveGroup = new ButtonGroup(); // Group buttons so only one can be pressed at a time
stopMoveGroup.add(stop); // Add buttons to group
stopMoveGroup.add(move);
stopMove.setLayout(new GridLayout(2, 2, 0, 0)); // Change layout
stopMove.add(new JLabel("Stop / Move")); // Add label
stopMove.add(stop); // Add buttons to stopMove panel
stopMove.add(move);
// Add radio button actions
stop.addActionListener(new ActionListener() // Add button listener to stop button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.getBackgroundEffect().setMove(false); // stop
move.addActionListener(new ActionListener() // Add button listener to move button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.getBackgroundEffect().setMove(true); // move
// changePath buttons
JPanel changePath = new JPanel(); // Change changePath panel
changePath.setBorder(BorderFactory.createLineBorder(Color.black));
arch = new JRadioButton("Arch"); // Radio buttons to change path
figureOfEight = new JRadioButton("Figure of eight");
arch.setSelected(true); // Set stop as already selected
ButtonGroup changePathGroup = new ButtonGroup(); // Group buttons so only one can be pressed at a time
changePathGroup.add(arch); // Add buttons to group
changePathGroup.add(figureOfEight);
changePath.setLayout(new GridLayout(2, 2, 0, 0)); // Change layout
changePath.add(new JLabel("Change Path")); // Add label
changePath.add(arch); // Add buttons to changePath panel
changePath.add(figureOfEight);
// Add radio button actions
arch.addActionListener(new ActionListener() // Add button listener to arch button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.getBackgroundEffect().setPath(new Arch()); // Arch
figureOfEight.addActionListener(new ActionListener() // Add button listener to figureOfEight button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
gameScene.getBackgroundEffect().setPath(new FigureOfEight()); // Figure of eight
// Add components to background panel
backgroundPanel.add(backgroundcolour);
backgroundPanel.add(colours);
backgroundPanel.add(hideShow);
backgroundPanel.add(stopMove);
backgroundPanel.add(changePath);
return backgroundPanel;
* makeBallsPanel
* @return JPanel - The ball panel with buttons added
private JPanel makeBallsPanel()
// Make balls panel
JPanel ballsPanel = new JPanel();
ballsPanel.setLayout(new BoxLayout(ballsPanel, BoxLayout.Y_AXIS)); // Change layout
// Make buttons
// set all drop down boxes
JPanel setAll = new JPanel(); // Set all panel
setAll.setBorder(BorderFactory.createLineBorder(Color.black));
String[] setAllPathsChoices = {"Arch", "Figure of eight"}; // Selections for set all paths
setAllPaths = new JComboBox(setAllPathsChoices); // Add selections to combo box
String[] setAllTypesChoices = {"Primary ball", "Pastel ball", "3D ball", "Image ball"}; // Selections for set all types
setAllTypes = new JComboBox(setAllTypesChoices); // Add selections to combo box
setAll.add(new JLabel("Set all paths")); // Add combo boxes to set all panel
setAll.add(setAllPaths);
setAll.add(new JLabel("Set all types"));
setAll.add(setAllTypes);
// Add combo box actions
setAllPaths.addActionListener(new ActionListener() // Add selection listener to set all paths combo box
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (setAllPaths.getSelectedItem() == "Arch")
gameScene.setAllPathsArch();
else
gameScene.setAllPathsFigureOfEight();
setAllTypes.addActionListener(new ActionListener() // Add selection listener to set all types combo box
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (setAllTypes.getSelectedItem() == "Primary ball")
gameScene.setAllTypesPrimaryBall();
else if (setAllTypes.getSelectedItem() == "Pastel ball")
gameScene.setAllTypesPastelBall();
else if (setAllTypes.getSelectedItem() == "Image ball")
gameScene.setAllTypesImageBall();
else
gameScene.setAllTypesBall3D();
// new ball drop down box
JPanel newBallPanel = new JPanel(); // new ball panel
newBallPanel.setBorder(BorderFactory.createLineBorder(Color.black));
String[] newType = {"Primary ball", "Pastel ball", "3D ball", "Image ball"}; // Selections for new ball
newBall = new JComboBox(newType); // Add selections to combo box
newBallPanel.add(new JLabel("New ball")); // Add combo boxes to new ball panel
newBallPanel.add(newBall);
// Add combo box actions
newBall.addActionListener(new ActionListener() // Add selection listener to newBall combo box
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
String ballType = (String) newBall.getSelectedItem();
if (ballType == "Primary ball")
gameScene.addBall(new PrimaryBall(gameScene));
else if (ballType == "Pastel ball")
gameScene.addBall(new PastelBall(gameScene));
else if (ballType == "Image ball")
gameScene.addBall(new ImageBall(gameScene));
else
gameScene.addBall(new Ball3D(gameScene));
updateSelectBallComboBox();
changeSelectedBall(gameScene.getBalls().size() - 1); // Update interface to show new ball
// selected ball panel
JPanel selectedBallPanel = new JPanel(); // selected ball panel
selectedBallPanel.setBorder(BorderFactory.createLineBorder(Color.black));
// Select ball
selectBall = new JComboBox(gameScene.getBallList()); // Add ball list to the select drop down box
deleteBall = new JButton("DeleteBall"); // Delete button
// Ball colour
redBall = new JRadioButton("Red"); // Red choice
redBall.setSelected(true); // Start as selected
greenBall = new JRadioButton("Green"); // Green choice
blueBall = new JRadioButton("Blue"); // Blue choice
ButtonGroup ballColour = new ButtonGroup(); // So only one colour can be selected at a tim
ballColour.add(redBall);
ballColour.add(greenBall);
ballColour.add(blueBall);
// Path
archBall = new JRadioButton("Arch"); // Arch path choice
archBall.setSelected(true); // Start as selected
figureOfEightBall = new JRadioButton("Figure of eight"); // Figure of eight path choice
ButtonGroup ballPath = new ButtonGroup(); // So only one path can be selected at a tim
ballPath.add(archBall);
ballPath.add(figureOfEightBall);
// Can split
canSplit = new JCheckBox("Can split", false); // Initialy not selected
selectedBallPanel.add(new JLabel("Select ball")); // Add components to selected ball panel
selectedBallPanel.add(selectBall);
selectedBallPanel.add(deleteBall);
selectedBallPanel.add(new JLabel("Ball colour"));
selectedBallPanel.add(redBall);
selectedBallPanel.add(greenBall);
selectedBallPanel.add(blueBall);
selectedBallPanel.add(new JLabel("Path"));
selectedBallPanel.add(archBall);
selectedBallPanel.add(figureOfEightBall);
selectedBallPanel.add(canSplit);
// Add select ball drop down box action
selectBall.addActionListener(new ActionListener() // Add selection listener to selectBall combo box
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
changeSelectedBall(selectBall.getSelectedIndex()); // Change the selected ball using the index from the select ball drop down box
// Add delete button action
deleteBall.addActionListener(new ActionListener() // Add selection listener to deleteBall button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
int tempIndex = selectBall.getSelectedIndex(); // Temp index
if (gameScene.getBalls().size() > 1) // If there is more than 1 ball left
gameScene.removeBall(tempIndex); // Remove ball
updateSelectBallComboBox(); // Update with new ball list
changeSelectedBall(tempIndex - 1); // Update interface with new current selected ball
// Add radio button colour actions
redBall.addActionListener(new ActionListener() // Add button listener to redBall button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (currentBall.getColour() != 0)
currentBall.setColour(0); // currentBall colour = red
greenBall.addActionListener(new ActionListener() // Add button listener to greenBall button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
if (currentBall.getColour() != 1)
currentBall.setColour(1); // currentBall colour = green
blueBall.addActionListener(new ActionListener() // Add button listener to blueBall button
public void actionPerformed(ActionEvent ev) // Background colour = blue
if (currentBall.getColour() != 2)
currentBall.setColour(2); // currentBall colour = blue
// Add path radio button actions
archBall.addActionListener(new ActionListener() // Add button listener to arch button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
currentBall.setPath(new Arch()); // Arch
figureOfEightBall.addActionListener(new ActionListener() // Add button listener to figureOfEight button
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
currentBall.setPath(new FigureOfEight()); // Figure of eight
// Add can split check button actions
canSplit.addActionListener(new ActionListener() // Add button listener to can split
public void actionPerformed(ActionEvent ev) // Overide actionPerformed() method
currentBall.setCanGiveBirth(canSplit.isSelected()); // Ball can split if can split check button is selected
// Add components to ball panel
ballsPanel.add(setAll);
ballsPanel.add(newBallPanel);
ballsPanel.add(selectedBallPanel);
return ballsPanel;
* changeSelectedBall
* @param ballIndexIn - The numbered index of the ball in the game scene list of balls. If less than 0 then equals 0. If more than ball list size then equals last ball
public void changeSelectedBall(int ballIndexIn)
if (ballIndexIn < 0) // Make sure index is within bounds
ballIndexIn = 0;
else if (ballIndexIn >= gameScene.getBalls().size())
ballIndexIn = gameScene.getBalls().size() - 1; // Else put within bounds at either end
currentBall.highlight(false); // Unhighlight current ball
currentBall = gameScene.getBall(ballIndexIn); // Get new current ball
currentBall.highlight(true); // Highlight new current ball
// Update controls to new ball
selectBall.setSelectedIndex(ballIndexIn);
switch (currentBall.getColour()) // Update colour controls
case 0: redBall.setSelected(true); break;
case 1: greenBall.setSelected(true); break;
default: blueBall.setSelected(true); break;
if (currentBall.getPath() instanceof Arch) // If path is arch
archBall.setSelected(true); // Update controls as arch
else
figureOfEightBall.setSelected(true); // Else figure of eight
canSplit.setSelected(currentBall.canGiveBirth()); // Set if the ball can split or not
* updateSelectBallComboBox
* This method updates the combo box selection model with a new one made from the updated balls arraylist from the game scene
public void updateSelectBallComboBox()
DefaultComboBoxModel model = new DefaultComboBoxModel(gameScene.getBallList());
selectBall.setModel(model);
}Kind regards
Liam morrenhttp://docs.info.apple.com/article.html?artnum=301073
This link states Mac OS X 10.4 now supports Java 5.0. It does mention nothing about Mac OS 9 or previous version of OS X. The problem you may be facing is that your Mac is running only 1.4.2 or less. The class files compiled for Java 5.0 can't run in non 5.0 versions of the Java Virtual Machine. Java 5.0 was a major release for the Java language and thus the change in numbering (though it took a little bit for this to change).
Anyway you should confirm what version of Java you have installed on your Mac.
At a command prompt:
java -version
The above URL states that the previous 1.4.2 Java version is not uninstalled, and this could still be the preferred version to use for Java applications even after installing Java 5.0.
The URL above states there is a utility to set your apps to use Java 5.0 as the perferred Java version. Who knows maybe this is all you need to do. I hope this is the case, then it probably is an easy fix, otherwise you may need to rewrite your app in Java 1.4.2 to get it to run on your version of Mac. -
ClassFormatError when attempting to load an applet from within a JSP
Greetings everyone.
I have a problem that i seem unable to solve.
I've created a web application. I'm using Java 1.4.2_05 and Tomcat. Right now i'm trying to load an applet from a JSP and i'm getting an error that, try as i might, i can't understand why it happens.
Here is some detailed info:
The applet's code:
package smpb.myapp.controllers;
import java.applet.Applet;
import java.awt.Graphics;
public class GUIApplet extends Applet
public void init()
public void stop()
public void paint(Graphics g)
g.drawString("Hey hey hey",20,20);
g.drawString("Hellooo World",20,40);
The JSP's code:
<%@ page language="java"
import="java.util.*"
session="true" %>
<%
String name = (String) request.getSession().getAttribute("userName");
%>
<html>
<head>
<title>Login</title>
</head>
<body>
<h1><p align="center">Application</p></h1>
<br>
Welcome <%= name %>! Thank you for logging in!
<br><br><br>
<applet align="middle" code="smpb.myapp.controllers.GUIApplet.class" codebase="./" archive="MyApp_applets.jar">
Your browser does not support this feature.
</applet>
<br><br>
<a href='<%=request.getContextPath() + "/LogOut"%>'>Log Out</a><br>
</body>
</html>-------------------------------------------
When i reach this JSP the applet fails to load and i get the following error message at the java console:
Loading applet ...
Initializing applet ...
Starting applet ...
Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with no proxy
Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
Last modified time and/or expiration value is not available. Jar file will not be cached.
Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with no proxy
Connecting http://127.0.0.1/MyApp/MyApp_applets.jar with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with no proxy
Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
Last modified time and/or expiration value is not available. Jar file will not be cached.
Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with no proxy
Connecting http://127.0.0.1/MyApp/smpb/myapp/controllers/GUIApplet.class with cookie "JSESSIONID=A8EECE5E39458739C760D8907762C507"
java.lang.ClassFormatError: smpb/myapp/controllers/GUIApplet (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:561)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1856)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:546)
at sun.applet.AppletPanel.run(AppletPanel.java:298)
at java.lang.Thread.run(Thread.java:534)
Exception: java.lang.ClassFormatError: smpb/myapp/controllers/GUIApplet (Bad magic number)-------------------------------------------
The JSP is in the root directory of the web application's path right along with the jar file. The jar file itself has the following structure:
Archive: HelpDesk_applets.jar
Length Date Time Name
0 05-17-06 12:17 META-INF/
106 05-17-06 12:17 META-INF/MANIFEST.MF
0 05-10-06 17:14 smpb/
0 05-10-06 17:14 smpb/myapp/
0 05-12-06 16:50 smpb/myapp/controllers/
794 05-12-06 17:15 smpb/myapp/controllers/GUIApplet.class
900 6 filesNow, i've tried loading the very same jar file that i use in the JSP through a static HTML which is virtually identical to the JSP i presented and everything works just fine. I've checked and rechecked to see if all the permissions to access the jar file were accurate, i checked to see if Tomcat had it's MIME settings correctly configured so that there was no chance that the files were being corrupted during the load (as that is a usual cause for the problem, or so i've gathered) but to no avail. I've searched the web, including these forums, and found similar problems but no conclusive solution. I can't seem to figure out, at all, what could possibly be wrong. Does anyone have any ideas? I've tried to be as thorough as i could from the start, so, any help would be deeply appreciated.Hi mshah101,
This can happen if the applet is compiled using an higher version of java and the browser is pointing to an older version (even if minor version number is higher) -
How to load an applet in different folder??
Hello, (sorry about my english, I speak spanish)
I have an applet in :
E:/ProyectosPrueba/testJSP/classes/testjsp/AppletConfig.class
and I have a Page JSP (that call it (the applet)) in:
E:/ProyectosPrueba/testJSP/jspConnectApplet.jsp
inside this page I have the tag:
<APPLET
CODEBASE = "."
CODE = "testJSP.AppletConfig.class"
NAME = "SA"
WIDTH = 120
HEIGHT = 20
</APPLET>
I works in JBuilder 5.0 and inside it, this works well, but when
I attempt to do this in Internet Explorer doesn't load the applet
the error is :
java.lang.ClassNotFoundException: testJSP.AppletConfig
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Can someone help me??Try to write the path to the applet after "codebase". Maybe it will help.
Ex. <applet code="test.class" codebase="test/classes">
/A
Maybe you are looking for
-
Music transfer from iPhone 4 to iPhone 4s?
I'm having trouble transferring my music from the iPhone 4 to the iPhone 4s. Here's what I tried. I backed up the iPhone 4 and then plugged in the newly activated iPhone 4s and restored it as a backup. When the iPhone 4s finished restoring, only p
-
Hi there, I am trying to connect my zen player to TV using Sony RCA (AV) cables. and when I do that, I get a message on Zen's screen as "switching to AV out display" or something... and then nothing comes up on TV's screen. I tried switching between
-
Hi Experts!!! I have a problem in report KSBT data fetching. If it is executed without giving the cost centre or cost centre group, then only the data of cost centers created in current fiscal year appears. If it is executed with cost centre group, t
-
My 4s says the other folder has 11 gigs used after i reset it. how do i fix this?
my 4s says the other folder has 11 gigs used after i reset it. how do i fix this?
-
Oledb working in one place but not in another
I have two examples accessing the same table in my oracle database. Whereas code in example 2 always working , code in example 1 worked initially but after that failing with the following error. Please help me as to why I get table or view does not e