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.

Bug 210592 - When creating an event handler, the source does not scroll to the location
Summary: When creating an event handler, the source does not scroll to the location
Status: RESOLVED DUPLICATE of bug 213190
Alias: None
Product: editor
Classification: Unclassified
Component: Code folding (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 209137 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-03 06:52 UTC by mienamoo
Modified: 2012-09-04 09:31 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mienamoo 2012-04-03 06:52:16 UTC
NetBeans build 201203280401
JDK 7u3 32-bit

When creating an event handler (whether it is by say double clicking on a button on the form itself, or by adding it to the events list under properties), the cursor is moved to the right location, but the source code is not scrolled to where the cursor is.

Steps to reproduce:

1. Create a new JPanel form.
2. Drag and drop a JButton onto the form.
3. Double click on the button.
4. The source view is opened but not scrolled to the right location. (Press one of the arrow keys to go to where the cursor is correctly positioned.)
Comment 1 Jan Stola 2012-04-05 13:19:35 UTC
I am sorry, I am not able to reproduce this issue. Are you still able to reproduce it? Does the problem occur also when you navigate into the source code of some method using other means like Ctrl+click on a method in the editor or double-click on some method in Navigator window?
Comment 2 mienamoo 2012-04-05 13:38:47 UTC
It is still happening with build 201204040400, but only when creating the event handler. So navigator and Ctrl + click works because by then the method exists.

I just realised that this is not apparent if your class is not long enough to scroll. I noticed the problem first on a TopComponent, which has a lot of generated code before you get to the event handlers. When I just tried it out with a blank JPanel, the new method happened to be on the screen already and so it seemed like it worked because no scrolling was required. :) So, please add these steps to my instructions to reproduce:

1.1. Switch to source view and add a lot of blank lines before the constructor so that you would have to scroll down to see the constructor.
1.2. Press Ctrl+Home.
1.3. Switch back to design view.
Comment 3 Jan Stola 2012-04-05 14:58:53 UTC
Thank you for the additional information. It helped me to find a reliable reproducible test case:

1. Create JFrame form.
2. Repeat until you see the problem (~5 times with my configuration)
   A) Add JButton into the form.
   B) Double-click the button
      => event handler is added and Source view is displayed
   C) Check if the line with the cursor is visible.
      It will not be visible eventually.

Note that the line with the cursor is always visible for a fraction of a second after step 2B. Also the content of initComponents() is expanded for this short moment. initComponents() is collapsed then and the editor's view is scrolled. So, it seems that editor folding is the culprit. In fact, when I switch folding of initComponents() off (in Tools > Options > Java > GUI Builder) then the problem is not reproducible. Hence, I am reassigning this issue to editor for evaluation.
Comment 4 Jan Stola 2012-04-17 13:29:01 UTC
*** Bug 209137 has been marked as a duplicate of this bug. ***
Comment 5 Svata Dedic 2012-05-11 11:20:44 UTC
Could not reproduce on build 2012-05-06; I actually tried an older build (201203200400) and I was able to reproduce the defect there.

I assume that some change in view hierarchy and/or folding has fixed the defect from the time of the report.
Comment 6 mienamoo 2012-06-13 08:40:13 UTC
This bug is back in build 201206100001...
Comment 7 Svata Dedic 2012-06-13 08:47:03 UTC
Describe precise steps for reproduction, either using some standard form template with minimal changes, or attach the file that should be used for reproduction.
Comment 8 mienamoo 2012-06-13 08:53:03 UTC
I noticed it happening while working on a TopComponent. But the easiest way to reproduce this is to use the steps comment #3.
Comment 9 Svata Dedic 2012-09-04 09:31:46 UTC

*** This bug has been marked as a duplicate of bug 213190 ***