View Javadoc

1   /**
2    * Pure Java JFC (Swing 1.1) application.
3    * This application realizes a windowing application.
4    *
5    * This file was automatically generated by
6    * Omnicore CodeGuide.
7    */
8   
9   package com.builder.uk.watchme;
10  
11  /*
12   * #%L
13   * phynixx-jmx
14   * %%
15   * Copyright (C) 2014 csc
16   * %%
17   * Licensed under the Apache License, Version 2.0 (the "License");
18   * you may not use this file except in compliance with the License.
19   * You may obtain a copy of the License at
20   * 
21   *      http://www.apache.org/licenses/LICENSE-2.0
22   * 
23   * Unless required by applicable law or agreed to in writing, software
24   * distributed under the License is distributed on an "AS IS" BASIS,
25   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26   * See the License for the specific language governing permissions and
27   * limitations under the License.
28   * #L%
29   */
30  
31  
32  import javax.management.MBeanServer;
33  import javax.management.ObjectName;
34  import java.lang.management.ManagementFactory;
35  
36  public class WatchMe {
37  
38      public static void main(String[] args) {
39  
40         new WatchMe();
41      }
42  
43      WatchMeBean smb;
44  
45      public WatchMe() {
46          MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
47  
48          smb = new WatchMeBean();
49          Thread t = new Thread(smb);
50          t.start();
51  
52          try {
53              ObjectName myname = new ObjectName("WatchMeBean:name=watchme");
54              mbs.registerMBean(smb, myname);
55          } catch (Exception e) {
56              e.printStackTrace();
57          }
58  
59          WatchMeFrame watchMeFrame = new WatchMeFrame();
60          watchMeFrame.setWatchMeBean(smb);
61  
62          watchMeFrame.pack();
63          watchMeFrame.setVisible(true);
64      }
65  
66  }
67