From: Ben Soares Date: Thu, 3 Nov 2022 19:53:56 +0000 (+0000) Subject: JAL-3416 File Chooser iconified, JvOptionPanes iconified, other internal frames and... X-Git-Tag: Release_2_11_3_0~23^2~4^2~9^2~3 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=071a00a0f8ce9892254630595696c1c9d7c39ec7 JAL-3416 File Chooser iconified, JvOptionPanes iconified, other internal frames and dialogs iconified --- diff --git a/resources/images/windowIcons/preferencesIcon.png b/resources/images/windowIcons/preferencesIcon.png new file mode 100644 index 0000000..29ebf39 Binary files /dev/null and b/resources/images/windowIcons/preferencesIcon.png differ diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index d54bd14..abc7437 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3445,6 +3445,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .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( diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index 6e0032f..5c94d54 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -20,13 +20,6 @@ */ 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; @@ -44,6 +37,13 @@ import javax.swing.event.HyperlinkEvent; 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 * @@ -58,6 +58,7 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer public CutAndPasteHtmlTransfer() { super(); + this.setFrameIcon(WindowIcons.logoIcon); displaySource.setSelected(false); textarea.addKeyListener(new KeyListener() { diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 112d502..bc3c0d2 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -20,13 +20,29 @@ */ 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; @@ -45,22 +61,6 @@ import jalview.json.binding.biojson.v1.ColourSchemeMapper; 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 * @@ -78,6 +78,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer public CutAndPasteTransfer() { + this.setFrameIcon(null); SwingUtilities.invokeLater(new Runnable() { @Override diff --git a/src/jalview/gui/EditNameDialog.java b/src/jalview/gui/EditNameDialog.java index 52791c8..f7225f5 100644 --- a/src/jalview/gui/EditNameDialog.java +++ b/src/jalview/gui/EditNameDialog.java @@ -20,8 +20,6 @@ */ package jalview.gui; -import jalview.util.MessageManager; - import java.awt.FlowLayout; import java.awt.Font; @@ -32,6 +30,8 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import jalview.util.MessageManager; + /** * A dialog where a name and description may be edited */ diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 358d9a4..ee70565 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -20,8 +20,6 @@ */ package jalview.gui; -import java.util.Locale; - import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.FocusAdapter; @@ -30,6 +28,7 @@ import java.awt.event.KeyEvent; 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; @@ -109,6 +108,7 @@ public class Finder extends GFinder focusFixed = fixedFocus; finders = new HashMap<>(); frame = new JInternalFrame(); + frame.setFrameIcon(WindowIcons.logoIcon); frame.setContentPane(this); frame.setLayer(JLayeredPane.PALETTE_LAYER); frame.addInternalFrameListener(new InternalFrameAdapter() diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 92cc4c6..2e8e667 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -20,10 +20,6 @@ */ 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; @@ -31,6 +27,10 @@ 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! * @@ -112,6 +112,7 @@ public class FontChooser extends GFontChooser void init() { frame = new JInternalFrame(); + frame.setFrameIcon(WindowIcons.logoIcon); frame.setContentPane(this); smoothFont.setSelected(ap.av.antiAlias); diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index 028e50b..0b684d0 100644 --- a/src/jalview/gui/JvOptionPane.java +++ b/src/jalview/gui/JvOptionPane.java @@ -21,12 +21,20 @@ 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; @@ -40,9 +48,12 @@ import javax.swing.Icon; 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; @@ -69,6 +80,7 @@ public class JvOptionPane extends JOptionPane public JvOptionPane(final Component parent) { this.parentComponent = Platform.isJS() ? this : parent; + this.setIcon(WindowIcons.logoIcon); } public static int showConfirmDialog(Component parentComponent, @@ -849,7 +861,8 @@ public class JvOptionPane extends JOptionPane ArrayList 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++) { @@ -912,6 +925,7 @@ public class JvOptionPane extends JOptionPane 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); @@ -928,20 +942,76 @@ public class JvOptionPane extends JOptionPane 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 @@ -1000,4 +1070,78 @@ public class JvOptionPane extends JOptionPane 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); + } + } } diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index e6b6b83..63ce5ad 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -20,6 +20,23 @@ */ 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; @@ -39,23 +56,6 @@ import jalview.util.MessageManager; 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 */ @@ -92,6 +92,7 @@ public class PCAPanel extends GPCAPanel SimilarityParamsI params) { super(); + this.setFrameIcon(WindowIcons.treeIcon); this.av = alignPanel.av; this.ap = alignPanel; boolean nucleotide = av.getAlignment().isNucleotide(); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 6903034..f4a19ff 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -20,8 +20,6 @@ */ package jalview.gui; -import java.util.Locale; - import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; @@ -34,6 +32,7 @@ import java.util.Collections; 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; diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 06d3a60..987051f 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -249,6 +249,7 @@ public class Preferences extends GPreferences { super(); frame = new JInternalFrame(); + frame.setFrameIcon(WindowIcons.preferencesIcon); frame.setContentPane(this); if (!Platform.isJS()) /** diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 6ed3248..7a50758 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -20,15 +20,6 @@ */ 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; @@ -42,6 +33,15 @@ import javax.swing.event.ChangeListener; 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! * @@ -100,6 +100,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable worker.start(); frame = new JInternalFrame(); + frame.setFrameIcon(WindowIcons.logoIcon); frame.setContentPane(this); Desktop.addInternalFrame(frame, MessageManager diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 5e1357a..6665588 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -156,6 +156,7 @@ public class SliderPanel extends GSliderPanel { sliderPanel = new SliderPanel(ap, rs.getConservationInc(), true, rs); conservationSlider = new JInternalFrame(); + conservationSlider.setFrameIcon(WindowIcons.logoIcon); conservationSlider.setContentPane(sliderPanel); conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER); } @@ -269,6 +270,7 @@ public class SliderPanel extends GSliderPanel { sliderPanel = new SliderPanel(ap, threshold, false, rs); PIDSlider = new JInternalFrame(); + PIDSlider.setFrameIcon(WindowIcons.logoIcon); PIDSlider.setContentPane(sliderPanel); PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER); } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index d735402..2d446d9 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -20,8 +20,26 @@ */ 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; @@ -53,25 +71,6 @@ import jalview.util.ImageMaker.TYPE; 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! * @@ -106,6 +105,7 @@ public class TreePanel extends GTreePanel SimilarityParamsI options) { super(); + this.setFrameIcon(WindowIcons.treeIcon); this.similarityParams = options; initTreePanel(ap, type, modelName, null, null); diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 1836e33..1a7ae4a 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -20,25 +20,6 @@ */ 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; @@ -50,6 +31,7 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import javax.swing.JButton; import javax.swing.JInternalFrame; @@ -58,6 +40,23 @@ import javax.swing.event.ChangeListener; 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. @@ -149,6 +148,7 @@ public class UserDefinedColours extends GUserDefinedColours { colorChooser.getSelectionModel().addChangeListener(this); frame = new JInternalFrame(); + frame.setFrameIcon(WindowIcons.logoIcon); frame.setContentPane(this); Desktop.addInternalFrame(frame, MessageManager.getString("label.user_defined_colours"), diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index ee1b473..edcab0c 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -20,8 +20,6 @@ */ package jalview.gui; -import java.util.Locale; - import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -33,6 +31,7 @@ import java.awt.MediaTracker; 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; @@ -324,6 +323,7 @@ public class WebserviceInfo extends GWebserviceInfo boolean makeVisible) { frame = new JInternalFrame(); + frame.setFrameIcon(WindowIcons.logoIcon); frame.setContentPane(this); Desktop.addInternalFrame(frame, title, makeVisible, width, height); frame.setClosable(false); diff --git a/src/jalview/gui/WindowIcons.java b/src/jalview/gui/WindowIcons.java index 0e74785..b735667 100644 --- a/src/jalview/gui/WindowIcons.java +++ b/src/jalview/gui/WindowIcons.java @@ -6,8 +6,8 @@ import jalview.util.ChannelProperties; 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 @@ -44,4 +44,8 @@ public class WindowIcons 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")); } diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index a9101a1..8cd5406 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -21,12 +21,6 @@ ////////////////////////////////////////////////////////////////// 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; @@ -48,6 +42,7 @@ import java.util.Vector; 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; @@ -56,6 +51,13 @@ import javax.swing.SpringLayout; 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. * @@ -641,4 +643,13 @@ public class JalviewFileChooser extends JFileChooser break; } } + + @Override + protected JDialog createDialog(Component parent) throws HeadlessException + { + JDialog dialog = super.createDialog(parent); + dialog.setIconImage(WindowIcons.logoIcon.getImage()); + return dialog; + } + }