import java.awt.Canvas;
import java.awt.CheckboxMenuItem;
import java.awt.Color;
+import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Frame;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
+import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.util.StringTokenizer;
import java.util.Vector;
-import javax.swing.JOptionPane;
-
import org.jmol.viewer.Viewer;
public class AlignFrame extends EmbmenuFrame implements ActionListener,
/*
* If the cut affects all sequences, warn, remove highlighted columns
- */if (sg.getSize() == viewport.getAlignment().getHeight())
+ */
+ if (sg.getSize() == viewport.getAlignment().getHeight())
{
boolean isEntireAlignWidth = (((sg.getEndRes() - sg.getStartRes()) + 1) == viewport
.getAlignment().getWidth()) ? true : false;
if (isEntireAlignWidth)
{
- int confirm = JOptionPane.showConfirmDialog(this,
- MessageManager.getString("warn.delete_all"), // $NON-NLS-1$
- MessageManager.getString("label.delete_all"), // $NON-NLS-1$
- JOptionPane.OK_CANCEL_OPTION);
- if (confirm == JOptionPane.CANCEL_OPTION
- || confirm == JOptionPane.CLOSED_OPTION)
+ String title = MessageManager.getString("label.delete_all");
+ Panel mp = new Panel();
+ mp.setLayout(new FlowLayout());
+ mp.add(new Label(MessageManager.getString("warn.delete_all")));
+
+ final JVDialog dialog = new JVDialog(this, title, true, 400,
+ 200);
+ dialog.setMainPanel(mp);
+ dialog.setVisible(true);
+
+ if (!dialog.accept)
{
return;
}
import java.util.Iterator;
import java.util.Vector;
-import javax.swing.JPanel;
+//import javax.swing.JPanel;
//import net.miginfocom.swing.MigLayout;
actionPanel.add(ok);
actionPanel.add(cancel);
- JPanel staticPanel = new JPanel();
+ Panel staticPanel = new Panel();
staticPanel.setLayout(new BorderLayout());
staticPanel.setBackground(Color.white);
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
public class JVDialog extends Dialog implements ActionListener
{
width, height);
}
+ public JVDialog(Frame owner, Panel mainPanel, String title,
+ boolean modal, int width, int height)
+ {
+ super(owner, title, modal);
+ this.owner = owner;
+
+ height += owner.getInsets().top + getInsets().bottom;
+
+ setBounds(owner.getBounds().x + (owner.getSize().width - width) / 2,
+ owner.getBounds().y + (owner.getSize().height - height) / 2,
+ width, height);
+ setMainPanel(mainPanel);
+ }
+
void setMainPanel(Panel panel)
{
add(panel, BorderLayout.NORTH);
buttonPanel.add(cancel);
ok.addActionListener(this);
cancel.addActionListener(this);
-
add(buttonPanel, BorderLayout.SOUTH);
+ addWindowListener(new WindowAdapter()
+ {
+ public void windowClosing(WindowEvent ev)
+ {
+ setVisible(false);
+ dispose();
+ }
+ });
+
pack();
}
}
setVisible(false);
+ dispose();
}
}