.formatMessage("label.overview_params", new Object[]
{ this.getTitle() }), true, frame.getWidth(), frame.getHeight(),
true, true);
+ frame.setFrameIcon(WindowIcons.overviewIcon);
frame.pack();
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.addInternalFrameListener(
*/
package jalview.gui;
-import jalview.bin.Cache;
-import jalview.io.JalviewFileChooser;
-import jalview.io.JalviewFileView;
-import jalview.jbgui.GCutAndPasteHtmlTransfer;
-import jalview.util.MessageManager;
-import jalview.viewmodel.AlignmentViewport;
-
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.HyperlinkListener;
+import jalview.bin.Cache;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.jbgui.GCutAndPasteHtmlTransfer;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
/**
* Cut'n'paste files into the desktop See JAL-1105
*
public CutAndPasteHtmlTransfer()
{
super();
+ this.setFrameIcon(WindowIcons.logoIcon);
displaySource.setSelected(false);
textarea.addKeyListener(new KeyListener()
{
*/
package jalview.gui;
-import jalview.bin.Cache;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.ComplexAlignFile;
import jalview.api.FeatureSettingsModelI;
import jalview.api.FeaturesDisplayedI;
import jalview.api.FeaturesSourceI;
+import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.schemes.ColourSchemeI;
import jalview.util.MessageManager;
-import java.awt.Toolkit;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
-
/**
* Cut'n'paste files into the desktop See JAL-1105
*
public CutAndPasteTransfer()
{
+ this.setFrameIcon(null);
SwingUtilities.invokeLater(new Runnable()
{
@Override
*/
package jalview.gui;
-import jalview.util.MessageManager;
-
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JPanel;
import javax.swing.JTextField;
+import jalview.util.MessageManager;
+
/**
* A dialog where a name and description may be edited
*/
*/
package jalview.gui;
-import java.util.Locale;
-
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.FocusAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
focusFixed = fixedFocus;
finders = new HashMap<>();
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.logoIcon);
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.addInternalFrameListener(new InternalFrameAdapter()
*/
package jalview.gui;
-import jalview.bin.Cache;
-import jalview.jbgui.GFontChooser;
-import jalview.util.MessageManager;
-
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.geom.Rectangle2D;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
+import jalview.bin.Cache;
+import jalview.jbgui.GFontChooser;
+import jalview.util.MessageManager;
+
/**
* DOCUMENT ME!
*
void init()
{
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.logoIcon);
frame.setContentPane(this);
smoothFont.setSelected(ap.av.antiAlias);
package jalview.gui;
+import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
import java.awt.Component;
+import java.awt.Container;
import java.awt.Dialog.ModalityType;
+import java.awt.EventQueue;
import java.awt.HeadlessException;
+import java.awt.MenuComponent;
+import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseMotionAdapter;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
+import javax.swing.event.InternalFrameEvent;
+import javax.swing.event.InternalFrameListener;
import jalview.util.Platform;
import jalview.util.dialogrunner.DialogRunnerI;
public JvOptionPane(final Component parent)
{
this.parentComponent = Platform.isJS() ? this : parent;
+ this.setIcon(WindowIcons.logoIcon);
}
public static int showConfirmDialog(Component parentComponent,
ArrayList<JButton> options_btns = new ArrayList<>();
Object initialValue_btn = null;
- if (!Platform.isJS()) // JalviewJS already uses callback, don't need to add them here
+ if (!Platform.isJS()) // JalviewJS already uses callback, don't need to
+ // add them here
{
for (int i = 0; i < options.length && i < 3; i++)
{
Platform.isJS() ? initialValue : initialValue_btn);
JDialog dialog = joptionpane.createDialog(parentComponent, title);
+ dialog.setIconImage(WindowIcons.logoIcon.getImage());
dialog.setModalityType(modal ? ModalityType.APPLICATION_MODAL
: ModalityType.MODELESS);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
handleResponse(getMockResponse());
}
+ // need to set these separately so we can set the title bar icon later
+ this.setOptionType(yesNoCancelOption);
+ this.setMessageType(questionMessage);
+ this.setIcon(icon);
+ this.setInitialValue(initresponse);
+ this.setOptions(options);
+ this.setMessage(mainPanel);
+
ourOptions = Arrays.asList(options);
- int response;
if (parentComponent != this)
{
- response = JOptionPane.showInternalOptionDialog(parentComponent,
- mainPanel, title, yesNoCancelOption, questionMessage, icon,
- options, initresponse);
+ JInternalFrame jif = this.createInternalFrame(parentComponent, title);
+ jif.setFrameIcon(WindowIcons.logoIcon);
+ jif.addInternalFrameListener(new InternalFrameListener()
+ {
+ @Override
+ public void internalFrameActivated(InternalFrameEvent arg0)
+ {
+ }
+
+ @Override
+ public void internalFrameClosed(InternalFrameEvent arg0)
+ {
+ JvOptionPane.this.internalDialogHandleResponse();
+ }
+
+ @Override
+ public void internalFrameClosing(InternalFrameEvent arg0)
+ {
+ }
+
+ @Override
+ public void internalFrameDeactivated(InternalFrameEvent arg0)
+ {
+ }
+
+ @Override
+ public void internalFrameDeiconified(InternalFrameEvent arg0)
+ {
+ }
+
+ @Override
+ public void internalFrameIconified(InternalFrameEvent arg0)
+ {
+ }
+
+ @Override
+ public void internalFrameOpened(InternalFrameEvent arg0)
+ {
+ }
+ });
+ jif.setVisible(true);
+ startModal(jif);
+ return;
}
else
{
- response = JOptionPane.showOptionDialog(parentComponent, mainPanel,
- title, yesNoCancelOption, questionMessage, icon, options,
- initresponse);
+ JDialog dialog = this.createDialog(parentComponent, title);
+ dialog.setIconImage(WindowIcons.logoIcon.getImage());
+ dialog.setVisible(true); // blocking
+ this.internalDialogHandleResponse();
+ return;
}
+ }
+
+ private void internalDialogHandleResponse()
+ {
+ String responseString = (String) this.getValue();
+ int response = ourOptions.indexOf(responseString);
+
if (!Platform.isJS())
/**
* Java only
parentComponent.requestFocus();
}
}
+
+ /**
+ * This helper method makes the JInternalFrame wait until it is notified by an
+ * InternalFrameClosing event. This method also adds the given JOptionPane to
+ * the JInternalFrame and sizes it according to the JInternalFrame's preferred
+ * size.
+ *
+ * @param f
+ * The JInternalFrame to make modal.
+ */
+ private static void startModal(JInternalFrame f)
+ {
+ // We need to add an additional glasspane-like component directly
+ // below the frame, which intercepts all mouse events that are not
+ // directed at the frame itself.
+ JPanel modalInterceptor = new JPanel();
+ modalInterceptor.setOpaque(false);
+ JLayeredPane lp = JLayeredPane.getLayeredPaneAbove(f);
+ lp.setLayer(modalInterceptor, JLayeredPane.MODAL_LAYER.intValue());
+ modalInterceptor.setBounds(0, 0, lp.getWidth(), lp.getHeight());
+ modalInterceptor.addMouseListener(new MouseAdapter()
+ {
+ });
+ modalInterceptor.addMouseMotionListener(new MouseMotionAdapter()
+ {
+ });
+ lp.add(modalInterceptor);
+ f.toFront();
+
+ // We need to explicitly dispatch events when we are blocking the event
+ // dispatch thread.
+ EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ try
+ {
+ while (!f.isClosed())
+ {
+ if (EventQueue.isDispatchThread())
+ {
+ // The getNextEventMethod() issues wait() when no
+ // event is available, so we don't need do explicitly wait().
+ AWTEvent ev = queue.getNextEvent();
+ // This mimics EventQueue.dispatchEvent(). We can't use
+ // EventQueue.dispatchEvent() directly, because it is
+ // protected, unfortunately.
+ if (ev instanceof ActiveEvent)
+ ((ActiveEvent) ev).dispatch();
+ else if (ev.getSource() instanceof Component)
+ ((Component) ev.getSource()).dispatchEvent(ev);
+ else if (ev.getSource() instanceof MenuComponent)
+ ((MenuComponent) ev.getSource()).dispatchEvent(ev);
+ // Other events are ignored as per spec in
+ // EventQueue.dispatchEvent
+ }
+ else
+ {
+ // Give other threads a chance to become active.
+ Thread.yield();
+ }
+ }
+ } catch (InterruptedException ex)
+ {
+ // If we get interrupted, then leave the modal state.
+ } finally
+ {
+ // Clean up the modal interceptor.
+ lp.remove(modalInterceptor);
+
+ // Remove the internal frame from its parent, so it is no longer
+ // lurking around and clogging memory.
+ Container parent = f.getParent();
+ if (parent != null)
+ parent.remove(f);
+ }
+ }
}
*/
package jalview.gui;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JMenuItem;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+
import jalview.analysis.scoremodels.ScoreModels;
import jalview.api.AlignViewportI;
import jalview.api.analysis.ScoreModelI;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.PCAModel;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.print.PageFormat;
-import java.awt.print.Printable;
-import java.awt.print.PrinterException;
-import java.awt.print.PrinterJob;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JMenuItem;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-
/**
* The panel holding the Principal Component Analysis 3-D visualisation
*/
SimilarityParamsI params)
{
super();
+ this.setFrameIcon(WindowIcons.treeIcon);
this.av = alignPanel.av;
this.ap = alignPanel;
boolean nucleotide = av.getAlignment().isNucleotide();
*/
package jalview.gui;
-import java.util.Locale;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.SortedMap;
{
super();
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.preferencesIcon);
frame.setContentPane(this);
if (!Platform.isJS())
/**
*/
package jalview.gui;
-import jalview.analysis.AlignSeq;
-import jalview.commands.CommandI;
-import jalview.commands.EditCommand;
-import jalview.commands.EditCommand.Action;
-import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.SequenceI;
-import jalview.jbgui.GSliderPanel;
-import jalview.util.MessageManager;
-
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
+import jalview.analysis.AlignSeq;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.jbgui.GSliderPanel;
+import jalview.util.MessageManager;
+
/**
* DOCUMENT ME!
*
worker.start();
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.logoIcon);
frame.setContentPane(this);
Desktop.addInternalFrame(frame,
MessageManager
{
sliderPanel = new SliderPanel(ap, rs.getConservationInc(), true, rs);
conservationSlider = new JInternalFrame();
+ conservationSlider.setFrameIcon(WindowIcons.logoIcon);
conservationSlider.setContentPane(sliderPanel);
conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
}
{
sliderPanel = new SliderPanel(ap, threshold, false, rs);
PIDSlider = new JInternalFrame();
+ PIDSlider.setFrameIcon(WindowIcons.logoIcon);
PIDSlider.setContentPane(sliderPanel);
PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
}
*/
package jalview.gui;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Locale;
+import javax.swing.ButtonGroup;
+import javax.swing.JMenuItem;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
+
+import org.jibble.epsgraphics.EpsGraphics2D;
+
import jalview.analysis.AlignmentSorter;
import jalview.analysis.AverageDistanceTree;
import jalview.analysis.NJTree;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JMenuItem;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-
-import org.jibble.epsgraphics.EpsGraphics2D;
-
/**
* DOCUMENT ME!
*
SimilarityParamsI options)
{
super();
+ this.setFrameIcon(WindowIcons.treeIcon);
this.similarityParams = options;
initTreePanel(ap, type, modelName, null, null);
*/
package jalview.gui;
-import java.util.Locale;
-
-import jalview.bin.Cache;
-import jalview.io.JalviewFileChooser;
-import jalview.io.JalviewFileView;
-import jalview.jbgui.GUserDefinedColours;
-import jalview.schemes.ColourSchemeI;
-import jalview.schemes.ColourSchemeLoader;
-import jalview.schemes.ColourSchemes;
-import jalview.schemes.ResidueProperties;
-import jalview.schemes.UserColourScheme;
-import jalview.util.ColorUtils;
-import jalview.util.Format;
-import jalview.util.MessageManager;
-import jalview.util.Platform;
-import jalview.xml.binding.jalview.JalviewUserColours;
-import jalview.xml.binding.jalview.JalviewUserColours.Colour;
-import jalview.xml.binding.jalview.ObjectFactory;
-
import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
+import jalview.bin.Cache;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.jbgui.GUserDefinedColours;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ColourSchemeLoader;
+import jalview.schemes.ColourSchemes;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+import jalview.util.ColorUtils;
+import jalview.util.Format;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+import jalview.xml.binding.jalview.JalviewUserColours;
+import jalview.xml.binding.jalview.JalviewUserColours.Colour;
+import jalview.xml.binding.jalview.ObjectFactory;
+
/**
* This panel allows the user to assign colours to Amino Acid residue codes, and
* save the colour scheme.
{
colorChooser.getSelectionModel().addChangeListener(this);
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.logoIcon);
frame.setContentPane(this);
Desktop.addInternalFrame(frame,
MessageManager.getString("label.user_defined_colours"),
*/
package jalview.gui;
-import java.util.Locale;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
+import java.util.Locale;
import java.util.Vector;
import javax.swing.JComponent;
boolean makeVisible)
{
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.logoIcon);
frame.setContentPane(this);
Desktop.addInternalFrame(frame, title, makeVisible, width, height);
frame.setClosable(false);
public class WindowIcons
{
- protected static final ImageIcon logoIcon = new ImageIcon(
- ChannelProperties.getImage("logo.32"));
+ public static final ImageIcon logoIcon = new ImageIcon(
+ ChannelProperties.getImage("logo.16"));
protected static final ImageIcon plainIcon = new ImageIcon(
WindowIcons.class
protected static final ImageIcon splitIcon = new ImageIcon(
WindowIcons.class
.getResource("/images/windowIcons/splitIcon.png"));
+
+ protected static final ImageIcon preferencesIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/preferencesIcon.png"));
}
//////////////////////////////////////////////////////////////////
package jalview.io;
-import jalview.bin.Cache;
-import jalview.gui.JvOptionPane;
-import jalview.util.MessageManager;
-import jalview.util.Platform;
-import jalview.util.dialogrunner.DialogRunnerI;
-
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import javax.swing.BoxLayout;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JCheckBox;
+import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import javax.swing.plaf.basic.BasicFileChooserUI;
+import jalview.bin.Cache;
+import jalview.gui.JvOptionPane;
+import jalview.gui.WindowIcons;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+import jalview.util.dialogrunner.DialogRunnerI;
+
/**
* Enhanced file chooser dialog box.
*
break;
}
}
+
+ @Override
+ protected JDialog createDialog(Component parent) throws HeadlessException
+ {
+ JDialog dialog = super.createDialog(parent);
+ dialog.setIconImage(WindowIcons.logoIcon.getImage());
+ return dialog;
+ }
+
}