Esempio n. 1
0
  public void actionPerformed(ActionEvent e) {
    JFrame fileFrame = new JFrame();
    JPanel filePanel = new JPanel();
    JFileChooser fileChooser = new JFileChooser();
    fileFrame.getContentPane().add(filePanel);
    filePanel.add(fileChooser);
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int result = fileChooser.showOpenDialog(filePanel);
    if (result != JFileChooser.APPROVE_OPTION) {
      msg = new JLabel("No file selected");
      panel.add(msg);
      return;
    }

    File datafile = fileChooser.getSelectedFile();
    initialized = readFile(datafile);
    panel.update(panel.getGraphics());
    frame.pack();
    frame.setVisible(true);
  }
 public void showPage(JPanel _p) {
   mainPanel.removeAll();
   mainPanel.add(_p, BorderLayout.CENTER);
   mainPanel.update(mainPanel.getGraphics());
   VEWController2.this.pack();
 }