示例#1
0
  /** @return the contents of the window as a Component */
  private Component makeContents() {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    _label = new JLabel("Photo popup");
    mainPanel.add(_label, BorderLayout.NORTH);
    _photoThumb = new PhotoThumbnail(false); // specify not in details panel
    _photoThumb.setPreferredSize(new Dimension(300, 300));
    mainPanel.add(_photoThumb, BorderLayout.CENTER);
    // Close button at bottom
    JPanel okPanel = new JPanel();
    okPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    JButton okButton = new JButton(I18nManager.getText("button.ok"));
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            _frame.dispose();
          }
        });
    okButton.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
              _frame.dispose();
            }
          }

          public void keyTyped(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {}
        });
    okPanel.add(okButton);
    mainPanel.add(okPanel, BorderLayout.SOUTH);
    return mainPanel;
  }
示例#2
0
 /** Initialise the frame to show the current photo */
 private void initFrame() {
   _frame.setVisible(false);
   Photo photo = _app.getTrackInfo().getCurrentPhoto();
   _frame.setTitle(photo.getName());
   _label.setText(
       "'" + photo.getName() + "' (" + photo.getWidth() + " x " + photo.getHeight() + ")");
   _photoThumb.setPhoto(photo);
 }