• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Highscores using JSON and TableView  RSS feed

 
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same as you did for gson... Download the jar and then it depends on your ide.
For intelij:
Left conner, click on file, then projectstructure, global libaries, + sign, from java, navigate to the jar, add, ok
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:oeps forgot to mention, you need to put json.simple on your classpath



Nvm this works! The only thing now is that my autoSave() method is broken..

 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah... without any context I don't really know what's wrong.
but you could use that if statement in the creation of your jsonObject
 
Axel Rey
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:Yeah... without any context I don't really know what's wrong.
but you could use that if statement in the creation of your jsonObject


I just think that your createJsonObject() method isn't used anywhere so it won't 'create' a new hiscore once dead.
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah for that part you have to do yourself... But at least you got a good start now...
 
Axel Rey
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:yeah for that part you have to do yourself... But at least you got a good start now...


I fixed this but the application crashes on startup once a new highscore is added. This is because your .txt is vertically built and mine just adds the object horizontally.

So yours is like:


and mine is:


Do you know how I could add this highscore under the previous one so the app doesn't crash?
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
call .newLine() on your BufferedWriter after you written the object to the file
 
Axel Rey
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:call .newLine() on your BufferedWriter after you written the object to the file


I did that but that doesn't seem to work?
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
weird...
 
Axel Rey
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:weird...


I'll try to find a fix for that, thanks a lot for all your help and effort!!
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No prob... Feel free to like my answer . I wanna keep my position on the leaderbord ;) (yes I'm that competitive )
 
Axel Rey
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:No prob... Feel free to like my answer . I wanna keep my position on the leaderbord ;) (yes I'm that competitive )


Liked it! This probably was one of my last questions here on the forum. So once again: thanks! Good luck with any future activities =).
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same to you
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!