Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

System information program

Hello,

I am trying to make a system information program with a graphical user interface. I want to grab things such as available processors and such and display them in the program.

I am using WindowBuilder in Eclipse. I am just wondering, where to i input the information if i want it to run instant when you run the program? I want to set for example:

Code
Runtime.getRuntime().freeMemory()

As a text field. By using like text1.setText() or whatever.

Anyone who can help me get started?
Put it
1) in your main method after the initialization of the GUI
2) After the text field was created

If you want continuous updates, you could use
Code
...
new Thread(new Runnable({
@Override
public void run() {

while(booleanStillUpdating){
Thread.sleep(TimeYOuWantTOSleepInMSHere)
//set the tetx of the text field again
}

}
}).start();
...
(Apr 11, 2017 03:05 AM)Weco Wrote:  Put it
1) in your main method after the initialization of the GUI
2) After the text field was created

If you want continuous updates, you could use
Code
...
new Thread(new Runnable({
@Override
public void run() {

while(booleanStillUpdating){
Thread.sleep(TimeYOuWantTOSleepInMSHere)
//set the tetx of the text field again
}

}
}).start();
...

Thanks, worked well when I placed it after the textfields.

And I appreciate the lil extra part, will for sure use it.

This is what it looks like atm:

[Image: 7afMLp3.png]

Anyone know how to get CPU temp and such?
(Apr 12, 2017 03:14 AM)Mαxim Wrote:  Thanks, worked well when I placed it after the textfields.

And I appreciate the lil extra part, will for sure use it.

This is what it looks like atm:

[Image: 7afMLp3.png]

Anyone know how to get CPU temp and such?
For getting CPU Temperature you would probably need to call natives outside the JVM. But you could get quite some Information from OperatingSystemMXBean
(JavaDocs: http://docs.oracle.com/javase/7/docs/jre...XBean.html)

And you can set the text of the text labels directly while creating them, for example:
JLabel os = new JLabel(System.getProperty(nameOS));


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by PDGLOBALJan 11, 2020 12:01 PM 2 231 Jan 11, 2020 12:01 PM
Last Post: PDGLOBAL
[C#] by chrizatorFeb 4, 2018 09:23 AM 12 548 Feb 4, 2018 09:23 AM
Last Post: chrizator
[.NET] by PharmacistNov 18, 2016 12:02 PM 9 281 Nov 18, 2016 12:02 PM
Last Post: Lucifer Morningstar