Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

David Garratt

Ranch Hand
+ Follow
since Aug 08, 2003
David likes ...
Eclipse IDE Mac Safari
Peterborough, UK
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 David Garratt

I'm looking for information - tutorial on Eclipse and the new Java modules requirements.

Rather than jump directly into trying to get my existing application working I though I would learn a little bit more about the file and see if there are any useful functions within Eclipse to help me populate it with missing requirements.

For example a very simple basic class created with WindowBuilder Pro gave me :-

However as my Eclipse IDE was running with JDK 12 it did not like most lines and the vital clue was :-

The package java.awt is not accessible

A quick google told me that I need to insert the line :-

requires java.desktop;

in my

I then started to look around in Eclipse to see if there were any helper functions to populate this kind of reference automatically - not unlike what it does for import statements.

I found a section in the Build Path called "Module Dependencies" but it was unclear what to do and I've not found anything online to walk me through it.

If someone knows of a good book or online reference which could combine the new functions in Java 9+ and also include new features in Eclipse 2019-09 which help with development it would be great.

I'm still working with Java Swing applications and the amount of code to review is substantial.

I'm also going to struggle with understanding what the module requirements are going to be for 3rd part libraries.

Many thanks in advance.


5 days ago
Just wondering if anyone has been beta testing the forthcoming MacOs and knows if it will work with Java 8 ?
2 weeks ago
Sounds like that's the approach to go. I'm sure I'll make some mistakes but I will feed back any progress / problems I encounter in case it helps others.
2 months ago
I'm adding a function to my application to record product weight. Basically the user will be asked to record the weight of the product being produced every 15 minutes and he will sample 5 containers each time. I will work out the mean, standard deviation and any legal deviations from the acceptable weights. At the same time as this I would like to display a graph on the users screen showing these stats for the current batch for up to 24 hours.

My only experience of graphs is the jFreeChart which is part of JasperReports but in my situation I want the graph to be on a Java Swing desktop and refresh each time a new set of 5 samples has been completed.

The business logic for what I want to display and when I suppose is not too relevant. What I would like to know is if there is a graph library suitable for this.

Would I need to destroy / remove the graph each time it's updated or is there a library out there which can refresh its values automatically every few seconds providing it's given a SQL select statement to capture the required data at the start ?

Finally whatever library I use needs to be open source so that I can include it in my project.

I appreciate it's a large question with broad scope but maybe someone has done something similar and might have some recommendations.


2 months ago
Yes its all working - I would just like to make the process of establishing the initial config a little simpler for the novice.

Youtube link
3 months ago
I would like to enhance the initial setup of my application with a database setup wizard. As I support 3 different database types which will all require different type of connection wording, instance name, ,schema SID I see the wizard being required to take numerous paths depending on the users initial selection.

I would welcome any advice on the best Java Swing/AWT components which could be used to accomplish this without getting into a visual and design nightmare. Currently I do all my design work using WindowBuilder Pro.

Any thoughts or experience on doing something similar would be most appreciated.

3 months ago
From my tests it seems that the conversion back from a string / text field to a bigdecimal is assuming that the number is formatted in us/en even when it's not and hence the swapped comma and dot which is being used correctly on screen results in the value of my decimal being wrong.

My above fix it a temporary measure to help overcome a inconsistent data problem for now but will need more work.

5 months ago
What I have done for a quick global fix is to use Locale.setdefault to ensure that I have a consistent us/en format throughout the application - at least until I have a better solution.
5 months ago
To clarify using pseudo code

Decimal myval = 12345.678

Jtextfield mytextfield.settext(myval.toString)

On screen displayed as 12.345,678 due to regional settings

Decimal exitVal = new Decimal (mytextfield.gettext());

Actual value of exitVal is now 12.345

If I swap out text field for formatted text field are you suggesting that I set the display format to us format even if the users normally used to seeing Hungarian for example ?

Sorry for rough and ready pseudo code - been awake in hospital ward all night.
5 months ago
I'm not entirely sure but if I read the description correctly don't you have to specify the required display/edit format rather than just default to the regional settings. Then I'm not sure if I would be any better determining the value of it.

Sorry if I've misread it.

5 months ago

I have my application running on a site a different users have different regional settings for Windows so that when a value is calculated (mostly as a decimal) and then assigned to a jtextfield it respects the windows formatting format so I might see


That's fine. However when convert the string (text) back from the field for storage in the database I get

4.567 instead of 4567.00 as the dot is being interpreted as a decimal place and not a thousand separator.

Sorry for lack of source code at this point as I'm in a hospital bed typing on my mobile.

Assuming I have a set and get method to get a decimal from a database and I want to both set and read the jtextfield.gettext() in a manner which can understand the context of comma and dot according to regional settings - how should I be doing this ?

I have a lot of swing code to update to fix this so if there was a way to use a replacement to jtextfield which could handle this it would be perfect - I realise that the jtextfield may not be at fault but if I could replace it with a class that would return a consistent formatted string that would always be represented as n,nnn.nnn it would make life just a little simpler.

Many thanks


5 months ago
That worked for me - many thanks.

6 months ago