This is an automated email from the ASF dual-hosted git repository. geertjan pushed a commit to branch geertjanw-patch-5 in repository https://gitbox.apache.org/repos/asf/netbeans-website.git
commit 19934b84afd471d66b45f2f54bec8e9ee0f4c545 Author: Geertjan Wielenga <geertjan.wiele...@oracle.com> AuthorDate: Sat May 4 16:20:27 2019 +0200 Tweaking 'Using the Visual Debugger in NetBeans IDE' --- .../src/content/kb/docs/java/debug-visual.asciidoc | 48 +++++----------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc b/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc index cf55d47..6c669e5 100644 --- a/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc +++ b/netbeans.apache.org/src/content/kb/docs/java/debug-visual.asciidoc @@ -60,9 +60,7 @@ This exercise will demonstrate how to use the GUI snapshot to navigate to the li The commands can also be invoked from the Navigator window by right-clicking the component and choosing the command in the popup menu. -1. In the GUI snapshot, select the Guess button. - -When you select a component in the snapshot, the IDE displays details about the selected component in the Properties window. If the Properties window is not visible you can choose Window > Properties from the main menu to open the window. +1. In the GUI snapshot, select the Guess button. When you select a component in the snapshot, the IDE displays details about the selected component in the Properties window. If the Properties window is not visible you can choose Window > Properties from the main menu to open the window. image::images/debug-snapshot.png[] @@ -70,15 +68,11 @@ The IDE also displays the location of the component in the form hierarchy in the image::images/debug-navigator.png[] [start=2] -2. Right-click the Guess button in the snapshot and choose Go to Component Declaration from the popup menu. - -When you choose Go to Component Declaration the IDE opens the source file in the editor and moves the cursor to the line in the code where ``guessButton`` is declared. +2. Right-click the Guess button in the snapshot and choose Go to Component Declaration from the popup menu. When you choose Go to Component Declaration the IDE opens the source file in the editor and moves the cursor to the line in the code where ``guessButton`` is declared. image::images/debug-gotodeclaration.png[] [start=3] -3. Right-click the Guess button in the snapshot again and choose Go to Component Source. - -When you choose Go to Component Source the IDE opens the source file in the editor and moves the cursor to the line in the source code for the JButton component. +3. Right-click the Guess button in the snapshot again and choose Go to Component Source. When you choose Go to Component Source the IDE opens the source file in the editor and moves the cursor to the line in the source code for the JButton component. image::images/debug-gotosource.png[] @@ -86,18 +80,12 @@ You can use the Go to Hierarchy Addition command in the GUI snapshot to locate t 1. Open the Options window. 2. Click the Java Debugger tab in the Java category in the Options window. - -*Note.* In NetBeans IDE 7.1 the Java Debugger tab is located in the Miscellaneous category in the Options window. -[start=3] 3. Select Visual Debugging in the list of categories and select *Track locations of component hierarchy changes*. Click OK. -4. Stop your debugging session (if one is running). - -*Note.* After you enable the command in the Options window you will need to restart your debugging session and take a new GUI snapshot before you can use the Go to Hierarchy Addition command. -[start=5] +4. Stop your debugging session (if one is running). After you enable the command in the Options window, you will need to restart your debugging session and take a new GUI snapshot before you can use the Go to Hierarchy Addition command. 5. Start a new debugging session and take a GUI snapshot. 6. Right-click a component in the GUI snapshot and choose Go to Hierarchy Addition. -The IDE will open the source code in the editor at the line where the component is added. +The IDE will open the source code in the editor at the line where the component is added, as shown below: image::images/debug-hierarchy.png[] @@ -105,34 +93,20 @@ image::images/debug-hierarchy.png[] This exercise will demonstrate how you can use the GUI snapshot and the Events window to explore component events, enabling you to locate component listeners and the events that are triggered by the components. -1. Right-click the Guess button in the snapshot and choose Show Listeners from the popup menu. - -When you choose Show Listeners, the IDE opens the Events window. You can see that the Custom Listeners node is expanded. +1. Right-click the Guess button in the snapshot and choose Show Listeners from the popup menu. When you choose Show Listeners, the IDE opens the Events window. You can see that the Custom Listeners node is expanded. image::images/debug-customlisteners.png[] [start=2] -2. Right-click *com.toy.anagrams.ui.Anagrams$3* below the Custom Listeners node and choose Go to Component Source in the popup menu. - -The source code opens in the editor at the line where the listener is defined. -[start=3] -3. Select the empty text field in the snapshot. - -Alternatively, you can select the ``guessedWord`` text field in the Navigator window. - -When you select the text field, the items in the Events window will change automatically to display the listeners for the selected component. -[start=4] -4. In the Events window, double-click the Event Log node to open the Select Listener window. - -Alternatively, you can right-click the Event Log node and choose Set Logging Events from the popup menu. -[start=5] +2. Right-click *com.toy.anagrams.ui.Anagrams$3* below the Custom Listeners node and choose Go to Component Source in the popup menu. The source code opens in the editor at the line where the listener is defined. +3. Select the empty text field in the snapshot. Alternatively, you can select the ``guessedWord`` text field in the Navigator window. When you select the text field, the items in the Events window will change automatically to display the listeners for the selected component. +4. In the Events window, double-click the Event Log node to open the Select Listener window. Alternatively, you can right-click the Event Log node and choose Set Logging Events from the popup menu. 5. Select the ``java.awt.event.KeyListener`` listener from the dialog. Click OK. + image::images/debug-select-listener.png[] This listener is now listening for keyboard events in the text field. [start=6] -6. In the Anagram Game application, type some characters in the text field. - -When you type a character in the text field, the event is recorded in the events log. If you expand the Event Log node you can see that each keystroke is now logged. New events appear each time that you type in the Anagram Game application text field. If you expand an individual event, for example ``keyPressed`` , you can see the properties of that event in the log. +6. In the Anagram Game application, type some characters in the text field. When you type a character in the text field, the event is recorded in the events log. If you expand the Event Log node you can see that each keystroke is now logged. New events appear each time that you type in the Anagram Game application text field. If you expand an individual event, for example ``keyPressed`` , you can see the properties of that event in the log. image::images/debug-eventlog.png[] --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists