This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests and have Scott Selikoff and Jeanne Boyarsky on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!

Alfonso Sanz

Ranch Hand
+ Follow
since Dec 19, 2015
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 Alfonso Sanz

Dear all,

I don't reach to understand what happens with the following code upon different Window Managers.

I launch two instances of this code.
When uncommenting line:

works ok in Motif Window Manager, GNOME and Win10, but when comment that line and launch the program twice, Win is OK but MWM flickers between both GUIs and in GMOME it is frozen and I have to restart GNOME.

Someone could give me some light in this issue?

Is there any way to know what's occuring at Windows Manager?

Thanks in advance.
3 weeks ago
Thank you all for your answers.

I didn't think of AoP.

Perhaps PropertyChangeListener could work as well.
2 months ago
@ Carey Brown: Thank you for your comments but it is just an example to show my concern.

@ Tim Moores: Thanks for your fast answer. You are right, but imagine the class having. a hundred of fields. I would like to know some mechanism that allows me to launch bark() when one of the fields mutate without having to write bark() in every setter method. I think it would be a more ellegant approach.

Thanks in advance.
2 months ago
Dear all,

My question is:

Having the class Dog:

I would like to implement the observer pattern or something similar in a way that immediately when one of the three fields changes, the bark() method will be called.

Any idea?

Thanks in advance.

2 months ago
Thanks for the quick answers

The idea is for a Swing application to be invoked from a script with a string as param ("remote" is so to speak. In fact must be called from same computer) to update one entry of a JTable asynchronously (No returns).

Probably as Tim Holloway said, the most elegant approach is a microservice, but I don't want to need tens of jars to solve this "small" issue.

This is because I thought of JMX or RMI to avoid so many dependencies.

Still recomending me a microservice? Can I run a microservice without Web Server? (sorry for my ignorance)

Anywhere to get a short manual?

Thank you all!!
9 months ago

I need to create an entry point in my java application to call a method by a shell script passing some params.

I was wondering if is possible to do it via RMI or it is needed in that case for the client to be another java app?

I have thought as different choise  create a MBean and use JMX through some terminal emulator (such as: jmxterm).

Any other idea? By the way, I am using JavaSE

Thanks in advance
9 months ago
Thanks again for your quick answer and your piece of advice.
10 months ago
Hi Stephan,

thanks for your quick answer.

Great, I'll use Robot then for playback, but for recording... I  have seen that it appears I should serialize KeyEvent and MouseEvent, should I?

Thanks in advance.
10 months ago
Dear all,

I would like to save all mouse and keyboard events as well as udp messages received to a file in order to be loaded and played back later on an so analyze the user performance.

I have seen class Robot but it seems quite old.

Perhaps there are newer frameworks doing this easily.

I don't know very well how to begin.

Could someone recommend me any technology, framework,... compatible with Swing?

Thaks in advance.
11 months ago
Thanks Rob for your prompt and expert answer. Indeed seemed to be linked to focus loss.
1 year ago

taking as example the code from:,

being like this:

When changing:


behaviour changes so much...

This is:

1) Hire button must be pressed twice instead of one to add a new elemet to JList.
2) If press Hire once the JFormattedTextField is emptied, it shows an element.

I would like to have the advantages of original version but having the Formatter as well.

What changes should I do?

Thanks in advance!!

1 year ago
Hi Iuliana!

First of all, congratulations for the second edition.

I would like to know if the book covers AOP.

Best Regards.
Thanks Peter for your answer. I did not know the book.
2 years ago
Hello Craig,

My question is about the certificate:

does this book cover the whole matters of the certificate? Could be used as a guide to take the exam  with no taking the Pivotal course ?

does it worth get the certification?

Thanks in advance.
2 years ago