Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

Michael D Sims

Ranch Hand
+ Follow
since Sep 20, 2014
Michael D likes ...
IntelliJ IDE MySQL Database Java
I am a network consultant by trade for over 20 years now. I started my obsession with computers back in 1982 when I was 12 years old after I received a Commodore 64 as a gift from my parents. I started to learn how to program by dissecting those basic programs they published in computer magazines. I then got into the local BBS community, local user groups etc.
I was unaware that one could make a living at computers until I was in my early 20's. Until then, computers had been a hobby, not realizing companies needed people like me to help them maintain their systems.
I became a Novell engineer within 5 months of starting my first paid job as a technician and my career has only escalated exponentially since then.
Even though I have made my bread and butter in networking, becoming quite skilled at Cisco routers, switches and firewalls, VOIP systems including AVVID and Asterisk, operating systems like Windows workstation and server, Exchange and in the late 1990's, I started learning how to write database applications using Microsoft Access. That escelated into SQL apps, and other languages such as .NET and eventually Java.
Programming has been something I've always done for side work and never as a career.
I have a bachelors degree in CIS (a business degree) and am currently self employed although recent and drastic life changes is taking me out of that and I will be seeking full time work somewhere very soon.
Victorville, CA
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
10
Received in last 30 days
0
Total given
12
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt Green check

Recent posts by Michael D Sims

Knute Snortum wrote:Try setting the focusTraversable property to false.

https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/Node.html#setFocusTraversable(boolean)



Yeah, I tried that ... I posted my project to github ... if you have a working MySQL server that you have create schema privilege on, the readme explains everything you need to re-create the problem... basically you just put in the MySQL username and password then run the project ... pick a recipe and start tabbing around and you'll see the button show up then disappear when you tab off of it.

Here is the git repository

Thank you very much,

Mike
4 months ago
I have a button that I use to delete records from a tableview. When a record is selected in the view, then that delete button becomes visible, and when no record is selected, that button is hidden (visible property set to false).

What is weird, is that when I am tabbing controls on the form, that button will get a tabstop landing and become visible while it has focus.

I tried to find a way to exclude the button from having any tabindex, but I can't seem to find a way to do that ... and perhaps my approach to the problem is wrong in the first place.

SO, does anyone know how I can make sure that this non-visible button does not get focus during the activity of tabbing between controls on my form, or perhaps some way to make it invisible with enough certainty that it becomes overlooked when tabbing around the form?

Thank you,

Mike
4 months ago
Hello,

Anyone know of any decent apps out there that one could use to store pieces of code we write that we can later reuse? I find myself scouring through old projects from time to time looking for some function I previously figured out, or some class that was - at the time - a stroke of genius lol ... but that search process can be a tedious one.  If I had an app that I could use where I see that I've written a class or something and realizing I may want to use it in the future, it would be nice to have all that in one place where I could categorize it etc.

I did some Googling around on the topic but I didn't find anything. I'm sure I'm not searching with the right verbiage.

Thanks,

Mike
5 months ago

Paul Clapham wrote:I would just suggest it isn't really a worthy goal. Unless you have many thousands of TextFields, the memory used by creating one listener per TextField isn't worth worrying about.


I sort of worked myself into that conclusion while I was waiting for a reply to my post. I always look for more efficient ways to code wherever possible, even if the time/value benefit doesn't exist. It's code for personal use so no real loss in the learning curve.



Cheers!
5 months ago
I have a slew of TextFields, where I need to place a ChangeListener on their respective focusedProperty. Instead of creating a ChangeListener for each individual TextField, I want to write a generic ChangeListener<Boolean> one time, then re-use that by assigning it to each TextFields focusedProperty. Then, within that ChangeListener, I would like to use the observable object passed into the ChangeListener to somehow gain reference back to the TextField class so that I can get to the actual text that the user typed into the TextField itself.

So the way it would work, is when someone types text into the a TextField, then tabs out of the field, the focusedProperty ChangeListener that I assigned will trigger where I can then take action on the text that the user typed.

Is it possible to do this?

Thank you,

Mike
5 months ago
I have a table created and a stylesheet assigned to it and for the most part it's looking the way I want it to but when I select a row, the background color for the selection does not line up with the text in the row... I have attached a photo to show you what I mean.



And here is the relevant style coding that I'm using (relevant as far as I know ... my css knowledge is sketchy at best):




Any idea what I can do to get that selection background color to line up properly with the text?

Thank you,

Mike Sims
1 year ago

Campbell Ritchie wrote:

Paul Clapham wrote:. . . Probably the word "D'oh" wasn't invented specifically for computer programmers . . .

Are you telling me Homer Simpson didn't invent it himself?


I watched a documentary on this and some very credible Area 51 "researchers" presented a good case for this ... BUT ... as per usual ... no definitive, clear cut evidence ever emerges...

1 year ago
The summonCards() method in the Cards class should have been deleted . ... my bad.
1 year ago






52 Cards
Ace of spades
Two of spades
Three of spades
Four of spades
Five of spades
Six of spades
Seven of spades
Eight of spades
Nine of spades
Ten of spades
Jack of spades
Queen of spades
King of spades
Ace of hearts
Two of hearts
Three of hearts
Four of hearts
Five of hearts
Six of hearts
Seven of hearts
Eight of hearts
Nine of hearts
Ten of hearts
Jack of hearts
Queen of hearts
King of hearts
Ace of clubs
Two of clubs
Three of clubs
Four of clubs
Five of clubs
Six of clubs
Seven of clubs
Eight of clubs
Nine of clubs
Ten of clubs
Jack of clubs
Queen of clubs
King of clubs
Ace of diamonds
Two of diamonds
Three of diamonds
Four of diamonds
Five of diamonds
Six of diamonds
Seven of diamonds
Eight of diamonds
Nine of diamonds
Ten of diamonds
Jack of diamonds
Queen of diamonds
King of diamonds
1 year ago

Campbell Ritchie wrote:I am not sure that will work, because OP is required to produce a List<Card>. I don't know why she said anything about a List<Integer>.



OOPS...
1 year ago

Stephan van Hulst wrote:To my regret, I'm very VERY familiar with these kinds of d'oh moments.


When I realized my efforts were not giving me success when I knew it should be working, I realized my head was too fuzzy and that a fresh pair of eyes would be bound to see it. This s why these forums are awesome!  

1 year ago

Stephan van Hulst wrote:Well yeah, you have an extra comma in the format string after the month specifier.


MAN!!! Im so glad I posted this I would have continued overlooking that for god knows how long.

THANK YOU, it works now.
1 year ago

Ana Yo wrote:Hi there, I just started learning about ArrayLists and I am trying to implement a deck of cards. The instructions are:
/*Pre-condition: none
  *Post-condition: A new ArrayList of cards will be created with 52 cards.  
  *There will be 4 suits with 13 cards each.
  */
This is what I have so far:

I don't know if I should add more code or not.










Output:
Ace of spades
Two of spades
Three of spades
Four of spades
Five of spades
Six of spades
Seven of spades
Eight of spades
Nine of spades
Ten of spades
Jack of spades
Queen of spades
King of spades
Ace of hearts
Two of hearts
Three of hearts
Four of hearts
Five of hearts
Six of hearts
Seven of hearts
Eight of hearts
Nine of hearts
Ten of hearts
Jack of hearts
Queen of hearts
King of hearts
Ace of clubs
Two of clubs
Three of clubs
Four of clubs
Five of clubs
Six of clubs
Seven of clubs
Eight of clubs
Nine of clubs
Ten of clubs
Jack of clubs
Queen of clubs
King of clubs
Ace of diamonds
Two of diamonds
Three of diamonds
Four of diamonds
Five of diamonds
Six of diamonds
Seven of diamonds
Eight of diamonds
Nine of diamonds
Ten of diamonds
Jack of diamonds
Queen of diamonds
King of diamonds
52 Cards
1 year ago
Hello,

Been racking my brain on this too long and I need some fresh perspective please.

I am trying to convert dates / times that are given to me like this: Thursday, January 25, 2018 at 3:50pm PST in to a MySQL Timestamp.

I've been trying to use JodaTime to do this conversion but i don't really care what I use as long as I can get it converted - which means if you have an alternate method to show me, please do.

Here is the code that I've been trying to accomplish this with:


When I execute this code, the compiler throws an Exception that looks like this:

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Invalid format: "Thursday, January 25, 2018 at 3:50pm PST" is malformed at " 25, 2018 at 3:50pm PST"

and its pointing to this line as the source of the exception:

DateTime  dt = fmt.parseDateTime(date);

I've tried massaging the pattern with no luck for many hours... can someone see what I am doing wrong?

Thank you,

Mike Sims
1 year ago

Stephan van Hulst wrote:Michael, your example doesn't contain any action that needs to wait until the UI update is done. Why do you need to wait until the text area and buttons have updated? What do you want to do afterwards?

It's also not a good idea to use polling (also known as "busy wait") to wait for other tasks to finish. I'm not convinced you need to wait at all, but if you do, use lock conditions.


That wasn't really the point, but I'll give you a real world example Stephan:

Here is a runnable that I want to execute as a thread to prevent the UI from hanging, lets jut assume there i a lot of code in there including blocking code such as waiting for a socket connection and as I said, I don't want the application Thread being blocked during that time - i'm not saying that is exactly what I'm doing, but just assume that is what Im doing and assume that I refuse to do it any other way ... the question still stands, is there a way to execute a Platform.runLater with blocking?:



I cannot call the showOpenDialog method outside of the Application Thread, but I need the file reference before I can continue executing the rest of the code in the Runnable, therefore, I need to block while waiting for the user to chose a file.