public void init(Controller c) {
    super.init(c);

    // Make the Display2D.  We'll have it display stuff later.
    display = new Display2D(500, 500, this, 1); // at 400x400, we've got 4x4 per array position
    displayFrame = display.createFrame();
    c.registerFrame(displayFrame); // register the frame so it appears in the "Display" list
    displayFrame.setVisible(true);

    // attach the portrayals from bottom to top
    display.attach(foodPortrayal, "Food");
    display.attach(agentPortrayal, "Agents");
    displayFrame.setTitle("Agents");
    // specify the backdrop color  -- what gets painted behind the displays
    display.setBackdrop(Color.yellow);
    // Make the Display2D.  We'll have it display stuff later.
    display2 = new Display2D(400, 400, this, 1); // at 400x400, we've got 4x4 per array position
    displayFrame2 = display2.createFrame();
    displayFrame2.setTitle("Statistic");
    c.registerFrame(displayFrame2); // register the frame so it appears in the "Display" list
    displayFrame2.setVisible(false);
    // specify the backdrop color  -- what gets painted behind the displays
    display2.setBackdrop(Color.GRAY);
    // attach the portrayals from bottom to top
    display2.attach(summaryPortrayal, "Summary");
  }
Ejemplo n.º 2
0
  /**
   * Load a file of a particular type. It's a pretty standard helper function, which uses DarwinCSV
   * and setCurrentCSV(...) to make file loading happen with messaging and whatnot. We can also
   * reset the display: just call loadFile(null).
   *
   * @param file The file to load.
   * @param type The type of file (see DarwinCSV's constants).
   */
  private void loadFile(File file, short type) {
    // If the file was reset, reset the display and keep going.
    if (file == null) {
      mainFrame.setTitle(basicTitle);
      setCurrentCSV(null);
      return;
    }

    // Load up a new DarwinCSV and set current CSV.
    try {
      setCurrentCSV(new DarwinCSV(file, type));

    } catch (IOException ex) {
      MessageBox.messageBox(
          mainFrame,
          "Could not read file '" + file + "'",
          "Unable to read file '" + file + "': " + ex);
    }

    // Set the main frame title, based on the filename and the index.
    mainFrame.setTitle(
        basicTitle
            + ": "
            + file.getName()
            + " ("
            + String.format("%,d", currentCSV.getRowIndex().getRowCount())
            + " rows)");
  }
Ejemplo n.º 3
0
 /**
  * Set Frame's title
  *
  * @param title : frame's title
  */
 void setTitle(String title) {
   String tmp = "";
   if (noChannel) {
     mainFrame.setTitle("JWhiteBoard");
     return;
   }
   if (title != null) {
     mainFrame.setTitle(title);
   } else {
     if (channel.getAddress() != null) tmp += channel.getAddress();
     tmp += " (" + memberSize + ")";
     mainFrame.setTitle(tmp);
   }
 }
  void printButton_actionPerformed(ActionEvent e) {
    DetailSaleDocVO vo = (DetailSaleDocVO) headerFormPanel.getVOModel().getValueObject();

    HashMap params = new HashMap();
    params.put("COMPANY_CODE", vo.getCompanyCodeSys01DOC01());
    params.put("DOC_TYPE", vo.getDocTypeDOC01());
    params.put("DOC_YEAR", vo.getDocYearDOC01());
    params.put("DOC_NUMBER", vo.getDocNumberDOC01());

    HashMap map = new HashMap();
    map.put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01DOC01());
    map.put(ApplicationConsts.FUNCTION_CODE_SYS06, headerFormPanel.getFunctionId());
    map.put(ApplicationConsts.EXPORT_PARAMS, params);
    Response res = ClientUtils.getData("getJasperReport", map);
    if (!res.isError()) {
      JasperPrint print = (JasperPrint) ((VOResponse) res).getVo();
      JRViewer viewer = new JRViewer(print);
      JFrame frame = new JFrame();
      frame.setSize(MDIFrame.getInstance().getSize());
      frame.setContentPane(viewer);
      frame.setTitle(this.getTitle());
      frame.setIconImage(MDIFrame.getInstance().getIconImage());
      frame.setVisible(true);
    } else
      JOptionPane.showMessageDialog(
          ClientUtils.getParentFrame(this),
          res.getErrorMessage(),
          ClientSettings.getInstance().getResources().getResource("print document"),
          JOptionPane.ERROR_MESSAGE);
  }
Ejemplo n.º 5
0
  public void run() {

    long lastTime = System.nanoTime();
    long timer = System.currentTimeMillis();
    final double ns = 1000000000.0 / 60.0;
    double delta = 0;
    int frames = 0;
    int updates = 0;
    //		setFocusable(true);
    requestFocus();

    while (running) {
      long now = System.nanoTime();
      delta += (now - lastTime) / ns;
      lastTime = now;
      while (delta >= 1) {
        update();
        updates++;
        delta--;
      }
      // Renderiza tudo na tela
      render();
      // Calcula FPS
      frames++;

      if ((System.currentTimeMillis() - timer) > 1000) {
        timer += 1000;
        // T�tulo do jogo
        frame.setTitle(title + "  |  " + updates + " ups / " + frames + " fps ");
        updates = 0;
        frames = 0;
      }
    }
    stop();
  }
  // -------------------------------------------------------------------
  public static void main(String[] args) {
    // Create the window
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(new Dimension(300, 100));
    frame.setTitle("A frame");
    frame.setLayout(new FlowLayout()); // This will be discuss in the next lesson

    // Create and add the first button
    JButton button1 = new JButton();
    button1.setText("I'm a button.");
    button1.setBackground(Color.BLUE);
    frame.add(button1);

    // Create and add the second button
    JButton button2 = new JButton();
    button2.setText("Click me!");
    button2.setBackground(Color.RED);
    frame.add(button2);

    // Reset the sizes of the buttons and window
    frame.pack();

    // Actually put the window on the screen and draw all its components
    frame.setVisible(true);
  }
Ejemplo n.º 7
0
 public static void main(String[] args) {
   Example4 ef = new Example4();
   try {
     final String molS = "C1C2=CC=CC=C2C3=C4CC5=CC=CC=C5C4=C6CC7=CC=CC=C7C6=C13";
     Molecule mol = MolImporter.importMol(molS);
     PolarizabilityPlugin plugin = new PolarizabilityPlugin();
     plugin.setMolecule(mol);
     plugin.run();
     ArrayList values = new ArrayList();
     java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
     nf.setMaximumFractionDigits(3);
     for (int i = 0; i < mol.getAtomCount(); i++) {
       values.add(Float.valueOf(nf.format(((Double) plugin.getResult(i)).floatValue())));
     }
     mol.hydrogenize(true);
     for (int i = 0; i < mol.getExplicitHcount(); i++) {
       values.add(new Double(0));
     }
     ef.setPlugin(plugin);
     JFrame frame = ef.createSpaceFrame(mol, values);
     frame.setTitle("Polarizability");
     java.net.URL u = ef.getClass().getResource("/chemaxon/marvin/space/gui/mspace16.gif");
     frame.setIconImage(
         Toolkit.getDefaultToolkit().createImage((java.awt.image.ImageProducer) u.getContent()));
     frame.setVisible(true);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 8
0
  public TabSpawnable spawn() {
    JFrame f = new JFrame();
    f.getContentPane().setLayout(new BorderLayout());
    f.setTitle(_title);
    TabSpawnable newPanel = (TabSpawnable) clone();
    if (newPanel == null) return null; // failed to clone
    newPanel.setTitle(_title);
    if (newPanel instanceof TabToDoTarget) {
      TabToDoTarget me = (TabToDoTarget) this;
      TabToDoTarget it = (TabToDoTarget) newPanel;
      it.setTarget(me.getTarget());
    } else if (newPanel instanceof TabModelTarget) {
      TabModelTarget me = (TabModelTarget) this;
      TabModelTarget it = (TabModelTarget) newPanel;
      it.setTarget(me.getTarget());
    }
    f.getContentPane().add(newPanel, BorderLayout.CENTER);
    Rectangle bounds = getBounds();
    bounds.height += OVERLAPP * 2;
    f.setBounds(bounds);

    Point loc = new Point(0, 0);
    SwingUtilities.convertPointToScreen(loc, this);
    loc.y -= OVERLAPP;
    f.setLocation(loc);
    f.setVisible(true);

    if (_tear && (getParent() instanceof JTabbedPane)) ((JTabbedPane) getParent()).remove(this);

    return newPanel;
  }
Ejemplo n.º 9
0
  /** The entry main() method */
  public static void main(String[] args) {
    // Create the OpenGL rendering canvas
    GLCanvas canvas = new GLCanvas(); // heavy-weight GLCanvas
    canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));
    canvas.addGLEventListener(new JOGL2Nehe11Flag());

    // Create a animator that drives canvas' display() at the specified FPS.
    final FPSAnimator animator = new FPSAnimator(canvas, FPS, true);

    // Create the top-level container frame
    final JFrame frame = new JFrame(); // Swing's JFrame or AWT's Frame
    frame.getContentPane().add(canvas);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            // Use a dedicate thread to run the stop() to ensure that the
            // animator stops before program exits.
            new Thread() {
              @Override
              public void run() {
                animator.stop(); // stop the animator loop
                System.exit(0);
              }
            }.start();
          }
        });
    frame.setTitle(TITLE);
    frame.pack();
    frame.setVisible(true);
    animator.start(); // start the animation loop
  }
Ejemplo n.º 10
0
 public static void main(String args[]) {
   JFrame frame = new CopyFileToTable();
   frame.setTitle("CopyFileToTable");
   frame.setSize(700, 200);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Ejemplo n.º 11
0
 public static void main(String[] args) {
   JFrame frame = new TestImageIcon();
   frame.setTitle("Test ImageIcon");
   frame.setSize(500, 300);
   frame.setLocationRelativeTo(null);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setVisible(true);
 }
Ejemplo n.º 12
0
 /** Main method */
 public static void main(String[] args) {
   JFrame frame = new SimpleEventDemo2();
   frame.setTitle("SimpleEventDemo2");
   frame.setLocationRelativeTo(null); // Center the frame
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(100, 80);
   frame.setVisible(true);
 }
Ejemplo n.º 13
0
 public static void main(String[] args) {
   JFrame frame = new Exercise15_6();
   frame.setSize(300, 300);
   frame.setTitle("Exercise15_6");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLocationRelativeTo(null); // Center the frame
   frame.setVisible(true);
 }
Ejemplo n.º 14
0
 public static void main(String args[]) {
   JFrame frame = new Vb0303_Extra();
   frame.setSize(400, 200);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Voorbeeld 0303");
   frame.setContentPane(new Paneel());
   frame.setVisible(true);
 }
Ejemplo n.º 15
0
  public void gui() {
    jf.pack();
    jf.setTitle("Bingon ylläpito");
    jf.setVisible(true);
    jf.setSize(500, 300);
    //   	/* j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);*/

  }
Ejemplo n.º 16
0
 /**
  * Create a Canvas.
  *
  * @param title title to appear in Canvas Frame
  * @param width the desired width for the canvas
  * @param height the desired height for the canvas
  * @param bgClour the desired background colour of the canvas
  */
 private Canvas(String title, int width, int height, Color bgColour) {
   frame = new JFrame();
   canvas = new CanvasPane();
   frame.setContentPane(canvas);
   frame.setTitle(title);
   canvas.setPreferredSize(new Dimension(width, height));
   backgroundColour = bgColour;
   frame.pack();
 }
Ejemplo n.º 17
0
  public static void main(String[] args) {
    JFrame world = new JFrame();
    world.setTitle("S_GAME(alpha)");
    world.setSize(800, 600);

    world.add(new Env(Color.lightGray), BorderLayout.CENTER);
    world.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    world.setVisible(true);
  }
Ejemplo n.º 18
0
 public static void main(String[] args) {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(600, 500);
   frame.setTitle("Breakout");
   frame.setResizable(false);
   frame.add(new GamePanel());
   frame.setVisible(true);
 }
 /** Method to create and initialize the picture frame */
 private void createAndInitPictureFrame() {
   pictureFrame = new JFrame(); // create the JFrame
   pictureFrame.setResizable(true); // allow the user to resize it
   pictureFrame.getContentPane().setLayout(new BorderLayout()); // use border layout
   pictureFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // when close stop
   pictureFrame.setTitle(picture.getTitle());
   PictureExplorerFocusTraversalPolicy newPolicy = new PictureExplorerFocusTraversalPolicy();
   pictureFrame.setFocusTraversalPolicy(newPolicy);
 }
Ejemplo n.º 20
0
 private void updateTitleBar() {
   String title = "Infinispan GUI Demo";
   if (cache != null && cache.getStatus() == ComponentStatus.RUNNING) {
     title += " (STARTED) " + getLocalAddress() + " Cluster size: " + getClusterSize();
   } else {
     title += " (STOPPED)";
   }
   frame.setTitle(title);
 }
Ejemplo n.º 21
0
  private synchronized void display(ExtSed sed) {

    manageAssociatedManagerWindows(sed);

    try {

      SpectrumContainer container =
          (SpectrumContainer) sed.getAttachment(IrisDisplayManager.FIT_MODEL);

      // There is no Sed attachment, so build a model manager and attach it.

      if (container == null) {
        if (buildAttachment(sed)) {
          return;
        }
      }

      // VAOPD-879: spectrum name must be identical with Sed name.
      if (container != null) {
        container.getSpectrum().setName(sed.getId());
      }

      // Now display the Sed.

      idm.display(sed, sed.getId());

      // and add its frame to the workspace.

      JInternalFrame frame = idm.getInternalFrame();

      // VAOPD-863
      frame.setTitle(sed.getId());

      if (container != null) {
        JFrame modelManagerFrame = container.getModelManager().getFrame();
        if (modelManagerFrame != null) {
          modelManagerFrame.setTitle(sed.getId());
        }
      }

      if (frame != currentFrame) {
        lastLocation = null;
        disposeCurrentFrame();
        currentFrame = frame;
        currentFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
        if (lastLocation != null) {
          currentFrame.setLocation(lastLocation);
        }
        frame.setTitle("Iris Visualizer");
        ws.addFrame(frame);
      }

    } catch (Exception ex) {
      LogEvent.getInstance().fire(this, new LogEntry("Error: " + ex.getMessage(), sed));
      Logger.getLogger("IrisVisualizer").log(Level.SEVERE, null, ex);
    }
  }
Ejemplo n.º 22
0
 public static void main(String[] argumentenRij) {
   JFrame frame = new Vb1300_Loop_Gaat_Niet();
   frame.setSize(800, 600);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Vb1300_Loop_Gaat_Niet");
   // naam aanpassen als je Paneel van naam wijzigt !!!
   Paneel paneel = new Paneel();
   frame.setContentPane(paneel);
   frame.setVisible(true);
 }
Ejemplo n.º 23
0
 private void run() {
   JFrame window = new JFrame();
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   window.setTitle("Analog Clock");
   ClockAnalogBuf contentPane = new ClockAnalogBuf();
   window.setContentPane(contentPane);
   window.pack(); // Layout components
   window.setLocationRelativeTo(null); // Center window.
   window.setVisible(true);
 }
Ejemplo n.º 24
0
 public static void main(String s[]) {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Homework 10");
   JApplet applet = new Homework10();
   applet.init();
   frame.getContentPane().add(applet);
   frame.pack();
   frame.setVisible(true);
 }
 public static void main(String[] args) {
   ClockWithAudioOnSeparateThread applet = new ClockWithAudioOnSeparateThread();
   applet.init();
   applet.start();
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("ClockWithAudioOnSeparateThread");
   frame.getContentPane().add(applet, BorderLayout.CENTER);
   frame.setSize(400, 320);
   frame.setVisible(true);
 }
Ejemplo n.º 26
0
 /**
  * Set the title of the window to the given title
  *
  * @param title The window title
  */
 public void setWindowTitle(String title) {
   if (!windowOk()) {
     return;
   }
   if (dialog != null) {
     dialog.setTitle(title);
   }
   if (frame != null) {
     frame.setTitle(title);
   }
 }
 public static void main(String[] argumentenRij) {
   JFrame frame = new Vb0800_Algoritmen_Allerlei();
   frame.setSize(275, 700);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Vb0800_Algoritmen_Allerlei");
   // naam aanpassen als je Paneel van naam wijzigt !!!
   Paneel paneel = new Paneel();
   frame.setContentPane(paneel);
   frame.setAlwaysOnTop(true);
   frame.setVisible(true);
 }
Ejemplo n.º 28
0
 /**
  * Create a Canvas.
  *
  * @param title title to appear in Canvas Frame
  * @param width the desired width for the canvas
  * @param height the desired height for the canvas
  * @param bgClour the desired background colour of the canvas
  */
 private Canvas(String title, int width, int height, Color bgColour) {
   frame = new JFrame();
   canvas = new CanvasPane();
   frame.setContentPane(canvas);
   frame.setTitle(title);
   canvas.setPreferredSize(new Dimension(width, height));
   backgroundColour = bgColour;
   frame.pack();
   objects = new ArrayList<Object>();
   shapes = new HashMap<Object, ShapeDescription>();
 }
Ejemplo n.º 29
0
 public static void BuildMainWindow() {
   mainWindow.setTitle("Chat");
   mainWindow.setSize(450, 500);
   mainWindow.setLocation(220, 180);
   mainWindow.setResizable(false);
   ConfigureMainWindow();
   MainWindow_Action();
   sendAction();
   disconnectAction();
   mainWindow.setVisible(true);
   mainWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 }
Ejemplo n.º 30
0
 @Override
 public void setTitle(final String title) {
   String t = Configuration.NAME + " v" + Configuration.getVersionFormatted();
   final int v = Configuration.getVersion(), l = UpdateChecker.getLatestVersion();
   if (v > l) {
     t += " beta";
   }
   if (title != null) {
     t = title + " - " + t;
   }
   super.setTitle(t);
 }