Knute Snortum

Sheriff
+ Follow
since Apr 20, 2013
Knute likes ...
Chrome Eclipse IDE Java Postgres Database VI Editor
Forum Moderator
After 25 years of programming, Knute has retired to be a professional musician. Knute first learned BASIC and Cobol on a CPM Timeshare system circa 1985. He spent way too long coding in one flavor of Business Basic or another. Going back to college, he learned C and a whole new world opened up to him. Knute likes Perl and Java, for completely opposite reasons. Knute is a complex person.
Portland, Oregon
Cows and Likes
Cows
Total received
142
In last 30 days
4
Total given
224
Likes
Total received
945
Received in last 30 days
37
Total given
284
Given in last 30 days
15
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Knute Snortum

tony narloch wrote:the YearData class does not possess an ArrayList, only variables.


If those variables are defined outside of any method, they are instance variables and should accessed through "getters".

the City class contains an ArrayList.


That makes sense.  A City would have YearData, if by that you mean annual weather patterns.  The class should be named something more descriptive, like AnnualWeather.

If List<YearData> is an instance variable (it should be), you will need an instance of the class (an object) to access it.  You initialize it in City.


11 hours ago
The first three things are definitely required.  I'm not sure about the fourth. 

The "requires" line in the module-info.java is definitely needed.  The "exports" line is only needed if some other package requires edu.uw.poolska.

Is this the tutorial you mentioned?

https://openjdk.java.net/projects/jigsaw/quick-start
12 hours ago
It's good to remember that saying ItDoesntWorkIsUseless (that's a link).  Tell us what happened in detail.  We can't help it we don't know what's going on.
1 day ago
I'll assume that the variable input is of type Scanner.  If so, what is happening is that when you get a token (chunk of data) with the method next(), you will leave the <enter> character (varies by OS) in the buffer -- or it looks like, any extra characters the user enters.  Then when you take the next token with the nextLine() method, it will only take the <enter> character and return a empty String (or the extra characters).

To avoid this, execute a input.nextLine(); to clear the buffer.

1 day ago
...but weren't we talking about fixing this code?
Then you could do this with a "for each" loop:
That would give you a file with each field on a separate line.  That may not be what you want.

While I write this, I see you have posted how you want the data to be saved.  You probably don't want to use the method above.  Do you have a Contact class?  If so, use a list of contacts, List<Contact>, then use a loop like this:
If you write a toString() method correctly, this format will post to the text file.
1 day ago

Ruben Ochoa wrote:You mean:
The output is just []


No, you don't need a loop for that (and notice you're not using the variable data).  If that's all you need just write:
1 day ago
Don't give up.

The easiest way to get "18" from the String "18:FA:05:11" is to use the substring() method in String.  You can find the docs for that here:

https://docs.oracle.com/javase/9/docs/api/java/lang/String.html

and here

https://docs.oracle.com/javase/9/docs/api/java/lang/String.html#substring-int-int-

You could also use the split() method; see here:

https://docs.oracle.com/javase/9/docs/api/java/lang/String.html#split-java.lang.String-
1 day ago
The latest version of Scene Builder is 10 (I think they skipped some versions to keep inline with Java).  It looks like you're using Java 1.8 so be sure to compile your FXML with that version of JavaFX (1.8).  I believe the highest version of Scene Builder for Java 1.8 is 8.5.0.  Here's the URL for that:

https://gluonhq.com/products/scene-builder/

Have you tried using the fonts in other programs to see if they work properly?  Like maybe MS Word?
1 day ago
Have you tried a "for each" loop?  They work well with Lists:
1 day ago
Let's break this down.

1) The employee class needs a constructor that takes paraments or "setters" that will set the information of the class.  You have defined name, salary, etc. but you never set their values.  Let's see at what the constructor should look like:
If you can see the pattern, it's that the fields (variables outside of any method) are private and defined.  Then in the constructor, you pass in the data through the parameters.

2) Pass the data in with a constructor.  Your EmployeeDemo class would look like this:
You create the employee object after you have gathered all the data, then pass this data into the Employee class.

If you have trouble, post back here.
1 day ago
When you say, I get errors, pick one, detail the situation in which it occurred, and post the entire error message, stack trace and all.  I know you have had many errors, but if we focus on one we will have a much better chance of success.
1 day ago
What I do in these situations is google something like java enum example, which gives me a nice page:

http://www.ntu.edu.sg/home/ehchua/programming/java/javaenum.html

Skimming it, it looks good.  Down in section 2 (I believe) they talk about enums with parameters.
1 day ago
I think it could be as simple as removing line 21.  If you call llenadocombobox3() the first thing you do is call llenadocombobox2() which will (I believe) wipe out any selection on your comboBox.

What would also be helpful is if there's an exception, post the entire error message, stack trace and all.  If there's no exception, describe to us what is happening in detail.
1 day ago
Could you post all of the FXML file that produced that window?  I suspect something's wrong with the way you defined the TestArea, especially if you get the same results with another font.

(Note: you posted this in the Swing forum.  We have a dedicated JavaFX forum which I moved this thread to.)
1 day ago