public static void main(String[] args) {
   JFrame f = new JFrame();
   f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   f.add(new GraphingData());
   f.setSize(515, 310);
   f.setLocation(0, 420);
   f.setVisible(true);
 }
Ejemplo n.º 2
0
 public static void main(String[] args) {
   JFrame frame = new JFrame();
   frame.setSize(800, 600);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   GamePanel game = new GamePanel();
   frame.add(game);
   frame.setVisible(true);
 }
Ejemplo n.º 3
0
 public static void main(String[] args) {
   JFrame f = new JFrame();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   f.getContentPane().add(new ArrowPanel());
   f.setSize(500, 400);
   f.setLocation(200, 200);
   f.setVisible(true);
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
0
 public static void main(String[] args) {
   Plot2D test = new Plot2D();
   JFrame f = new JFrame();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   f.add(test.getContent());
   f.add(test.getUIPanel(), "Last");
   f.setSize(400, 400);
   f.setLocation(50, 50);
   f.setVisible(true);
 }
Ejemplo n.º 6
0
  public static void main(String[] args) {
    frame.setLayout(new FlowLayout());

    final JPanel sceneHolder = new JPanel();
    initialize(sceneHolder);
    frame.add(sceneHolder);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(700, 700);
    frame.setVisible(true);
  }
Ejemplo n.º 7
0
  // Test routine.
  public static void main(String[] args) {
    // Create a button with the label "Jackpot".
    JButton button = new RoundButton("Jackpot");
    button.setBackground(Color.green);

    // Create a frame in which to show the button.
    JFrame frame = new JFrame();
    frame.getContentPane().setBackground(Color.yellow);
    frame.getContentPane().add(button);
    frame.getContentPane().setLayout(new FlowLayout());
    frame.setSize(150, 150);
    frame.setVisible(true);
  }
 public static void main(String s[]) {
   if (s.length > 0) j2kfilename = s[0];
   else j2kfilename = "girl";
   System.out.println(j2kfilename);
   isApplet = false;
   JFrame f = new JFrame("ImageViewer");
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   JApplet applet = new ImageViewer();
   f.getContentPane().add("Center", applet);
   applet.init();
   f.pack();
   f.setSize(new Dimension(550, 550));
   f.show();
 }
Ejemplo n.º 9
0
  public static void main(String[] args) {
    int a = ROW * PREFERRED_GRID_SIZE_PIXELS;
    int b = ROW * PREFERRED_GRID_SIZE_PIXELS;
    BuildArray();
    SquareGrid test = new SquareGrid();
    JFrame f = new JFrame();
    f.setTitle("ObjectVis");

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.add(test);
    // setPreferredSize(new Dimension(80, 50));
    f.setSize(a, 800);
    // f.setSize(f.MAXIMIZED_HORIZ, f.MAXIMIZED_VERT);
    Dimension d = f.getMaximumSize();
    // int m=f.MAXIMIZED_BOTH;
    // f.setMaximumSize(d);
    // f.setLocation(100,100);
    f.setVisible(true);
    f.setJMenuBar(test.addMenu());
    test.addComponentListener(test.cl);
    f.setJMenuBar(test.addMenu());
  }
Ejemplo n.º 10
0
  static void buildGUI() {
    // Need this size to balance axes.
    frame.setSize(520, 690);
    frame.setTitle("DrawTool");
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    Container cPane = frame.getContentPane();

    // Status label on top. Unused for now.
    statusLabel.setOpaque(true);
    statusLabel.setBackground(Color.white);
    cPane.add(statusLabel, BorderLayout.NORTH);

    // Build the input/output elements at the bottom.
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createLineBorder(Color.black));
    panel.setBackground(inputPanelColor);
    panel.setLayout(new GridLayout(2, 1));
    panel.add(outputLabel);
    JPanel bottomPanel = new JPanel();
    bottomPanel.setBackground(inputPanelColor);
    bottomPanel.add(inputField);
    bottomPanel.add(new JLabel("   "));
    JButton enterButton = new JButton("Enter");
    enterButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent a) {
            hasEntered = true;
          }
        });
    bottomPanel.add(enterButton);
    panel.add(bottomPanel);
    if (!sequencingOn) {
      cPane.add(panel, BorderLayout.SOUTH);
    }

    // Drawing in the center.
    drawArea = new DrawTool();
    if (sequencingOn) {
      frame.addKeyListener(
          new KeyAdapter() {
            public void keyTyped(KeyEvent e) {
              handleKeyTyped(e);
            }
          });
    }
    cPane.add(drawArea, BorderLayout.CENTER);

    drawArea.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            handleMouseClick(e);
          }

          public void mouseReleased(MouseEvent e) {
            handleMouseReleased(e);
          }
        });

    drawArea.addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseDragged(MouseEvent e) {
            handleMouseDragged(e);
          }
        });
  }
 public static void main(String args[]) {
   JFrame win = new JFrame();
   win.setSize(400, 400);
   win.add(new MyCanvs());
   win.setVisible(true);
 }
Ejemplo n.º 12
0
  ////////////// methods to create the interactive visualizer ////////////////////////
  private void createMainFrame() {
    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    Container contentPane = mainFrame.getContentPane();
    // contentPane.setLayout(new BorderLayout());

    // creates the control panel
    controlPanel = new JPanel(null);
    controlPanel.setLayout(new FlowLayout());
    makeSoundVis();
    mainFrame.addComponentListener(new ResizeHandler());

    // setting up the play sound button
    playBtn = new JButton("Play");
    playBtn.setEnabled(true);
    playBtn.setToolTipText("Play the  sound");
    playBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            stopBtn.setEnabled(true);
            pauseBtn.setEnabled(true);
            playBtn.setEnabled(false);
            playSelectionBtn.setEnabled(false);
            zoomInBtn.setEnabled(false);
            zoomOutBtn.setEnabled(false);
            isPlaying = true;
            myHelper.play();
          }
        });
    controlPanel.add(playBtn);

    // setting up the play selection button
    playSelectionBtn = new JButton("Play Selection");
    playSelectionBtn.setEnabled(false);
    playSelectionBtn.setToolTipText("Play sound between start and stop index");
    playSelectionBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            playSelClicked++;
            stopBtn.setEnabled(true);
            pauseBtn.setEnabled(true);
            playSelectionBtn.setEnabled(false);
            playBtn.setEnabled(false);
            zoomInBtn.setEnabled(false);
            zoomOutBtn.setEnabled(false);
            isPlaying = false;
            if (playSelClicked == 1) {
              myHelper.playInRange(
                  wavePanel.getSelectionStartSample(), wavePanel.getSelectionEndSample());
            } else {
              myHelper.play();
            }
          }
        });
    controlPanel.add(playSelectionBtn);

    // setting up the stop button
    stopBtn = new JButton("Stop");
    stopBtn.setEnabled(false);
    stopBtn.setToolTipText("Stop playing the sound");
    stopBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            myHelper.stop();
            stopBtn.setEnabled(false);
            pauseBtn.setEnabled(false);
            playBtn.setEnabled(true);
            if (wavePanel.moreZoomInScope()) {
              zoomInBtn.setEnabled(true);
              playSelectionBtn.setEnabled(true);
            }

            if (wavePanel.moreZoomOutScope()) {
              zoomOutBtn.setEnabled(true);
            }
            playSelClicked = 0;
            isPlaying = false;
          }
        });
    controlPanel.add(stopBtn);

    // setting up the stop button
    pauseBtn = new JButton("Pause");
    pauseBtn.setEnabled(false);
    pauseBtn.setToolTipText("Pause the sound");
    pauseBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            myHelper.pause();
            if (isPlaying) {
              playBtn.setEnabled(true);
            } else {
              playSelectionBtn.setEnabled(true);
            }
          }
        });
    controlPanel.add(pauseBtn);

    // setting up the zoom  button
    zoomInBtn = new JButton("Zoom In");
    zoomInBtn.setEnabled(false);
    zoomInBtn.setToolTipText("Click to see the samples within your selection");
    zoomInBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            handleZoomIn();
          }
        });
    controlPanel.add(zoomInBtn);

    // setting up the zoom  button
    zoomOutBtn = new JButton("Zoom Out");
    zoomOutBtn.setEnabled(false);
    zoomOutBtn.setToolTipText("Click to zoom out");
    zoomOutBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            handleZoomOut();
          }
        });
    controlPanel.add(zoomOutBtn);

    controlPanel.setBounds(0, controlLocY, frameWidth, controlHeight);
    contentPane.add(controlPanel);

    contentPane.add(wavePanel);
    contentPane.add(overViewPanel);
    wavePanel.setBounds(0, waveLocY, frameWidth, waveHeight);

    // controlPanel.removeAll();
    // controlPanel.setBackground(Color.CYAN);

    mainFrame.setSize(frameWidth, frameHeight);

    overViewPanel.init();
    wavePanel.init();
    //
    // mainFrame.pack();
    // mainFrame.setResizable(false);
    // mainFrame.validate();

    mainFrame.setVisible(true);
    overViewPanel.setBounds(0, 0, frameWidth, overViewHeight);

    // mainFrame.validate();

  }
Ejemplo n.º 13
0
  public LJ3MDApp() {
    tNum.setHorizontalAlignment(JTextField.CENTER);
    tTemp.setHorizontalAlignment(JTextField.CENTER);
    tRho.setHorizontalAlignment(JTextField.CENTER);
    tSpeed.setHorizontalAlignment(JTextField.CENTER);

    tAvK.setHorizontalAlignment(JTextField.RIGHT);
    tAvU.setHorizontalAlignment(JTextField.RIGHT);
    tAvp.setHorizontalAlignment(JTextField.RIGHT);

    float[] aveKing = new float[501];
    float[] avePot = new float[501];
    float[] aveEn = new float[501];

    JFrame box = new JFrame();
    box.setLayout(new BorderLayout());
    box.setSize(1000, 1000);
    box.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    cpnl = new JPanel(); // create a panel for controls
    cpnl.setLayout(new GridLayout(18, 2));
    box.add(cpnl, BorderLayout.EAST);

    // add controls
    cpnl.add(bStart);
    bStart.addActionListener(this);

    cpnl.add(bReset);
    bReset.addActionListener(this);

    cpnl.add(new JLabel(" N:"));
    tNum.addActionListener(this);
    cpnl.add(tNum);

    cpnl.add(new JLabel(" Density (\u03c1):"));
    tRho.addActionListener(this);
    cpnl.add(tRho);

    cpnl.add(new JLabel(" Steps/frame:"));
    tSpeed.addActionListener(this);
    cpnl.add(tSpeed);

    cpnl.add(bTstat);
    bTstat.addActionListener(this);

    cpnl.add(bPot);
    bPot.addActionListener(this);

    cpnl.add(new JLabel(" < K/N > :"));
    tAvK.setEditable(false);
    cpnl.add(tAvK);

    cpnl.add(new JLabel(" Temperature:"));
    tTemp.setEditable(false);
    cpnl.add(tTemp);

    cpnl.add(new JLabel(" < U/N > :"));
    tAvU.setEditable(false);
    cpnl.add(tAvU);

    cpnl.add(new JLabel(" < pressure > :"));
    tAvp.setEditable(false);
    cpnl.add(tAvp);

    cpnl.add(bRetime);
    bRetime.addActionListener(this);

    spnl = new JPanel(); // create a panel for status
    box.add(spnl, BorderLayout.SOUTH);
    lStatus.setFont(new Font("Courier", 0, 12));
    spnl.add(lStatus);

    canvas = new XYZCanvas();
    box.add(canvas, BorderLayout.CENTER);

    timer = new Timer(delay, this);
    timer.start();
    //        timer.stop();
    box.setVisible(true);
  }