Help regarding the updating of the user interface..

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2008
Posts: 37
Reputation: Shveetis is an unknown quantity at this point 
Solved Threads: 0
Shveetis Shveetis is offline Offline
Light Poster

Help regarding the updating of the user interface..

 
0
  #1
Feb 25th, 2008
Hello...
I have implementd a user interface and I need to update the user interface every 5secs widout requiring to draw the entire JFrame again..

is dre anything that can help me change my textfield values every 5secs without affecting the other issues on my interface??
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,515
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 523
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Help regarding the updating of the user interface..

 
1
  #2
Feb 25th, 2008
You can do this easily with a Timer.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 37
Reputation: Shveetis is an unknown quantity at this point 
Solved Threads: 0
Shveetis Shveetis is offline Offline
Light Poster

Re: Help regarding the updating of the user interface..

 
0
  #3
Feb 25th, 2008
Actually I have already implemented a code to retrieve the values that are to be shown on the UI but I am facing difficulty in showing them on the JFrame i.e in the JTextFields..

The textfields show no content...

What do you think can my mistake be possibly??
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,515
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 523
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Help regarding the updating of the user interface..

 
0
  #4
Feb 25th, 2008
I have no idea, since you didn't post any of that code here, and that has nothing to do with the question that you did ask.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 37
Reputation: Shveetis is an unknown quantity at this point 
Solved Threads: 0
Shveetis Shveetis is offline Offline
Light Poster

Re: Help regarding the updating of the user interface..

 
0
  #5
Feb 25th, 2008
  1.  
  2. public static void tri() {
  3.  
  4.  
  5. ClassLoadingMXBean classmxbean = ManagementFactory.getClassLoadingMXBean();
  6. ThreadMXBean threadmxbean = ManagementFactory.getThreadMXBean();
  7.  
  8. int thread_count = threadmxbean.getThreadCount();
  9. int peak_thread_count = threadmxbean.getPeakThreadCount();
  10. int daemon_thread_count = threadmxbean.getDaemonThreadCount();
  11.  
  12. Trail1 tt = new Trail1();
  13.  
  14. try {
  15.  
  16. tt.thrd_ct.setText(Integer.toString(thread_count));
  17. tt.pk_thrd_ct.setText(Integer.toString(peak_thread_count));
  18. tt.demon_thrd_ct.setText(Integer.toString(daemon_thread_count));
  19.  
  20. tt.thrd_ct.repaint();
  21. tt.pk_thrd_ct.repaint();
  22. tt.demon_thrd_ct.repaint();
  23.  
  24. } catch (NullPointerException e) {
  25.  
  26.  
  27. }
  28. }
  29. }
  30.  
  31.  
  32. public class Trail1 {
  33.  
  34. public static JTextField thrd_ct;
  35. public static JTextField pk_thrd_ct;
  36. public static JTextField demon_thrd_ct;
  37.  
  38. public void tri1() {
  39.  
  40. JFrame frme = new JFrame();
  41. JLabel thrd_cnt = new JLabel();
  42. JLabel peak_thrd_cnt = new JLabel();
  43. JLabel demon_thrd_cnt = new JLabel();
  44.  
  45. JTextField thrd_ct = new JTextField();
  46. JTextField pk_thrd_ct = new JTextField();
  47. JTextField demon_thrd_ct = new JTextField();
  48.  
  49. thrd_cnt.setText("Thread Count");
  50. thrd_cnt.setBounds(100,180,200,50);
  51. thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));
  52.  
  53. peak_thrd_cnt.setText("Peak Thread Count");
  54. peak_thrd_cnt.setBounds(100,220,250,50);
  55. peak_thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));
  56.  
  57. demon_thrd_cnt.setText("Daemon Thread Count");
  58. demon_thrd_cnt.setBounds(100,260,250,50);
  59. demon_thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));
  60.  
  61. thrd_ct.setBounds(500,180,100,30);
  62. thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));
  63.  
  64. pk_thrd_ct.setBounds(500,220,100,30);
  65. pk_thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));
  66.  
  67. demon_thrd_ct.setBounds(500,260,100,30);
  68. demon_thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));
  69.  
  70. frme.getContentPane().add(thrd_cnt);
  71. frme.getContentPane().add(peak_thrd_cnt);
  72. frme.getContentPane().add(demon_thrd_cnt);
  73.  
  74. frme.getContentPane().add(thrd_ct);
  75. frme.getContentPane().add(pk_thrd_ct);
  76. frme.getContentPane().add(demon_thrd_ct);
  77.  
  78. frme.setTitle("JVM Monitoring");
  79. frme.setLocation(new Point(0, 0));
  80. frme.setSize(new Dimension(1100, 800));
  81. frme.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  82. frme.setResizable(false);
  83. frme.setLayout(null);
  84.  
  85. frme.setVisible(true);
  86. frme.getContentPane().setVisible(true);
  87. frme.validate();
  88. frme.getContentPane().validate();
  89. }
  90. }


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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum


Views: 672 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC