2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
\r
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3
\r
10 * of the License, or (at your option) any later version.
\r
12 * Jalview is distributed in the hope that it will be useful, but
\r
13 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
15 * PURPOSE. See the GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
\r
21 package jalview.appletgui;
\r
23 import java.awt.BorderLayout;
\r
24 import java.awt.FlowLayout;
\r
25 import java.awt.event.ActionEvent;
\r
26 import java.awt.event.ActionListener;
\r
28 import javax.swing.JButton;
\r
29 import javax.swing.JDialog;
\r
30 import javax.swing.JFrame;
\r
31 import javax.swing.JPanel;
\r
33 public class JVDialog extends JDialog implements ActionListener
\r
39 JButton ok = new JButton("Accept");
\r
41 JButton cancel = new JButton("Cancel");
\r
43 boolean accept = false;
\r
47 public JVDialog(JFrame owner, String title, boolean modal, int width,
\r
50 super(owner, title, modal);
\r
53 height += owner.getInsets().top + getInsets().bottom;
\r
55 setBounds(owner.getBounds().x + (owner.getSize().width - width) / 2,
\r
56 owner.getBounds().y + (owner.getSize().height - height) / 2,
\r
60 void setMainPanel(JPanel panel)
\r
62 add(panel, BorderLayout.NORTH);
\r
64 buttonPanel = new JPanel(new FlowLayout());
\r
66 buttonPanel.add(ok);
\r
67 buttonPanel.add(cancel);
\r
68 ok.addActionListener(this);
\r
69 cancel.addActionListener(this);
\r
71 add(buttonPanel, BorderLayout.SOUTH);
\r
77 public void actionPerformed(ActionEvent evt)
\r
79 if (evt.getSource() == ok)
\r