Devin
Devin
JCHJava Community | Help. Code. Learn.
Created by Devin on 9/26/2024 in #java-help
How do I use the results of an action?
I'm trying to pass some information from user inputs back into my code but I don't really know how to go about it. Basically, I'm making a Swing application that builds an XML file with a lot of repetitive lines and the idea is that the user will be able to input the unique values for each line, and the program will fill in the rest. I have a dialog open with several text fields for the user to input information, once the user is done, I store the contents of these fields in a List and then (after checking for bad input) use the List to create an object with the user data in the fields. I then need to add the toString of that object to the next line of my final output. The problem is, the information doesn't exist until the user presses the button, I don't know how to tell my code to "wait" until the button is pressed before continuing execution. I guess I'm trying to use swing to make my own, more complicated JOptionpane.showInputDialogue, where instead of returning a String it returns a list of Strings, but it still pauses execution until the strings are confirmed.
185 replies
JCHJava Community | Help. Code. Learn.
Created by Devin on 2/11/2024 in #java-help
Files.readAllLines() throws an exception every time.
I can't figure out why an exception is being thrown by this line of code, it used to work in an earlier version but now it just doesn't. Am I somehow using it wrong?
List<String> lines;
functions = functionsDir.listFiles();
for (File f : functions) {
fileCount++;
lines = Files.readAllLines(f.toPath(), StandardCharsets.UTF_8); //PROBLEM LINE
lineCount += lines.size();
}
List<String> lines;
functions = functionsDir.listFiles();
for (File f : functions) {
fileCount++;
lines = Files.readAllLines(f.toPath(), StandardCharsets.UTF_8); //PROBLEM LINE
lineCount += lines.size();
}
47 replies
JCHJava Community | Help. Code. Learn.
Created by Devin on 2/5/2024 in #java-help
Cannot add openJFX to project "too many module declarations found"
I'm trying to get this JavaFX app working but I don't want to make everyone who has to use it download Java 8. I've tried everything I can think of and It just isn't working. I manually added openJFX to my project and it's stopped letting me build. I can't figure out how to get this to just be a dependency and work normally. I need someone to like, hold my hand through this process, everyone talks like this is the easiest thing they've ever done and it's driving me insane that I can't figure it out.
27 replies