This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
This whole thing might be more for information purposes since it seems to occur only on a HP Compaq nw8000 Laptop Computer. But I think this is worth to note in case someone else will encounter that too. Also note that the above given Netbeans version number is wrong since this is independent of the Netbeans IDE but I have to choose such a version number. Overview Description: --------------------- Jemmy is not able to position the mouse pointer on a JButton in order to push the JButton. Steps to Reproduce: ------------------- (Note: Encountered only on a hp compaq nw8000 Laptop. See also below.) 0.) Arrange files this way (numbers indicating hierarchy in file system): 1 testdir 2 problem 3 app 4 MyFrame.java 3 test 4 MyFrameOperator.java 4 MyTester.java 2 runtest.cmd 2 jemmy.jar 1.) Adjust JAVA_HOME in runtest.cmd to point to the directory of jdk1.3.1_08 2.) run runtest.cmd (Be patient since the whole test method pauses between the single steps to give the user a chance to keep track on the whole thing.) Actual Results: --------------- The mouse pointer is positioned not on the button but on the upper left edge of the JFrame and the runLog.log does not contain the line --- !!!!!!!!!!!!!!!!! Button pressed: ButtonForTest --- Expected Results: ----------------- Jemmy should position the mouse on the JButton, push it and runLog.log should contain the line --- !!!!!!!!!!!!!!!!! Button pressed: ButtonForTest --- Build Date & Platform: ---------------------- Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 HP Compaq nw8000 running MS Windows XP Professional Service Pack 2 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 or Sun JDK 1.3.1_08 Additional Builds and Platforms: -------------------------------- I) Does not occur on 1.) Jemmy Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 4.15 Jemmy-Build: 20041006 HP Compaq nw8000 running MS Windows XP Professional Service Pack 2 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 -> Exception java.lang.UnsupportedClassVersionError: org/netbeans/jemmy/ClassReference (Unsupported major.minor version 48.0) at java.lang.ClassLoader.defineClass0 (Native Method) at java.lang.ClassLoader.defineClass (ClassLoader.java:488) at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:106) at java.net.URLClassLoader.defineClass (URLClassLoader.java:243) at java.net.URLClassLoader.access$100 (URLClassLoader.java:51) at java.net.URLClassLoader$1.run (URLClassLoader.java:190) at java.security.AccessController.doPrivileged (Native Method) at java.net.URLClassLoader.findClass (URLClassLoader.java:183) at java.lang.ClassLoader.loadClass (ClassLoader.java:294) at sun.misc.Launcher$AppClassLoader.loadClass (Launcher.java:281) at java.lang.ClassLoader.loadClass (ClassLoader.java:250) at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:310) Exception in thread "main" 2.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 Desktop Computer (own company built) running MS Windows XP Professional SP2 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 -> everything works 3.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 HP Compaq nx7010 running MS Windows XP Professional SP 2 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 -> everything works 4.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 IBM ThinkPad A31 running MS Windows 2000 Professional SP 4 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 -> everything works fine 5.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 Desktop Computer (own company built) running MS Windows 2000 Professional SP4 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 -> everything works fine 6.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 HP Compaq nw8000 running MS Windows XP Professional Service Pack 2 JDK: Sun JDK 1.4.2_03 Compiler for sample test files: eclipse 3.0.1 -> everything works fine 7.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 4.15 Jemmy-Build: 20041006 HP Compaq nw8000 running MS Windows XP Professional Service Pack 2 JDK: Sun JDK 1.4.2_03 Compiler for sample test files: eclipse 3.0.1 -> everything works fine II) Occurs on 1.) Jemmy: Jemmy-MajorVersion: 2.2 Jemmy-MinorVersion: 3 Jemmy-Build: 20030411 Different HP Compaq nw8000 running MS Windows XP Professional Service Pack 2 JDK: Sun JDK 1.3.1_08 Compiler for sample test files: eclipse 3.0.1 Additional Information: ----------------------- Clicking seems to work since in case of a different application under test jemmy positions the mouse pointer over the task bar tray of the operating system and a menu opens. So it seems that clicking works but positioning the mouse pointer doesn't. Sample Application ------------------ /* * Created on 16.02.2005 */ package problem.app; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; /** * Simple class which launches a JFrame containing a JLabel and * a JButton. On pressing the button this class writes the string * "--- !!!!!!!!!!!!!!!!! Button pressed: ButtonForTest ---" * to stdout. * * <p> Used to demonstarte and investigate a problem * encountered with jemmy. <p> * * @author Steffen Arnold */ public class MyFrame extends JFrame { /** * ActionListener for the JButton. */ protected class MyActionListener implements ActionListener { /** * Writes the string * "--- !!!!!!!!!!!!!!!!! Button pressed: ButtonForTest ---" * to stdout. */ public void actionPerformed(ActionEvent u_event) { JButton button = ((JButton) u_event.getSource()); String buttonName = button.getName(); System.out.println("\n--- !!!!!!!!!!!!!!!!! Button pressed: " + buttonName + " ---"); } } /** * Stores the JButton of the JFrame */ protected JButton m_button = null; /** * String used for labeling the JButton on the GUI * and internally as the buttons name. */ protected final String MY_BUTTON_NAME = "ButtonForTest"; /** * Constructor. Compiles and packs the GUI of the application * under test. */ public MyFrame() { setTitle("MyFrame"); setContentPane(customContentPane()); setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE); pack(); } /** * Compiles and returns the content pane for the GUI */ protected JPanel customContentPane() { JPanel contentPane; contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.add(new JLabel("MyLabel"), BorderLayout.NORTH); contentPane.add(getButton(), BorderLayout.CENTER); return contentPane; } /** * Creates (if necessary) and returns the GUIs JButton. */ protected JButton getButton() { if (m_button == null) { m_button = new JButton (MY_BUTTON_NAME); m_button.setName(MY_BUTTON_NAME); m_button.addActionListener(new MyActionListener()); } return m_button; } /** * Launches the application under test. * * @param args (unused) */ public static void main(String[] args) { (new MyFrame()).setVisible(true); } } -------------------------------------------------- ---- /* * Created on 16.02.2005 */ package problem.test; import org.netbeans.jemmy.operators.JButtonOperator; import org.netbeans.jemmy.operators.JFrameOperator; /** * Jemmy Operator for the JFrame problem.app.MyFrame which * is the (GUI of the) application under test. * * @author Steffen Arnold */ public class MyFrameOperator extends JFrameOperator { /* * Stores the jemmy operator for the applications JButton */ protected JButtonOperator theButtonOperator = null; /** * Constructor of this operator using * JFrame title to retrieve the JFrame. */ public MyFrameOperator() { super("MyFrame"); } /** * @return jemmy JButtonOperator for the JButton * of the application under test. */ public JButtonOperator getTheButton() { if (theButtonOperator == null) { theButtonOperator = new JButtonOperator(this, "ButtonForTest"); } return theButtonOperator; } } -------------------------------------------------- ---- /* * Created on 16.02.2005 */ package problem.test; import java.io.FileNotFoundException; import java.lang.reflect.InvocationTargetException; import org.netbeans.jemmy.ClassReference; import org.netbeans.jemmy.JemmyProperties; import org.netbeans.jemmy.operators.JButtonOperator; import org.netbeans.jemmy.util.Dumper; import org.netbeans.jemmy.util.PNGEncoder; /** * Main class for running the jemmy test to push the button * on JFrame problem.app.MyFrame * * @author Steffen Arnold */ public class MyTester { /** * Helper method to make the test pause * some time in a convenient way. * * @param u_time milliseconds to pause */ protected static void pause(long u_time) { try { Thread.sleep(u_time); } catch (InterruptedException e1) { e1.printStackTrace(); } } /** * Runs the test. * * @param args (unused) */ public static void main(String[] args) { JemmyProperties.setCurrentDispatchingModel ( JemmyProperties.ROBOT_MODEL_MASK); // launch the application under test try { System.out.println("--- Starting application..."); ClassReference myApp = new ClassReference("problem.app.MyFrame"); myApp.startApplication(); System.out.println("--- Starting application done"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } // get jemmy operators for JFrame and the button to press pause(3000L); System.out.println("--- Getting the JFrame..."); MyFrameOperator theFrame = new MyFrameOperator(); JButtonOperator theButton = theFrame.getTheButton(); System.out.println("--- Getting JFrame done"); // dump GUI information using jemmys Dumper class try { System.out.println("--- Dumping information..."); Dumper.dumpAll("guidump.xml"); System.out.println("--- Dumping information done"); } catch (FileNotFoundException e1) { e1.printStackTrace(); } // press the button pause(3000L); System.out.println("--- Pressing the button..."); theButton.push(); PNGEncoder.captureScreen("scrshot.png", PNGEncoder.COLOR_MODE); System.out.println("--- Pressing the button done"); // exit JVM pause(10000L); System.out.println("--- Exit JVM"); System.exit(0); } } -------------------------------------------------- ---- runtest.cmd ----------- set CLASSPATH=.\jemmy.jar;. set JAVA_HOME=C:\jdk1.3.1_08 set JVM=%JAVA_HOME%\jre\bin\java.exe set STARTCMD=%JVM% problem.test.MyTester %JVM% -version %STARTCMD% > runLog.log pause -------------------------------------------------- ---- runLog.log ---------- --- Starting application... --- Starting application done --- Getting the JFrame... Trace: Start to wait frame "Frame with title "MyFrame"" opened Trace: Frame "Frame with title "MyFrame"" has been opened in 0 milliseconds problem.app.MyFrame [frame0,0,0,184x82,layout=java.awt.BorderLayout,re sizable,title=MyFrame,defaultCloseOperation=DISPOS E_ON_CLOSE,rootPane=javax.swing.JRootPane [,4,34,176x44,layout=javax.swing.JRootPane$RootLay out,alignmentX=null,alignmentY=null,border=,flags= 3586,maximumSize=,minimumSize=,preferredSize=],roo tPaneCheckingEnabled=true] Trace: Start to wait action "Wait AbstractButton with text "ButtonForTest" loaded" Trace: "Wait AbstractButton with text "ButtonForTest" loaded" action has been produced in 0 milliseconds with result : javax.swing.JButton [ButtonForTest,0,17,176x27,layout=javax.swing.Over layLayout,alignmentX=0.0,alignmentY=0.5,border=jav ax.swing.plaf.BorderUIResource$CompoundBorderUIRes ource@586fd3,flags=1200,maximumSize=,minimumSize=, preferredSize=,defaultIcon=,disabledIcon=,disabled SelectedIcon=,margin=javax.swing.plaf.InsetsUIReso urce [top=2,left=14,bottom=2,right=14],paintBorder=true ,paintFocus=true,pressedIcon=,rolloverEnabled=fals e,rolloverIcon=,rolloverSelectedIcon=,selectedIcon =,text=ButtonForTest,defaultCapable=true] --- Getting JFrame done --- Dumping information... Trace: Locking queue. Trace: Invoking "Event queue locking" action through event queue Trace: Unlocking queue. --- Dumping information done --- Pressing the button... Push button :javax.swing.JButton [ButtonForTest,0,17,176x27,layout=javax.swing.Over layLayout,alignmentX=0.0,alignmentY=0.5,border=jav ax.swing.plaf.BorderUIResource$CompoundBorderUIRes ource@586fd3,flags=1200,maximumSize=,minimumSize=, preferredSize=,defaultIcon=,disabledIcon=,disabled SelectedIcon=,margin=javax.swing.plaf.InsetsUIReso urce [top=2,left=14,bottom=2,right=14],paintBorder=true ,paintFocus=true,pressedIcon=,rolloverEnabled=fals e,rolloverIcon=,rolloverSelectedIcon=,selectedIcon =,text=ButtonForTest,defaultCapable=true] --- Pressing the button done --- Exit JVM -------------------------------------------------- ---- Dump ---- <?xml version="1.0"?> <!DOCTYPE dump [ <!ELEMENT dump (component*)> <!ELEMENT component (property+, subcomponents?, subwindows?, exception?)> <!ELEMENT subcomponents (component+)> <!ELEMENT subwindows (component+)> <!ELEMENT property EMPTY> <!ELEMENT exception EMPTY> <!ATTLIST component operator CDATA #IMPLIED> <!ATTLIST exception toString CDATA #REQUIRED> <!ATTLIST property name CDATA #REQUIRED value CDATA #REQUIRED> ]> <dump> <component operator="org.netbeans.jemmy.operators.JFrameOpera tor"> <property name="Class" value="problem.app.MyFrame"/> <property name="Height" value="82"/> <property name="Resizable" value="true"/> <property name="Showing" value="true"/> <property name="State" value="NORMAL"/> <property name="Title" value="MyFrame"/> <property name="Visible" value="true"/> <property name="Width" value="184"/> <property name="X" value="0"/> <property name="Y" value="0"/> <property name="toString" value="problem.app.MyFrame [frame0,0,0,184x82,layout=java.awt.BorderLayout,re sizable,title=MyFrame,defaultCloseOperation=DISPOS E_ON_CLOSE,rootPane=javax.swing.JRootPane [,4,34,176x44,layout=javax.swing.JRootPane$RootLay out,alignmentX=null,alignmentY=null,border=,flags= 3586,maximumSize=,minimumSize=,preferredSize=],roo tPaneCheckingEnabled=true]"/> <subcomponents> <component operator="org.netbeans.jemmy.operators.JComponentO perator"> <property name="Class" value="javax.swing.JRootPane"/> <property name="Height" value="44"/> <property name="Showing" value="true"/> <property name="Visible" value="true"/> <property name="Width" value="176"/> <property name="X" value="4"/> <property name="Y" value="34"/> <property name="toString" value="javax.swing.JRootPane [,4,34,176x44,layout=javax.swing.JRootPane$RootLay out,alignmentX=null,alignmentY=null,border=,flags= 3586,maximumSize=,minimumSize=,preferredSize=]"/> <subcomponents> <component operator="org.netbeans.jemmy.operators.JComponentO perator"> <property name="Class" value="javax.swing.JPanel"/> <property name="Height" value="44"/> <property name="Showing" value="false"/> <property name="Visible" value="false"/> <property name="Width" value="176"/> <property name="X" value="0"/> <property name="Y" value="0"/> <property name="toString" value="javax.swing.JPanel [null.glassPane,0,0,176x44,hidden,layout=java.awt. FlowLayout,alignmentX=null,alignmentY=null,border= ,flags=2,maximumSize=,minimumSize=,preferredSize=, defaultLayout=java.awt.FlowLayout [hgap=5,vgap=5,align=center]]"/> </component> <component operator="org.netbeans.jemmy.operators.JComponentO perator"> <property name="Class" value="javax.swing.JLayeredPane"/> <property name="Height" value="44"/> <property name="Showing" value="true"/> <property name="Visible" value="true"/> <property name="Width" value="176"/> <property name="X" value="0"/> <property name="Y" value="0"/> <property name="toString" value="javax.swing.JLayeredPane [null.layeredPane,0,0,176x44,alignmentX=null,align mentY=null,border=,flags=0,maximumSize=,minimumSiz e=,preferredSize=,optimizedDrawingPossible=true]"/ > <subcomponents> <component operator="org.netbeans.jemmy.operators.JComponentO perator"> <property name="Class" value="javax.swing.JPanel"/> <property name="Height" value="44"/> <property name="Showing" value="true"/> <property name="Visible" value="true"/> <property name="Width" value="176"/> <property name="X" value="0"/> <property name="Y" value="0"/> <property name="toString" value="javax.swing.JPanel [,0,0,176x44,layout=java.awt.BorderLayout,alignmen tX=null,alignmentY=null,border=,flags=34,maximumSi ze=,minimumSize=,preferredSize=,defaultLayout=java .awt.FlowLayout[hgap=5,vgap=5,align=center]]"/> <subcomponents> <component operator="org.netbeans.jemmy.operators.JLabelOpera tor"> <property name="Class" value="javax.swing.JLabel"/> <property name="Height" value="17"/> <property name="Showing" value="true"/> <property name="Text" value="MyLabel"/> <property name="Visible" value="true"/> <property name="Width" value="176"/> <property name="X" value="0"/> <property name="Y" value="0"/> <property name="toString" value="javax.swing.JLabel [,0,0,176x17,alignmentX=0.0,alignmentY=null,border =,flags=0,maximumSize=,minimumSize=,preferredSize= ,defaultIcon=,disabledIcon=,horizontalAlignment=,h orizontalTextPosition=,iconTextGap=4,labelFor=,tex t=MyLabel,verticalAlignment=CENTER,verticalTextPos ition=CENTER]"/> </component> <component operator="org.netbeans.jemmy.operators.JButtonOper ator"> <property name="Class" value="javax.swing.JButton"/> <property name="Default button" value="false"/> <property name="Height" value="27"/> <property name="Showing" value="true"/> <property name="Text" value="ButtonForTest"/> <property name="Visible" value="true"/> <property name="Width" value="176"/> <property name="X" value="0"/> <property name="Y" value="17"/> <property name="toString" value="javax.swing.JButton [ButtonForTest,0,17,176x27,layout=javax.swing.Over layLayout,alignmentX=0.0,alignmentY=0.5,border=jav ax.swing.plaf.BorderUIResource$CompoundBorderUIRes ource@60e128,flags=1200,maximumSize=,minimumSize=, preferredSize=,defaultIcon=,disabledIcon=,disabled SelectedIcon=,margin=javax.swing.plaf.InsetsUIReso urce [top=2,left=14,bottom=2,right=14],paintBorder=true ,paintFocus=true,pressedIcon=,rolloverEnabled=fals e,rolloverIcon=,rolloverSelectedIcon=,selectedIcon =,text=ButtonForTest,defaultCapable=true]"/> </component> </subcomponents> </component> </subcomponents> </component> </subcomponents> </component> </subcomponents> </component> </dump> -------------------------------------------------- ---- (end of file)
All right, like the sumitter says, it's not reproducible anywhere. This may indicate some Robot problem, but nothing really to be done in Jemmy.