示例#1
0
  private static void show() {
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
    try {

    } catch (Exception e) {
      // TODO: handle exception
      System.out.println(e.getMessage());
    }
  }
 /** This method sets up the window and displays it. */
 private void setupFrame() {
   JFrame window = new JFrame("Dungeon of Dooom");
   window.setIconImage(Toolkit.getDefaultToolkit().getImage("graphics/icon.png"));
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   populateFrame(window.getContentPane());
   window.pack();
   window.setLocationByPlatform(true);
   window.setVisible(true);
   Dimension windowSize = new Dimension(608, 606);
   window.setSize(windowSize);
   window.setResizable(false);
 }
  private static void createAndShowGui() {
    List<Integer> scores = new ArrayList<Integer>();
    Random random = new Random();
    int maxDataPoints = 16;
    int maxScore = 20;
    for (int i = 0; i < maxDataPoints; i++) {
      scores.add(random.nextInt(maxScore));
    }
    DrawGraph mainPanel = new DrawGraph(scores);

    JFrame frame = new JFrame("DrawGraph");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(mainPanel);
    frame.pack();
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
  }
 private static void show() {
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.pack();
   frame.setLocationByPlatform(true);
   frame.setVisible(true);
 }