コード例 #1
0
ファイル: TokenLabUI.java プロジェクト: xdy/TokenLab
 public static void main(String[] args) {
   javax.swing.SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           createAndShowGUI();
         }
       });
 }
コード例 #2
0
 public static void main(String[] args) {
   // Schedule a job for the event-dispatching thread:
   // creating and showing this application's GUI.
   javax.swing.SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           createAndShowGUI();
         }
       });
 }
コード例 #3
0
ファイル: NodeStatusPanel.java プロジェクト: ekiwi/tinyos-1.x
 private void initColumnWidths(final JTable table) {
   javax.swing.SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           table.getColumnModel().getColumn(0).setMaxWidth(100);
           table.getColumnModel().getColumn(1).setPreferredWidth(150);
           //                table.getColumnModel().getColumn(2).setPreferredWidth(5);
           //                table.getColumnModel().getColumn(3).setPreferredWidth(5);
           //                table.getColumnModel().getColumn(4).setPreferredWidth(5);
           //                table.getColumnModel().getColumn(5).setPreferredWidth(5);
           table.getColumnModel().getColumn(7).setPreferredWidth(175);
         }
       });
 }
コード例 #4
0
  public static void main(String[] args) {
    // Schedule a job for the event-dispatching thread:
    // creating and showing this application's GUI.

    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            BearSweeper frame = new BearSweeper();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
          }
        });
  }
コード例 #5
0
ファイル: MainFrame.java プロジェクト: XaoZloHnH/hafen-client
 private static void javabughack() throws InterruptedException {
   /* Work around a stupid deadlock bug in AWT. */
   try {
     javax.swing.SwingUtilities.invokeAndWait(
         new Runnable() {
           public void run() {
             PrintStream bitbucket = new PrintStream(new ByteArrayOutputStream());
             bitbucket.print(LoginScreen.textf);
             bitbucket.print(LoginScreen.textfs);
           }
         });
   } catch (java.lang.reflect.InvocationTargetException e) {
     /* Oh, how I love Swing! */
     throw (new Error(e));
   }
   /* Work around another deadl bug in Sun's JNLP client. */
   javax.imageio.spi.IIORegistry.getDefaultInstance();
   try {
     netxsurgery();
   } catch (Exception e) {
   }
 }
コード例 #6
0
ファイル: MarkupReader.java プロジェクト: NCIP/cgr-bambino
  public void run() {
    String line;
    String id = null;
    config.refgenes = new ArrayList<RefGene>();
    config.dbsnp = new ArrayList<dbSNP>();

    try {
      //      System.err.println("quality read start");  // debug
      boolean need_ruler_rebuild = false;
      boolean need_title = false;
      SAMRegion sr = null;
      while (true) {
        line = br.readLine();
        if (line == null) break;
        // EOF
        String[] stuff = line.split("\t");
        if (stuff[0].equals("sample2id")) {
          Sample sample = Sample.get_sample(stuff[1]);
          for (int i = 2; i < stuff.length; i++) {
            config.read2sample.put(new String(stuff[i]), sample);
          }
        } else if (stuff[0].equals("consensus_label")) {
          config.CONSENSUS_TAG = new String(stuff[1]);
        } else if (stuff[0].equals("ruler_start")) {
          config.ruler_start = Integer.parseInt(stuff[1]);
          need_ruler_rebuild = true;
        } else if (stuff[0].equals("title")) {
          config.title = stuff[1];
          need_title = true;
        } else if (stuff[0].equals("refGene")) {
          config.refgenes.add(new RefGene(stuff));
        } else if (stuff[0].equals("dbsnp")) {
          config.dbsnp.add(new dbSNP(stuff));
        } else if (stuff[0].toUpperCase().indexOf("SAM_") == 0) {
          // FUGLY
          SAMResourceTags v = SAMResourceTags.valueOf(stuff[0].toUpperCase());
          if (v.equals(SAMResourceTags.SAM_URL)) config.sams.add(new SAMResource());
          config.sams.get(config.sams.size() - 1).import_data(v, stuff[1]);
        } else if (stuff[0].equals("reference_sequence")) {
          StringBuffer target_sequence = new StringBuffer();
          while (true) {
            line = br.readLine();
            if (line.equals(">")) {
              //	      config.target_sequence = target_sequence.toString().toCharArray();
              config.target_sequence = target_sequence.toString().getBytes();
              break;
            } else {
              target_sequence.append(line);
            }
          }
        } else if (stuff[0].equals("target_region")) {
          sr = new SAMRegion();
          sr.tname = new String(stuff[1]);
          sr.range = new Range(Integer.parseInt(stuff[2]), Integer.parseInt(stuff[3]));
          //	  System.err.println("range " + sr.tname + " " + sr.range.start + " " + sr.range.end);
          // // debug
        } else {
          System.err.println("error, don't recognize tag " + stuff[0]); // debug
        }
      }

      if (config.ruler_start > 0) {
        for (dbSNP snp : config.dbsnp) {
          snp.consensus_adjust(config.ruler_start);
        }

        for (RefGene rg : config.refgenes) {
          rg.consensus_adjust(config.ruler_start);
        }
      }

      if (config.dbsnp != null) {
        for (dbSNP snp : config.dbsnp) {
          //	  System.err.println("adding snp at " + snp.start + " = " + (snp.start +
          // config.ruler_start));  // debug
        }

        config.snp_config.snp_query = new dbSNPSet(config.dbsnp);
      }

      for (SAMResource sre : config.sams) {
        sre.set_region(sr);
      }

      if (av != null) {
        while (av.get_acepanel().is_built() == false) {
          // spin until dependency built
          try {
            System.err.println("MarkupReader spin..."); // debug
            Thread.sleep(50);
          } catch (Exception e) {
          }
        }

        PadMap pm = av.get_acepanel().get_assembly().get_padmap();
        for (RefGene rg : config.refgenes) {
          rg.consensus_setup(pm);
        }

        Runnable later;

        if (need_title) {
          //	  System.err.println("title="+config.title);  // debug
          later =
              new Runnable() {
                public void run() {
                  av.setTitle(config.title);
                  av.repaint();
                }
              };
          javax.swing.SwingUtilities.invokeLater(later);
        }

        if (need_ruler_rebuild) {
          //
          //  ruler labeling has changed.
          //
          later =
              new Runnable() {
                public void run() {
                  //		av.get_acepanel().get_canvas().build_ruler();

                  if (config.start_unpadded_offset != 0) {
                    AcePanel ap = av.get_acepanel();
                    PadMap pm = ap.get_assembly().get_padmap();
                    int upo = (config.start_unpadded_offset - config.ruler_start) + 1;
                    // +1: convert to 1-based offset
                    int po = pm.get_unpadded_to_padded(upo);
                    System.err.println("upo=" + upo + " po=" + po); // debug
                    SNPList sl = new SNPList();
                    sl.addElement(new SNP(po, 0.0));
                    ap.ace.set_snps(sl);
                    ap.get_canvas().center_on(po);
                    ap.get_canvas().repaint();
                  }
                }
              };
          javax.swing.SwingUtilities.invokeLater(later);
        }

        if (config.enable_exon_navigation) {
          if (false) {
            System.err.println("DEBUG: exon nav disabled");
          } else {
            av.get_acepanel().init_exon_navigation();
          }
        }

        av.get_acepanel().get_assembly().build_summary_info();
        // group samples by tumor/normal, if applicable
        //      av.repaint();

        later =
            new Runnable() {
              public void run() {
                av.repaint();
              }
            };
        javax.swing.SwingUtilities.invokeLater(later);
      }

      //      System.err.println("quality read end");  // debug
    } catch (Exception e) {
      e.printStackTrace(); // debug
    }
  }
コード例 #7
0
ファイル: VITop.java プロジェクト: mikelopez/jvm
  /** @throws Exception */
  private static void displayStats() throws Exception {
    String[][] statsList = getCounters();
    ManagedObjectReference hostmor = getHostByHostName(hostname);
    if (hostmor == null) {
      System.out.println("Host Not Found");
      return;
    }

    Object property;
    ArrayList props = (ArrayList) getDynamicProperty(perfManager, "perfCounter");

    if (props != null && props.size() > 0) {
      property = props.get(0);
    } else {
      property = null;
    }

    // ArrayOfPerfCounterInfo arrayCounter = (ArrayOfPerfCounterInfo) property;
    ArrayList counterInfoList = new ArrayList();
    counterInfoList.add(property);

    List<PerfMetricId> midVector = new ArrayList<PerfMetricId>();
    List<String> statNames = new ArrayList<String>();
    for (int i = 0; i < statsList.length; i++) {
      PerfCounterInfo counterInfo =
          getCounterInfo(counterInfoList, statsList[i][0], statsList[i][1]);
      if (counterInfo == null) {
        System.out.println(
            "Warning: Unable to find stat " + statsList[i][0] + " " + statsList[i][1]);
        continue;
      }
      String counterName = counterInfo.getNameInfo().getLabel();
      statNames.add(counterName);

      PerfMetricId pmid = new PerfMetricId();
      pmid.setCounterId(counterInfo.getKey());
      pmid.setInstance("");
      midVector.add(pmid);
    }
    List<PerfMetricId> midList = new ArrayList<PerfMetricId>(midVector);
    Collections.copy(midList, midVector);

    PerfQuerySpec spec = new PerfQuerySpec();
    spec.setEntity(hostmor);

    GregorianCalendar startTime = new GregorianCalendar();
    startTime.add(Calendar.SECOND, -60);

    XMLGregorianCalendar starttimexmlgc =
        DatatypeFactory.newInstance().newXMLGregorianCalendar(startTime);

    // spec.setStartTime(starttimexmlgc);
    spec.getMetricId().addAll(midList);
    spec.setIntervalId(new Integer(20));
    querySpec = spec;

    final List<String> statNames2 = statNames;
    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {

          public void run() {
            createAndShowGUI("VM Name", statNames2);
          }
        });

    Timer timer = new Timer(true);
    timer.schedule(
        new TimerTask() {

          public void run() {
            refreshStats();
          }
        },
        1000,
        21000);
  }
コード例 #8
0
ファイル: Misc.java プロジェクト: BackupTheBerlios/freejsm
 /**
  * Method used to grab the Frame which is above this component in the hierarchy. This allows
  * programmers to make any component the parent of any window or dialog easier.
  *
  * @param comp the component to get the Frame for
  * @return the Frame above this component in the hierarchy
  */
 public static java.awt.Frame frameFromComponent(java.awt.Component parent) {
   java.awt.Frame f =
       (java.awt.Frame)
           javax.swing.SwingUtilities.getAncestorOfClass(java.awt.Frame.class, parent);
   return f;
 } // end frameFromComponent