1 year ago
#264595
JackJack
JTree node messes up after importing from JSON file
Currently, I am writing a java program that will try to scan a computer and present the memory component as a JTree
like this Tree and work flow. The scan happens in two phases. In the first phase it will scan for Linux Device and insert the resulting Linux Device into the tree. In the second phase, the scan is looking for the UEFI device and insert them into the tree. And hence the structure of Linux Device on top and UEFI device at the bottom appear on the GUI (Java Swing).
After that, I export the information to a JSON file that contain the device name (ie. MD name) and their corresponding type Linux or UEFI. However, after I import the JSON file, I found out that proper order Linux device on the top and UEFI at the bottom is completely mess up.
I do some study on the JSON format and find out that it is unorder. Also, the lead engineer has required every export and import of the program would need to follow JSON so there is no way to choose something other than JSON.
What would be the appropriate engineer approach to keep the order of the item the same. The same as before import like this.
How to fix the problem of JTree
nodes messing up after importing from JSON file?
java
json
swing
jtree
treenode
0 Answers
Your Answer