示例#1
0
  /**
   * @param filenames
   * @exception Exception if internal error
   */
  public ChestImageViewer(String filenames[]) throws Exception {
    DisplayDeviceArea[] displayDeviceAreas = getPresentationAndImageDeviceAreas();
    if (displayDeviceAreas == null) {
      System.err.println("Cannot determine device display areas");
    } else {
      System.err.println("Found " + displayDeviceAreas.length + " device display areas");
      for (int i = 0; i < displayDeviceAreas.length; ++i) {
        System.err.println("[" + i + "] = " + displayDeviceAreas[i]);
        displayDeviceAreas[i].getFrame().setBackground(Color.black);
        displayDeviceAreas[i].getFrame().setVisible(true);
      }

      {
        // Need to actually add something to the unused left display frame, else background will not
        // be set to black on Windows
        JPanel backgroundPanel = new JPanel();
        backgroundPanel.setBackground(Color.black);
        displayDeviceAreas[0].getFrame().getContentPane().add(backgroundPanel);
        displayDeviceAreas[0].getFrame().validate();
      }

      frame = displayDeviceAreas[1].getFrame();

      Container content = frame.getContentPane();
      content.setLayout(new GridLayout(1, 1));
      multiPanel = new JPanel();
      // multiPanel.setBackground(Color.black);
      frameWidth = (int) frame.getWidth();
      frameHeight = (int) frame.getHeight();
      Dimension d = new Dimension(frameWidth, frameHeight);
      // multiPanel.setSize(d);
      multiPanel.setPreferredSize(d);
      multiPanel.setBackground(Color.black);
      content.add(multiPanel);
      // frame.pack();
      content.validate();

      loadMultiPanelFromSpecifiedFiles(filenames);
    }
  }
示例#2
0
 public MemoryMonitor() {
   setLayout(new BorderLayout());
   setBorder(new TitledBorder(new EtchedBorder(), "Memory Monitor"));
   add(surf = new Surface());
   controls = new JPanel();
   controls.setPreferredSize(new Dimension(135, 80));
   Font font = new Font("serif", Font.PLAIN, 10);
   JLabel label = new JLabel("Sample Rate");
   label.setFont(font);
   label.setForeground(BLACK);
   controls.add(label);
   tf = new JTextField("1000");
   tf.setPreferredSize(new Dimension(45, 20));
   controls.add(tf);
   controls.add(label = new JLabel("ms"));
   label.setFont(font);
   label.setForeground(BLACK);
   controls.add(dateStampCB);
   dateStampCB.setFont(font);
   addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           removeAll();
           if ((doControls = !doControls)) {
             surf.stop();
             add(controls);
           } else {
             try {
               surf.sleepAmount = Long.parseLong(tf.getText().trim());
             } catch (Exception ex) {
             }
             surf.start();
             add(surf);
           }
           revalidate();
           repaint();
         }
       });
 }