How can i create a javafx gui that reads from a text file and add them to a ui control and how can i use the add and remove btn | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i create a javafx gui that reads from a text file and add them to a ui control and how can i use the add and remove btn

Create a JavaFXGUI (Graphical User Interface) application to use the implemented classes as follows:There is a suitable title for the application window.After launching the application immediately, the available workshops should be read from the text file and added to a suitable UI control to select from.It allows registeringand removing attendees, and displaying the whole data. Any confirmation or error message should be displayed on the application (not the standard output).There is a button to clear all UI controls used for entering the data

1st Jun 2021, 6:23 PM
Mark G. Ghrayeb
Mark G. Ghrayeb - avatar
11 Answers
+ 3
Hello Mark G. Ghrayeb How familiar are you with JavaFX? Did you already tried some basic examples like a window with button? If not, at first you should learn how javafx works. There are many youtube tutorials and you can also look at udemy.
1st Jun 2021, 6:44 PM
Denise Roßberg
Denise Roßberg - avatar
1st Jun 2021, 7:38 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Okay thank you for your help
1st Jun 2021, 7:43 PM
Mark G. Ghrayeb
Mark G. Ghrayeb - avatar
+ 1
TextArea has a clear() method. clear.setOnAction(e -> { ta.clear(); }); And for reading the text file I would write an extra method. Your code will be messy if you put everything into start() When you open the application you need to read the file? Without an extra button? In that case you can put readTextFile() into show() And in your class you write a method readTextFile(){ } And if I see it right you can use the file reading part from your other class. But you need to replace the print statements in case of errors with alerts. https://code.makery.ch/blog/javafx-dialogs-official/
1st Jun 2021, 7:24 PM
Denise Roßberg
Denise Roßberg - avatar
0
Yes i will send you my code but i am having dificulty in transferring my code to an event driven programming for examole if i want to add an attendee to a workshop or to remove an attendee
1st Jun 2021, 6:46 PM
Mark G. Ghrayeb
Mark G. Ghrayeb - avatar
0
Mark G. Ghrayeb Can you please put your code into code playground. So I can copy it into my ide.
1st Jun 2021, 6:48 PM
Denise Roßberg
Denise Roßberg - avatar
1st Jun 2021, 6:52 PM
Mark G. Ghrayeb
Mark G. Ghrayeb - avatar
0
Mark G. Ghrayeb Looks not so bad I would say. I just need a bit more informations. The TextArea should show the content of your textfile, right? And clicking on clear button clears the TextArea?
1st Jun 2021, 6:59 PM
Denise Roßberg
Denise Roßberg - avatar
0
Exactly if you want i can send you the question i would be so appreciated if you help me
1st Jun 2021, 7:00 PM
Mark G. Ghrayeb
Mark G. Ghrayeb - avatar
0
And how can i add attendees when i press add or remove them do you have any idea?
1st Jun 2021, 7:26 PM
Mark G. Ghrayeb
Mark G. Ghrayeb - avatar
0
Mark G. Ghrayeb Your welcome. :)
1st Jun 2021, 7:45 PM
Denise Roßberg
Denise Roßberg - avatar