Article View: borland.public.jbuilder.java.api
Article #2587working but ...
From: Frank
Date: Tue, 19 Sep 2000 00:00
Date: Tue, 19 Sep 2000 00:00
99 lines
4076 bytes
4076 bytes
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:
<39c79edb$1_2@dnews>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>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,95a818d94a09e7b1 X-Google-Attributes: gid1089d0,public From: "Frank" <frank673@hotmail.com> Subject: working but ... Date: 2000/09/19 Message-ID: <39c79edb$1_2@dnews> X-Deja-AN: 671689359 References: <39c24c25$1_2@dnews> <MPG.142ce891cc0c9c54989b3a@forums.borland.com> <39c629e8$1_2@dnews> <MPG.1430d42637fca1c3989b49@forums.borland.com> X-Trace: 19 Sep 2000 10:14:03 -0800, 164.76.122.247 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.api X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300