Applet and panels

I want to add panel in applet in which an image is painted in the center and i want to display a panel as popup window in the applet

I want to add panel in applet in which an image is
painted in the center and i want to display a panel
as popup window in the appletJApplet
JPanel
ImageIcon
Graphics
JWindow/JDialog/JFrame

Similar Messages

  • Applets and Panels

    Hi Guys,
    I have an applet that builds a panel and a button on the panel. When I move the applet of course it disappears how can I get the applet to repaint the panel in my following code:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    * box.java
    * Created on November 22, 2002, 11:06 AM
    public class Box1 extends JApplet {
        private int x = 0;
        private int y = 0;
        private int w = 0;
        private int h = 0;
        public  Box1 (int x, int y, int w, int h) {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;
        public Box1(){
        public void init()
          JPanel p = new JPanel();
          JButton b = new JButton();
          setSize(400,400);
          p.setSize(200,200);
          p. setBorder (new BevelBorder (BevelBorder.RAISED));
          b.setSize (75,75);
          b.setVisible (true);
          p.add(b);
          p.setVisible (true);
          getContentPane().add(p);
          setVisible(true);
       public void paint(Graphics g)
    }Also I have tried to put the code that creates the panel and button in the paint method but nothing happens, why?
    My goal is to create a box class that can create a panel that will reside in another applet. But right now I am testing the box class in an Applet. Later I will seperate the two. This is unreal why is creating graphics in applets such a pain in the kester.
    Thanks,
    JJ
    Thanks in Advance,
    JJ

    Either take the paint method out entirely or put the line
    super.paint(g)
    in it. By having this empty method in your code, you the method which actually handles the painting isn't being called.

  • IIS, Javascript, Signed Applet and ASP Blank Page Problem

    Hi,
    I'm having a problem using a Signed Applet in a site that runs in a IIS (Windows Server 2003).
    My aspx web page uses the applet to read my smart card and get information from it.
    This applet uses an auxiliar dll (stored in a second Signed Jar file) in order to read the information from my smart card.
    The way the solution is design:
    1) Aspx page is asked from server
    2) Internet Explorer recieve the page and asks the server for it content (images, applet, javascripts, etc)
    3) After this the JVM runs (console opens)
    4) After the Aspx page render fully a javascript register onload fires and call an applet method
    5) Applet receive the call and run the logic of the method:
         - reads the smart card;
         - calls Javascript function in order to fill aspx fields with information from smart card
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    5) The server makes some logic with the information receive and responds to client registering in aspx page a call to another Javascrit function
    6) The client received the asnwer from server and runs the Javascript function registered on step 5)
         This Javascript calls another method from applet and runs the following logic:
         - reads more information from smart card;
         - call javascript function in order to fill more fields of aspx page with the information readed
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    7) The server makes some logic and call another pages with no Applets
    8) Client asks for a second page with the same applet and we start with another logic express on steps 1);2);3),4);5) and then 7).
    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
         - with fiddler I can seer the request for the aspx page (that uses the applet)
         - but server responds with a blank html page
    The JVM doesn't fire.
    The IIS log don't show errors.
    The eventviewer doesn't show errors.
    The problem is solved with an IIS reset or a Application Pool reset.
    After a while the problem returns.
    This problem occours for other user in another machine, the server just stops responding correcly to request regarding pages with applets, the other pages still continue to work.
    If we disable Java Control Panel->Advanced->Java Plug-in->Enable the next-generation Java Plug-in the problem seend to stop, but we can't force all clients to disable this option right?
    Or there is a way to force the Applet to run with this option disabled?
    As anyone experience similar problem?
    Regards,
    OF

    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
    - with fiddler I can seer the request for the aspx page (that uses the applet)
    - but server responds with a blank html pageWell, if http requests look identical in case of success and failure (pay attention to cookies, etc) then it has to be something on the server side.
    It could be that server gets into this wrong state because of previous requests made by applet but it is hard to tell.
    I am not clear how old/new plugin can make a difference unless your applets run in the legacy mode (i.e. you are actually trying to reuse SAME instance of the applet when
    it is loaded next time).
    I'd start with
    1) carefully comparing good/bad sessions
    2) checking whether server will serve correct response to another client when it serves "bad" page for current client
    3) add debug statements to aspx - it is scripted page, may be some condition is not met and then it returns blank?
    4) record all http requests in one session until you get to "error" state and then use any http server testing tool to "replay" this set of requests.
    You should be able to get server into the same state without use of applet. Then you can try to tweak set of requests to see what makes a difference.

  • HELP! How to get an applet and place it into an application?

    Hi,
    We have a third party java applet that runs on a specific server. We don't have the code for this applet, only the .class file. We usually connect to the server using any browser with HTTP protocole like http://ourServer. Then we are asked for our username and password and then the applet loads and we can run it. The applet is design to remotely control a piece of equipment. The applet runs on the server and directly coomunicate with this piece of equipment and gives us bak some information into a graphic interface.
    What we want to do is to integrate the applet into one of our stand alone application to eliminte the need for a browser. Since Applet can be add directly into any Panel I've tried something like :
    public myApp() {
         Container c = getContentPane();
         ThirdPartyApplet myApplet = new ThirdPartyApplet();
         c.setLayout(new BorderLayout());     
         c.add(myApplet,BorderLayout.CENTER);
         myApplet.init();
    Of course I've a local copy of the .class file and I've included it into my ClassPath. I can get the interface this way but I can't run it, nothing seems to work.
    I'm not an expert in applet, I don't know how this one works, but it seems that we need to get the one on the server and run it, just as a browser would do. We've also tried to integrate a Browser into our app. We've tried NetClue and IceBrowser but only IceBrowser seems to work perfectly with our applet and we don't have the money for an IceBrowser license.
    So what is wrong with the integration of an applet into a stand alon application?? How do I simulate a Browser and get the applet from the server?
    Can anyone help me on this one?
    Thanks
    Steeves

    There's a link to download the Java source on this page.
    http://java.sun.com/j2se/downloads.html
    Once you have it, look for the appletviewer source in
    src\share\classes\sun\applet

  • JRE 1.4.x Plugin - Signed Applets and Weird Behaviour (Policy)

    Hello.
    I have recently experienced some strange behaviour related to signed applets and policy files in JRE 1.4.2-b28 ( a friend got the same behaviour in a flavour of 1.4.1-xx as well ). Both tests were on Windows 2000 Professional platforms.
    Initially my unsigned applet, which attempts socket connections to a server different from the download location, fails with security exceptions ( as expected ). Then I did the following to sign the applet jar and configure my environment
    Steps: 1) Import "trusted CA" certificate into ${java.home}/lib/security/cacerts. (JRE home outside the JDK)
    2) Signed the jar using jarsigner and a certificate generated from the "trusted CA" (Entrust CA and certificate).
    3) Imported the signing certificate into the Java plugin using import in the plugin control panel.
    4) Created a new keystore (keytool,jks) and imported the signing certificate into the keystore with alias "developer". The keystore is stored in the user home as .keystore.
    5) Created a .java.policy for the user and attaching the keystore in 4) to it. ( also stored in user home ).
    6) Used the policy tool to grant socketpermissions to the specific codebase ( testing with file:/C:/test/* initially ) signed by "developer"
    After this, when I ran the test page under IE 5.5SP2 and Netscape 7.1 it worked without any security exception. Ditto for using the appletviewer and the policy file I created for the user.
    The weird part occurred when I removed the policy entry from the user policy file. After doing this, Netscape and IE still allow the applet to execute - somehow remembering that it was granted permissions at some point. The appletviewer does not allow it to execute, generating security exceptions.
    It appears the old policy is being cached somewhere, but I cannot find where. If I replace the applet jar with an unsigned version it does fail in IE and Netscape. I tried cleaning the plugin cache and removing the "deployment.certs" files related to the users but still get the same behaviour.
    Does anyone know where the old policy information is being stored ? Does anyone know how to revoke the permissions so that I am restored to my original base environment ( no permissions for "designer" signed applets ) ? Would attempting to utilize the AccessController.doPriveleged( xxxx ) operations in JDK 1.4 avoid all of this confusion with policy files, keystores and certificate storage ? After all the messing about I would like a zero-footprint alternative ( or minimzed footprint anyway ).
    Any ideas would be most welcome.
    Regards,
    James.

    Hello Again.
    I am either enlightened or confused at this point. I found that as long as all of my related Jars are signed ( even by self-signed certificates ) I am granted SocketPermissions for calls outside of the originating server. Unsigned code is refused, but even when the Jars were signed using a self-signed certificate the Socket calls were allowed.
    Am I experiencing the appropriate behaviour in this case ( which would mean not having to utilize policy files to distribute an applet that uses calls to arbitrary servers - e.g. JavaMail ) or am I suffering from something damaged in my environment ?
    It has been a long time since I played with signed applets and I am having difficulty determining what operations require policy file entries/AccessController.doPrivileged() calls and which are granted when a user elects to trust a signed applet without policy.
    Any assistance in clearing up my confusion would be appreciated.
    Regards,
    James.

  • Decompile applet and proxify all URL and socket connection and recompile

    Hi,
    Please anybody have idea for the below.
    I need to decomple the applet class file to .java file and need to change all URL and Socket connection to proxify all connections from applet. and recompile the sample applet to make ready to load in browser.
    Thi is to load the applet form the web server through one proxy server. In the proxy server side While loading the applet from web server that applet code need to be changed to modify the URL and connections used in that applet to change the further connection from applet through proxyserver.
    Compile and decompile is not a problem that i can use javac and javap respectively.
    But I want to know how to change all URL and connection in applet. is there any easy way to handle this with out changing the applet code.
    can Anybody help me.
    Thanks and Regards,
    Shiban.

    Not sure how you do that:
    Client <----[HTTPS]-----> Secure Gateway <------[HTTP]------->Web servers
    or
    Internet Explorer/Mozilla <----[HTTPS]-----> proxy <------[HTTP]-------> Google
    Is the above correct?
    If so than what are the proxy settings in IE/Moz, I can specify the proxy address in the
    browsers but not the proxy type (SSL).
    When you want to visit a page like google I gues you just type http://www.google.com in
    the browsers address bar. The browser will figure out how to connect to the proxy.
    Java has got the control panel in the general tabl there is a button "network settings...:"
    I have it to "use browser settings" and this works for me.
    All URL and URLConnections work but the sockets don't (maybe put in a bug report)
    for example games.yahoo.com -> card games -> bridge -> create table
    In the trace I can see:
    network: Connecting http://yog70.games.scd.yahoo.com/yog/y/b/us-t1.ldict with proxy=HTTP @ myproxy/00.00.00.00:80
    network: Connecting socket://yog70.games.scd.yahoo.com:11999 with proxy=DIRECT
    The second one fails because port 11999 is not open (what idiot uses an unassigned
    port for a profesional site is beyond me).
    http://www.iana.org/assignments/port-numbers
    #               11968-11999 Unassiged
    Even if the port was open on the proxy you'll notice with proxy=DIRECT that
    "use browser settings" does not work with socket (bug report??).
    Anyway my advice is to open the java console (windows control panel or javacpl.exe in
    the bin dir of java.home) and make sure it is set to "use browser settings"
    Then enable a full trace:
    To turn the full trace on (windows) you can start the java console, to be found here:
    C:\Program Files\Java\j2re1.4...\bin\jpicpl32.exe
    In the advanced tab you can fill in something for runtime parameters fill in this:
    -Djavaplugin.trace=true -Djavaplugin.trace.option=basic|net|security|ext|liveconnect
    if you cannot start the java console check here:
    C:\Documents and Settings\userName\Application Data\Sun\Java\Deployment\deployment.properties
    I think for linux this is somewhere in youruserdir/java (hidden directory)
    add or change the following line:
    javaplugin.jre.params=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
    for 1.5:
    deployment.javapi.jre.1.5.0.args=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
    The trace is here:
    C:\Documents and Settings\your user\Application Data\Sun\Java\Deployment\log\plugin...log
    I think for linux this is somewhere in youruserdir/java (hidden directory)
    Print out the full trace of the exception:
    try{...}catch(Exception e){e.printStackTrace();}
    Then visit the games.yahoo and try to create a new table playing bridge.
    Inspect the trace and see if it works/why it doesn't work.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Applet and Redrawing

    Ok, with my Applet, new panels are added constantly and it adds fine. They are put into a scroll bar which also works fine, but when I scroll down the scroll bar, the panels don't repaint correctly and are blurred, and same thing happens scrolls up. But if it gets blurry and I add another panel in, it goes back to normal until I scroll again....What should I do?

    Swing related questions should be posted in the Swing forum.
    You have custom code that is causing painting problems.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.

  • Difference Between Applet and Swing

    Difference Between Applet and Swing

    The advantages and disadvantages of both applets and Swing are the small fluffy elephants you get inside of every box. They're quite well trained and can skeletonize your neighbors' annoying pets upon command.

  • Problem with menu and panel

    hi,
    i m new to java still learning new concepts. When i was working with menu and panel i got this problem and i tried a lot but still i havn't got any success. the problem is i m creating a menu with two menuitem - one for "add item" and another for "modify item". What i want to do that on the same frame i want to create two panel of these two item. when i click "add item" option it should show add window and so with modify option. but the problem is if i click add item it shows the addpanel but when i click modify option (add item panel goes- ok ..) but it doesn't show the modify panel, it shows only the main frame on which menu is there.
    i cannot understant what is happing here plz guide me.
    thanx

    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import javax.swing.*;
    public class ajitAutomobile extends JFrame implements ActionListener
         JMenuBar mb;
         JMenu jobmenu;
         JMenuItem newJobCard,modifyJobCard;
         Font ft;
         JPanel pnlnewJobCard,pnlmodifyJobCard;
         Container con;
         ajitAutomobile()
         ft=new Font("Arial",0,12);
         mb=new JMenuBar();
         setJMenuBar(mb);
         jobmenu=new JMenu(" Job Card Form");
         mb.add(jobmenu).setFont(ft);
         newJobCard=new JMenuItem("New Job Card Detail");
         modifyJobCard=new JMenuItem("Modify Job Card Detail");
         jobmenu.add(newJobCard).setFont(ft);     
         jobmenu.add(modifyJobCard).setFont(ft);     
         mb.add(requisition).setFont(ft);
         con=getContentPane();
         // setting panel for new JOb Card Entry
         pnlnewJobCard=new JPanel();
         pnlmodifyJobCard=new JPanel();
         con.add(pnlmodifyJobCard);
         con.add(pnlnewJobCard);
         pnlnewJobCard.setBackground(Color.RED);     
         pnlnewJobCard.setVisible(false);
         pnlmodifyJobCard.setBackground(Color.YELLOW);
         pnlmodifyJobCard.setVisible(false);
         //setting JFrame resources
         setVisible(true);
         setTitle("Ajit Automobile Service Center");
         setSize(750,300);
         setResizable(false);
         newJobCard.addActionListener(this);
         modifyJobCard.addActionListener(this);
         public void actionPerformed(ActionEvent ae)
              if (ae.getSource()==newJobCard)
                   pnlnewJobCard.setVisible(true);
                                                                    pnlmodifyJobCard.setVisible(false);
              if(ae.getSource()==modifyJobCard)
                                                                             pnlnewJobCard.setVisible(false);
                                                                    pnlmodifyJobCard.setVisible(true);
         public static void main(String args[])
         ajitAutomobile objajit=new ajitAutomobile();
         objajit.show();
    }so, this is the code and as i m expecting that when i click on "New Job Card Detail" then it should display pnlnewJobCard and when i will click "Modify Job Card Detail" it should display pnlmodifyJobCard panel but it is not working.It shows only that panel which is clicked first.
    plz help
    thnx, any answer will be appriciated.

  • I need help with Applets and Multithreading

    [hello all.  first time poster. big fan of java.]
    now to the important matter: Applets and Threads
    =======================================
    1) I have an applet with that implements the runnable interface, and has one thread (and a simple animation). If I try to view this applet in the applet viewer with JGrasp, it spits an insane error telling me
    "java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)"
    but, if I run the applet through a web browser, by putting it in an html document, it runs correctly, without error
    What on earth is wrong, and how do I fix it?!?
    2) I want to put 2 threads in my applet?
    If I implement the Runnable interface, I can only have one Run() method in my applet, right?
    So how do I define behaviour for 2 threads when I only have one run method in which to define the behaviour? Can I use two threads with the runnable interface, or do I have to make objects of my own defined thread classes?
    3) I tried to make 2 threads in my applet by creating my own thread classes, and instantiating them in my applet (instead of implementing the runnable interface).
    I still get the same insane error as I mentioned in my first point (which I expected), except now, the applet won't work even when viewed through a web browser!!
    Please please help me. I am frustrated beyond belief (at what is probably a very simple problem)
    I have searched and searched all over and found no answers on this

    If I try to view this applet in the applet viewer with JGrasp, it spits an insane error telling me
    "java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)"Don't know anything about JGrasp, but it runs with pretty tight security - thats what this insane error is all about. Use the appletviewer or a browser.
    If I implement the Runnable interface, I can only have one Run() method in my applet, right?Correct
    So how do I define behaviour for 2 threads when I only have one run method in which to define the behaviour?
    Can I use two threads with the runnable interface, or do I have to make objects of my own defined thread classes?You can create two Runnable implementations (classes) in your applet.
    example (missing code)
    class MyApplet extends Applet {
      void doSomething() {
      void doSomethingElse() {
      void startThreads() {
        Thread t = new Thread(new Runnable() { public void run() { doSomething();}});
        t.start();
        t = new Thread(new Runnable2());
        t.start();
      class Runnable2 implements Runnable {
         public void run() {
           doSomethingElse();
    }If the above seems confusing, read up on anonymous and inner classes.
    3) I tried to make 2 threads in my applet by creating my own thread classesTry not subclassing thread - this causes a security check

  • Socket communication failure between Java applet and C++ application

    I have a java applet that connects to a C++ application via Java's ServerSocket and Socket objects. THe C++ application is using the Winsock 2 API. The applet and application are running on an NT workstation (SP 6) and using IE (5.5) For a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close. Upon performing a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket. The Java applet can still receive messages from the C++ app but C++ cannot receive responses from the Java side. Java throws no exceptions and an explicit check of the socket shows no errors. Again, what puzzles me is that it works for simple C++ applications. Are there any known conflicts between Java and C++ in this regard?
    I have inlcuded the basic java code segments below.
    / run Method.
      * This method is called by the Thread.start() method. This
      * method is required for the implementation of the Runnable interface
      * This method sets up the server side socket communication and
      * contiuously loops looking for requests from a external
      * socket.
      * @author Chris Duke
      public void run(){
         // create socket connections
         boolean success = false;
         try {
             cServerSocket = new ServerSocket(cPortID);
             System.out.println("Waiting for client to connect...");
             cClientSocket = cServerSocket.accept();
             System.out.println("Client connected");
             // Create a stream to read from the client
             cInStream = new BufferedReader(new InputStreamReader(
               cClientSocket.getInputStream()));
             // Create a stream to write to the client       
             cOutStream = new PrintWriter(
               cClientSocket.getOutputStream(), true);
             success = true;
         }catch (IOException e) {
             System.out.println("CommSocket:Run - Socket Exception(1) " + e);
             success = false;
         // if the socket was successfully created, keep the thread running
         while (success){
             try{
                // check socket to see if it is still available for reading
                if (cInStream != null && cInStream.ready()){
                    // check for an incoming message
                    String message = ReceiveMessage();
                    // Send message to listeners
                    Event(message);
                if (cInStream == null){
                    success = false;
                    System.out.println("CommSocket:Run - shutdown");
             }catch (IOException e){
                System.out.println("CommSocket:Run - Socket not ready exception");
                break;
    // SendMessage method -
      *  Sends a text message to a connected listener through port specified by portID
      * @author Chris Duke
      * @param  String message - This will be the message sent out through the server
      * socket's port specified by portID.
       public void SendMessage(String message){
          cOutStream.println(message);
          if (cOutStream.checkError() == true)
            System.out.println("SendMessage : Flush = Error");
          else{
            System.out.println("SendMessage : Flush - No Error");
       }

    a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close.
    This quite strongly implicates the extra code in the C++ App. The firstly thing I would try would be telnet. Try connecting to both versions of the C++ Application and manually reproducing a proper exchange.
    a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket.
    A correct implementation of recv should return the number of bytes received, or -1 for an error. A zero return indicates no bytes received not a socket closed/error. This sounds like FUD to me.
    Are there any known conflicts between Java and C++ in this regard?
    I can see no obvious faults, though the code is incomplete, I don't think it's an sockets implementation issue, at either end, it sounds more likely to be a protocol/handshaking bug in the C++ App.

  • Security issues with applets and windows Vista when printing to file

    Hi, everyone
    I am currently developing an application that prints out the result of some calculations.
    from a Javascript file, the output finally ends up in a java applet that should print the file in a special printer.
    For debugging purposes I have created a File printer that creates a file from the output comming to the printer; this way I can debug what commands the printer is receiving.
    This worked well on Windows Xp; Vista always asks for permissions for the applet, and altough I guarantee these permissions, printer is not allowed to create the output file and reports an error writing
    after a little research, I have found that java applets have all permissions when certificated as trusted applications; all but file creating permissions
    anyone has any idea of how could I fix this problem?
    Thanks in advance

    HI,
    Have you actually signed your applet? If the signers certificate is the trusted key store for Java it should treat your applet as trusted. You can use a self signed certificate for testing as long as the cert is in the trusted key store.
    Some links that might help:
    [http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html]
    [http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/rsa_signing.html]
    Cheers,
    Shane

  • I'm crazy!Applet and JNA Error:Library 'jnidispatch' was not found!

    Hi all,
    sorry to bother you, I really have no idea how to do JNA and Applet. I'm hardly mazy, man.
    Every time it will throw an error to me :
    Exception in thread "thread applet-JNAApplet-1" java.lang.UnsatisfiedLinkError: Library 'jnidispatch' was not found by class loader sun.plugin2.applet.JNLP2ClassLoader@291aff
         at com.sun.jna.Native.getWebStartLibraryPath(Native.java:858)
         at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:576)
         at com.sun.jna.Library$Handler.<init>(Library.java:140)
         at com.sun.jna.Native.loadLibrary(Native.java:372)
         at com.sun.jna.Native.loadLibrary(Native.java:357)
         at JNAApplet.init(JNAApplet.java:15)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)My program is so easy, I just want use Applet to revoke JNA and use the JNA to load a native lib.
    here is the structure of my program:
    Applet code :
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import com.sun.jna.Native;
    public class JNAApplet extends JApplet {
         public static Kernel32 kernel32 = null;
         @Override
         public void init() {
              createGUI();
              kernel32 = (Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
              if (kernel32 == null) {
                   System.out.println("load kernel32 fail!");
              } else {
                   System.out.println("load kernel32 success!");
         private void createGUI() {
              JPanel panelCenter = new JPanel();
              JButton butTest = new JButton("Test");
              panelCenter.add(butTest);
              setContentPane(panelCenter);
    }When I run it on debug mode, it is ok! but when I deploy it , it will throw above error message to me.
    My Applet html:
    <html>
         <head>
              <title>JNA Applet</title>
         </head>
         <body>
         <script src="deployJava.js"></script>
        <script>
            var attributes = { code:'JNAApplet',  width:300, height:300} ;
            var parameters = {jnlp_href: 'JNAApplet.jnlp'} ;
            deployJava.runApplet(attributes, parameters, '1.5');
        </script>
         </body>
    </html>File 'JNAApplet.jnlp':
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
        <information>
            <title>JNA Applet</title>
            <vendor>Steven</vendor>
        </information>
        <resources>
            <j2se version="1.5+"
                  href="http://java.sun.com/products/autodl/j2se" />
            <jar href="JNAApplet.jar" main="true" />
        </resources>
        <applet-desc
             name="JNA Applet"
             main-class="JNAApplet"
             width="300"
             height="300">
         </applet-desc>
         <update check="background"/>
    </jnlp>     I really have no idea. and I can't search any usefull infomation from Google and officer site.
    Can any one help me? Thank you very much!!!!

    Hi AndrewThompson64:
    Did you mean the JNA project? Or are you refering to JNI, or ..something else?Yes, I mean is that I wanna jna.jar to replace JNI to code with Applet. I want Applet can run native library(.dll files).
    That reads like so much nonsense to me.Sorry fo that.
    Was there any 'caused by' part that you trimmed? I expected to see something to do with 'Security' or 'AccessControl'.Sorry, I can't saw any 'cause by' subsentence there. This message is just gain from Applet Console.(Is there any method to gain more message?)
    About 'Security' and 'AccessControl' I just modify my java.policy file to allpermission. Subsequently, I signed all jar files.
    For now I have 3 jar files(all have been signed ):
    --example.jar :  for this little program.(code include applet and application entry)
    --jna.jar
    --win32-x86.jar : include kernel32.dll and jnidispatch.dll for win32 and x86.
    and 2 JNLP files:
    --JNAApplet.jnlp the entry is JNAApplet.class (this jnlp does not work)
    --JNAApp.jnlp     the entry is JNAApp.class  (this jnlp works)
    And for now new error message show like this:
    Exception in thread "thread applet-JNAApplet-1" java.lang.UnsatisfiedLinkError: Library 'Kernel32' was not found by class loader sun.plugin2.applet.JNLP2ClassLoader@4aeb52
         at com.sun.jna.Native.getWebStartLibraryPath(Native.java:858)
         at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:97)
         at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:228)
         at com.sun.jna.Library$Handler.<init>(Library.java:140)
         at com.sun.jna.Native.loadLibrary(Native.java:372)
         at com.sun.jna.Native.loadLibrary(Native.java:357)
         at JNAApplet.init(JNAApplet.java:12)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Did you mean invoke?
    Revoke: To annul by withdrawing.
    Invoke: To call on.Yes, you got it. Thank you.
    The JNLP file is invalid. ..I was about to put my 'standard' text here, but I'm sick of saying it. Search the forum for my posts - 50% of them, at least, mention validation and how to go about it.
    Also, the applet-desc requires a documentbase.Thank you, I really think I have some invalid section. But I can't find it, and you said 'Search the forum for my posts - 50% of them...' , I can read the JNLP structure on site of sun and I can to read you post too(I'm doing like this).*I only want to know about how to load "native lib like *.dll" properly*.
    What 'officer site'?I mean jna project site. Sorry for ambiguity.
    Please fix that sticky '!' key. One '!' indicates astonishment, while two or more typically indicates a bozo. Thanks for your advice. Because I tried to find solution do my best lasting two days. I got nothing. I'm sadness.
    here post my new files:
    import javax.swing.JFrame;
    import com.sun.jna.Native;
    public class JNAApp {
         public static Kernel32 kernel32 = null;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              kernel32 = (Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
              JFrame frame = new JFrame();
              frame.setSize(500, 500);
              frame.setVisible(true);
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import com.sun.jna.Native;
    public class JNAApplet extends JApplet {
         public static Kernel32 kernel32 = null;
         public void init() {
              createGUI();
                   kernel32 = (Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
         private void createGUI() {
              JPanel panelCenter = new JPanel();
              JButton butTest = new JButton("Test");
              panelCenter.add(butTest);
              setContentPane(panelCenter);
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
        <information>
            <title>JNA Applet</title>
            <vendor>Steven</vendor>
        </information>
        <resources>
            <j2se version="1.5+"
                  href="http://java.sun.com/products/autodl/j2se" />
             <jar href="JNAApplet.jar" main="true"/>
             <jar href="jna.jar"/>
        </resources>
           <resources os="Windows" arch="x86">
             <nativelib href="win32-x86.jar"/>
             <nativelib href="kernel32.jar"/>
           </resources>
        <applet-desc
             documentBase=""
                name = "success"
             main-class="JNAApplet" width = "200" height = "200">
         </applet-desc>
         <update check="background"/>
           <security>
             <all-permissions/>
           </security>
    </jnlp>     
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
        <information>
            <title>JNA Applet</title>
            <vendor>Steven</vendor>
        </information>
        <resources>
            <j2se version="1.5+"
                  href="http://java.sun.com/products/autodl/j2se" />
             <jar href="JNAApplet.jar" main="true"/>
             <jar href="jna.jar"/>
        </resources>
           <resources os="Windows" arch="x86">
             <nativelib href="win32-x86.jar"/>
             <nativelib href="kernel32.jar"/>
           </resources>
        <application-desc
             main-class="JNAApp">
         </application-desc>
         <update check="background"/>
           <security>
             <all-permissions/>
           </security>
    </jnlp>     Thanks & Best Regards,
    Su Heng

  • How do you increase type size in menu bars and panels?

    I recently abandoned my Mac Pro 1,1 for a shiny new Mac Pro cylinder running Mavericks 10.9.5. I have paired it with an LG 27" IPS display. The reason I am using the LG is because I was frustrated that Apple pays absolutely no attention to the pleas of their pro users for a non-reflective display.
    And now I find that the type in the menu bars and panels is so small that it literally causes me eyestrain - and that I can't increase the type size. I am older (62), but I still need to use my Mac to survive. Unfortunately, though, it appears that Apple designers have again ignored the needs of their pro users -  in this case, older ones.
    I have been a graphic designer and a producer of technical and marketing publications for over 35 years, and I appreciate good-looking design -  but the real measure of design is usability. Even great-looking design must be user friendly.
    So now I am wondering if Apple interface designers are amateurs, or if they just don't give a @#$% about their users.
    Did I miss it? Is their a way to increase type size in menu bars, etc.?

    Did I miss it?
    Yes.
    System preferences > Displays > Resolution ...
    choose "Scaled" and pick an alternate resolution.
    When you do this, text will be drawn as if your screen were actually set to that revolution, but graphics will be drawn full-scale at the native resolution.
    This feature was invented for Retina Displays, and has finally been made available for additional displays.

  • How to access a file via Applet and JavaScript

    I want to copy one file on the client machine from one place to another place from a Java Bean.
    To do this I created an applet and a Java Bean as follows:
    import java.applet.*;
    public class FileUtils extends Applet {
        public void copyFile(String src, String dest)  {
        private String source, destination; // setters/getters are there of course
        public void copyFile(ActionEvent actionEvent) { // Bean
            FacesContext fctx = FacesContext.getCurrentInstance();
            ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
            String command = "var s = '"+ source +"'; var d ='" + destination +"'; " +  " document.fileUtilsApplet.copyFile(s, d); ";
            erks.addScript(fctx, command);
        }Then I added the APPLET tag referencing the above class in the page fragment:
                    <f:verbatim>
                        <applet code="FileUtils.class" name="fileUtilsApplet" height="30"
                                archive="/context-root/Applet.jar"
                                width="200">
                        </applet>
                    </f:verbatim>From the Java console I can see the jar is successfully downloaded, but when the code in the bean is executed, the JavaScript code does not seem to do anything, as if the "copyFile" public method was not called at all and no output in the Java Console as well.
    Note that I already followed the guidelines at http://www.oracle.com/technetwork/developer-tools/adf/learnmore/71-adf-to-applet-communication-307672.pdf .
    Do you have any ideas?

    Ok, I can see the permission problem now:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\myfile.txt read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkRead(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
    Edited by: user10047839 on 1-feb-2013 7.29
    signing the Jar and downloading the certificate permanently does not change anything in Firefox. The Java console keeps giving the above exception.
    Any idea?

Maybe you are looking for