Article View: borland.public.jbuilder.java.api
Article #2589Re: working but ...
From: Rich Wilkman
Date: Tue, 19 Sep 2000 00:00
Date: Tue, 19 Sep 2000 00:00
113 lines
4856 bytes
4856 bytes
Frank:
If you are lucky it's only a signing issue. More often than not, however, the
class is simply doing something that is illegal for Applets do to in the
Security Sandbox. In your case, however, you are trying to use a JDK 1.3 class
in an environent (your browser) that stopped maturing around JDK 1.1.5. You can
try the plugin (insert my usual warning that the plugin is not an internet
solution) to get 1.3 band-aided onto your browser.
-Rich
Frank wrote:
> Thank you. Your test program worked well. I was missing "throws
> AWTException" in the class declaration. I should mension that my program is
> an Applet. Now the program works, but only in the debug mode. When I run it
> I get the following error message when the program tries to instentiate the
> robot class "robot = new Robot();"
>
> java.security.AccessControlException: access denied (java.awt.AWTPermission
> create Robot)
> at
> java.security.AccessControlcontext.checkPermission(AccessControlContext.java
> :272)
> at
> java.security.AccessCntroller.checkPermission(Accesscontroller.java:399)
> at
> java.lang.SecurityManager.ckeckPermission(SecurityManager.java:545)
> at java.awt.Robot.ckeckRobotAllowed(Robot.java:119)
> :
> :
>
> Does this mean that the only way to make my applet work is to sign it
> digitally?
>
> Regards,
>
> Frank
>
> John P. McGrath <JPMcGrath@fast.net> wrote in message
> news:MPG.1430d42637fca1c3989b49@forums.borland.com...
> > On Mon, 18 Sep 2000 10:58:51 -0400, Frank wrote:
> >
> > > I am using Windows NT and I got the AWTException on compilation.
> > > From the documentation I read that on some platforms this will
> > > not work. Is this my case?
> >
> > I cannot tell what the problem is from that description. Was there a
> > message with the exception? Was the exception from the Robot constructor
> > or from the mouseMove() call or somewhere else. Did you get a traceback?
> >
> > Here is a program I wrote to test the feature. Try running it and see if
> > it works for you.
> >
> > ====================================================================
> > import javax.swing.*;
> > import java.awt.*;
> > import java.awt.event.*;
> >
> > public class RobotTest
> > extends JFrame
> > {
> > private JPanel buttonPanel = new JPanel();
> > private JButton moveButton = new JButton();
> > private JButton exitButton = new JButton();
> > private Robot robot;
> >
> > ////////////////////////////////////////////////////////////////////
> >
> > static public void main( String[] args ) {
> > try {
> > JFrame frame = new RobotTest();
> > frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
> > frame.pack();
> > frame.show();
> > } catch ( Exception ex ) {
> > ex.printStackTrace();
> > }
> > }
> >
> > public RobotTest()
> > throws AWTException
> > {
> > moveButton.setText( "Move mouse" );
> > moveButton.addActionListener( new ActionListener() {
> > public void actionPerformed( ActionEvent event ) {
> > Point pos = exitButton.getLocationOnScreen();
> > Dimension size = exitButton.getSize();
> > robot.mouseMove( pos.x + size.width / 2,
> > pos.y + size.height / 2 );
> > }
> > } );
> > buttonPanel.add( moveButton, null );
> >
> > exitButton.setText("Exit");
> > exitButton.addActionListener( new ActionListener() {
> > public void actionPerformed(ActionEvent event) {
> > System.exit( 0 );
> > }
> > } );
> > buttonPanel.add( exitButton, null );
> >
> > getContentPane().add( buttonPanel, BorderLayout.SOUTH );
> >
> > robot = new Robot();
> > }
> > }
> > ====================================================================
> >
> > --
> > Regards,
> >
> > John McGrath
Technical Details
Message-ID:
<39C7E2C9.77ABE6D3@formlessvoid.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39c24c25$1_2@dnews> <MPG.142ce891cc0c9c54989b3a@forums.borland.com> <39c629e8$1_2@dnews> <MPG.1430d42637fca1c3989b49@forums.borland.com> <39c79edb$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,95a818d94a09e7b1 X-Google-Attributes: gid1089d0,public From: Rich Wilkman <richw@formlessvoid.com> Subject: Re: working but ... Date: 2000/09/19 Message-ID: <39C7E2C9.77ABE6D3@formlessvoid.com> X-Deja-AN: 671798108 Content-Transfer-Encoding: 7bit References: <39c24c25$1_2@dnews> <MPG.142ce891cc0c9c54989b3a@forums.borland.com> <39c629e8$1_2@dnews> <MPG.1430d42637fca1c3989b49@forums.borland.com> <39c79edb$1_2@dnews> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: 19 Sep 2000 14:56:37 -0800, 209.144.169.10 MIME-Version: 1.0 Reply-To: richw@formlessvoid.com Newsgroups: borland.public.jbuilder.java.api