This week's book giveaway is in the Spring forum.
We're giving away four copies of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 and have Marten Deinum & Iuliana Cosmina on-line!
See this thread for details.
Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Robert Ingmarsson

Ranch Hand
+ Follow
since Jan 12, 2015
Robert likes ...
Netbeans IDE PHP Java
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robert Ingmarsson

Best ranchers!

I have a question about event handling in javascript. I need to figure out a crossbrowser friendly way to keep track
on the mouse when the user leaves a certain div element.

I know about the "mouseleave" attribute in the addEventListener method, but it is not ie compatible and thats the
eye of the problem. I have tested around with the event.cancelBubble  = true (ie) and event.stopPropagation (w3c)

How can I prevent - in ie - a div from closing after the mouse leaves a li-element in a list and when the mouse leaves
the parent element in this case the former mentioned div tag?

Thanks for visiting!

Best ranchers!

Thanks for all the replies here.

I am just wondering what is the procedure to detect if a mouse pointer is outside
a specific element such as a div tag?

I am looking into pageX and pageY methods on google is that the correct approach?
I wan't to be able to capture events when the mouse leaves my menu element.
Is it possible to accomplish that?

Best regards,
Mr. Bibeault!

Do you mean replacing and removing elements using dom?

I am completely stuck here. My script will still only run one time per page load.
It's almost fascinating to watch   It won't execute the method in the function call
in the loop more than once.

You mentioned something earlier about replacing the class names? I am using ids
to find the divs. I know about getElementsByClassName.

Has anyone encountered this phenomena before please give a comment or two.


Best, Mr. Bibeault!

Sorry for a late reply. The problem still occur. The script still only executes after a page load. I will definately consider using another approach
with the addEventListener method.

By the way, with "destroyed", are you refering to the method clearTimeout, i just realized I missed it out? What was your thoughts to this?

Today I will look into an alternate approach.

Best regards,
Best, racnhers!

I am developing a script for a dropdown menu component in pure javascript and dom.
The html markup is printed from a php function. My problem is with the javascript part.
The menubar has a "My Profile" menu which has a submenu that consists of several items.

When I click on the "My Profile" menu then its submenu should appear repeatedly times
when the user hover over it with the mouse which is the general way. But as it is now, this
event gets triggered only once per page load and I can't understand why?

Below is the code for my drop down component it is hardly commented but I hope that a viewer
still will get a clear idea of what is going on. If the html markup is required as necessary material
then I will post the php code that generates it. But for now here is my javascript code.

Please forgive for maybe a badly described issue. I am a little bit stressed out over this.
Thank you very much in advance!

Best regards,

Best, all!

First of all I must say that this problem that I have encountered is of a very complex nature to me. I am terrible at explaining my problems here in english so have patience with me. Also forgive me if I don't have any code at the moment to post here to demonstrate the problem from that point of view. I have mainly only questions. And I am not
sure on my reasoning or logic.

With that said I have a project in which I have a JTree that is populated with parent nodes that has user objects which can contain user defined information about stores of different kind, like their respective type of branch, number of employees and their financial income per year and so on. The user inserts theese with the click of a button in a form in a JDialog. The information in the store info nodes are displayed in that fore mentioned form. The user can also insert child nodes to theese Store nodes and they are called Department nodes. So I have a JTree that consists of Store and Department - nodes.

I know how to traverse or loop though a JTree, insert and remove nodes from the model and I always reload the model after each such action. My problem is how to code a counter that let the user know at which store info node he or she is at. This counter should increment for every new store info node the user adds to the model and for every deletion of a store info node the counter should move back up.

Example of JTree - structure ( during insert - mode )
Store Info

  Store 1
      Department 1
      Department 2

  Store 2
      Department 1
      Department 2
      Department 3

  Store 3
      Department 1
      Department 2


The user edits the names of the stores and departments in the form that is presented to him or her in add mode. My problem like my question is that I don't know how to write the counter that must be displayed in each Store node after the user have added one to the model of the JTree.  If the user deletes Store 2 then I want the counter to remember that node 2 was deleted were three Store nodes in the JTree so it starts to count from 3 when the next Store node is inserted by the user. Can a helpful soul here push me in the right direction. I am completely stuck and time limited. I hope I have not been to complicated thoughout theese lines.

I should mention that I am looking in to the TreeModelListener interface and is experimenting around with the treeNodesInserted -and treeNodesRemoved - methods, would that be in the right direction?.

Many thanks for your visit, Sir!
Kindly, Robert!
5 months ago
@Tim Holloway!

I tried your regex but it gave me an error exception as listed below

Best regards,
5 months ago
@Carey Brown

I have written an example of what I am trying to accomplish. This is just a loose sample and has nothing to do with the application I am working on at the moment. But it gives an idea of what kind of a problem that I have encountered.

I hope that helps to see what's bothering me. My english is like my java, like everything else in my life, nothing is real, all is purely on a wannabe level  

Kind Regards,


5 months ago
Hi, again!

I think I have found a solution to my problem here.

Some what hasty maybe. But I would have liked a single regex string for this situation. Sorry for my bad code.

Thanks for your visit,

5 months ago
Best all!

For example I have tried the code

But the code and regex sample i have supplied here above only tests if a strings starts with a whitespace character or not. I wan't to check
if a string does not starts with a whitespace and only contains numbers. Sorry if I am confusing anyone. Not my intention. Thanks for
your patience with me.

5 months ago
@Stephan Van Hulst

Valid strings in this situation would be


Invalid strings would be like this

" 1"
"   2"
" 2dsds"

I haven't tried that much regex for this case, I am still only at a research level.
There is the non-regex methods "startsWith", "contains", "Character.isDigit" and so on that I have experimented with
but I believe regex is best suited here. Thanks for your reply!

5 months ago
Best, forumists!

I need help with a regex that returns an error if it finds whitespace in the beginning of a string if that string is longer than at least 2 characters
and the string should only contain digits if it contains a non digit character the regex should return an error.

This task seems simple but keep in mind that my regex is not what I wish it would be. I am still a learner in that area.

I should mention that I use the string method matches to test the regex in code. I hope someone here can pinch me in the right direction.

Many thanks to all viewers!

Best regards,
5 months ago
@Marshal McCleod

Yes, sir, I have done that. No effect. The problem remained. I think I have tried every combination there is in that area.

Best wishes,
@Mr Holloway!

Thank you, sir, for some very interesting information. My SQL knowledge is not what I wish it would be but I learn new things every day and practice them.

I have gone through a lot of the derby docs and much on the apache derby users forum in my quest for a long term solution to my increment problem since I've struggled with this for over two weeks now. However the fix I've found with the alter statement make things go for now. I wish there was a way to configure increment values other than defaults through some sql statement. Increment values should never go wrong I hate the fact that I must intrude on them with that alter statement.

Thank you very much again!

Hi again!

I just found out a quick and cheap trick as a possible short term solution to this problem. After any insert process linked to the table that gave me this headache  
I symply made a call to a method in my TableAuthor class that executes the following sql  

Now the primary key increments by 1 instead of 200. This will have to do for now. Thanks for your attention!