| | |
Help regarding the updating of the user interface..
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 37
Reputation:
Solved Threads: 0
Java Syntax (Toggle Plain Text)
public static void tri() { ClassLoadingMXBean classmxbean = ManagementFactory.getClassLoadingMXBean(); ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean(); int thread_count = threadmxbean.getThreadCount(); int peak_thread_count = threadmxbean.getPeakThreadCount(); int daemon_thread_count = threadmxbean.getDaemonThreadCount(); Trail1 tt = new Trail1(); try { tt.thrd_ct.setText(Integer.toString(thread_count)); tt.pk_thrd_ct.setText(Integer.toString(peak_thread_count)); tt.demon_thrd_ct.setText(Integer.toString(daemon_thread_count)); tt.thrd_ct.repaint(); tt.pk_thrd_ct.repaint(); tt.demon_thrd_ct.repaint(); } catch (NullPointerException e) { } } } public class Trail1 { public static JTextField thrd_ct; public static JTextField pk_thrd_ct; public static JTextField demon_thrd_ct; public void tri1() { JFrame frme = new JFrame(); JLabel thrd_cnt = new JLabel(); JLabel peak_thrd_cnt = new JLabel(); JLabel demon_thrd_cnt = new JLabel(); JTextField thrd_ct = new JTextField(); JTextField pk_thrd_ct = new JTextField(); JTextField demon_thrd_ct = new JTextField(); thrd_cnt.setText("Thread Count"); thrd_cnt.setBounds(100,180,200,50); thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20)); peak_thrd_cnt.setText("Peak Thread Count"); peak_thrd_cnt.setBounds(100,220,250,50); peak_thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20)); demon_thrd_cnt.setText("Daemon Thread Count"); demon_thrd_cnt.setBounds(100,260,250,50); demon_thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20)); thrd_ct.setBounds(500,180,100,30); thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20)); pk_thrd_ct.setBounds(500,220,100,30); pk_thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20)); demon_thrd_ct.setBounds(500,260,100,30); demon_thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20)); frme.getContentPane().add(thrd_cnt); frme.getContentPane().add(peak_thrd_cnt); frme.getContentPane().add(demon_thrd_cnt); frme.getContentPane().add(thrd_ct); frme.getContentPane().add(pk_thrd_ct); frme.getContentPane().add(demon_thrd_ct); frme.setTitle("JVM Monitoring"); frme.setLocation(new Point(0, 0)); frme.setSize(new Dimension(1100, 800)); frme.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frme.setResizable(false); frme.setLayout(null); frme.setVisible(true); frme.getContentPane().setVisible(true); frme.validate(); frme.getContentPane().validate(); } }
I am creating the JFrame in Trail1 class..
Creating an instance of it in the Trial() class..
The tri() function is in a loop that executes to bring the values every 1000 secs...
Hope the idea is clear...
Please try and help..its really important..
I am trying this since long...
![]() |
Similar Threads
- updating text fields in GUIs (Java)
- Help me " Ticket Reservation System" (C++)
- passing arrays / updating object arrays (C++)
- Simulate Mouse Move (C++)
- web help (PHP)
- ALL GMail invites to be posted here please! (Geeks' Lounge)
- Hijackthis report, I just don't know (Viruses, Spyware and other Nasties)
- bridge.dll (Viruses, Spyware and other Nasties)
- Another Trojan.Bookmarker.Gen (Viruses, Spyware and other Nasties)
- 35 processes, need to trim the fat (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: hi
- Next Thread: Trying to add a simple applet to a web page
Views: 672 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Java
add android api apple applet application arguments array arrays automation binary bluetooth chat chooser class classes client code component converter database detection digit draw eclipse equation error event exception file fractal functiontesting game givemetehcodez graphics gui health helpwithhomework html hyper ide idea image input int integer j2me java javame javaprojects jmf jni jpanel julia linux list loop main map method methods mobile myregfun netbeans newbie nonstatic number object oracle os pattern pearl print problem program programming project recursion scanner screen scrollbar server set size sms socket sort spamblocker sql sqlserver string superclass swing test thread threads time transfer tree windows






