i am looking for a simple way to display the name of the server on my server gui. I know this is unnesseccary for the assignment, but it will help me.
On the server GUI's JFrame just call super(title) (assuming you subclass JFrame) in the GUI constructor or call setTitle(title). Of course the title will have to be initialized to the server name. Or you could dedicate a JLabel somewhere on the GUI to display it.
Another question, are you allowed to use the System.getProperty methods to retrieve the user directory.
Of course. Feel free to use any tool available to you in the J2SE arsenal.
Hope this helps,
On the server GUI's JFrame just call super(title) (assuming you subclass JFrame) in the GUI constructor or call setTitle(title). Of course the title will have to be initialized to the server name
I did the same, -- in networked mode, my client JFrame title bar showed "Fly High -- Connected to db.db on serverName:1099". In local mode, the title bar is "Fly High -- Connected to c:\userdir\db.db".
you did indeed answer the question i asked. However i phrased it totally wrong. I know how to display something on a label or on a frame.
But.. my question was supposed to be
how can i extract the servername on the server ?
what java commands do i need to use ?
Ex: java -jar server.jar
When the GUI pops up for the server it says "I am remote.server.com" blah...
I dont know but I would guess if anything it would be in a System.getProperty()
( and author)
The Sun Certified Java Developer Exam with J2SE 1.4