• 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Highscores using JSON and TableView  RSS feed

 
Master Rancher
Posts: 920
17
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
Master Rancher
Posts: 920
17
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
Master Rancher
Posts: 920
17
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
Master Rancher
Posts: 920
17
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
Master Rancher
Posts: 920
17
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
Master Rancher
Posts: 920
17
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
Master Rancher
Posts: 920
17
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
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!