From 071a00a0f8ce9892254630595696c1c9d7c39ec7 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Thu, 3 Nov 2022 19:53:56 +0000 Subject: [PATCH] JAL-3416 File Chooser iconified, JvOptionPanes iconified, other internal frames and dialogs iconified --- resources/images/windowIcons/preferencesIcon.png | Bin 0 -> 5490 bytes src/jalview/gui/AlignFrame.java | 1 + src/jalview/gui/CutAndPasteHtmlTransfer.java | 15 +- src/jalview/gui/CutAndPasteTransfer.java | 35 ++--- src/jalview/gui/EditNameDialog.java | 4 +- src/jalview/gui/Finder.java | 4 +- src/jalview/gui/FontChooser.java | 9 +- src/jalview/gui/JvOptionPane.java | 160 ++++++++++++++++++++-- src/jalview/gui/PCAPanel.java | 35 ++--- src/jalview/gui/PopupMenu.java | 3 +- src/jalview/gui/Preferences.java | 1 + src/jalview/gui/RedundancyPanel.java | 19 +-- src/jalview/gui/SliderPanel.java | 2 + src/jalview/gui/TreePanel.java | 38 ++--- src/jalview/gui/UserDefinedColours.java | 38 ++--- src/jalview/gui/WebserviceInfo.java | 4 +- src/jalview/gui/WindowIcons.java | 8 +- src/jalview/io/JalviewFileChooser.java | 23 +++- 18 files changed, 283 insertions(+), 116 deletions(-) create mode 100644 resources/images/windowIcons/preferencesIcon.png diff --git a/resources/images/windowIcons/preferencesIcon.png b/resources/images/windowIcons/preferencesIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..29ebf391e2a19640ef17298ba849dcf628aee337 GIT binary patch literal 5490 zcmeHKX;>528V(?WD2t+25HvX=Lz30r# zmcRf%Yb!@991dqK;PaMY|8|DMay0fky?X${;mmsUAz|uekQT2{%Egjc6t7NDpm(=SG3F>*B3ddY?RAWyI;Ypp-dwrY(O6odcHS{B4rfJtg_cTZhr~SGqY#TDAjFs+e7`-%_06=!`3PO zE^)e>7QAyVO+Jek;;xpPqKUf_e*JY*uDrzWD|CF`QOc{uN0ubtZohCdSN?dub-*?H z_a?{xbuF!|zc{n+e&>{Qn$23j>&iuyrQOIA<-VBXi9a-UeG~ zV#;s(W=`dMnB%wB?zH618})NiU9&F5w3V|W3HjVKm37dj`aE-Id&rAZ-;@?@r8Upu zr@9NM)yle=8*_qN179>}zVz(ryf)|Cl+>Vv8P(*94yRcsI^oTfLt9+MlQa(*Q6bmz zz_@L`&Ty$mJWrwwq{udKkgziUQ0kLrnz&_xUyrpq9djm!FyB3#(=jWV> zIanGkWH6)o`R)7V2Wkp{Be!=(uQ~Ck^7CoJ-?Q|d%U2(6y0i4)q9u&1#b0iD8e)BY zitQ)#3VSblis-RrvfshcHR(6Fw4zog+qN_@Ye(RuER(CYar3Neva@5VD;o;$EUQbZ z+0iM^3Aodh)0-Ks$(Vr7tJr%Vf6eNUZHtf=Gws5oqs6ZpQvGgy>umD8 z^GPUE((kviotq?c)>JG=YRgC*;h^4TsTP{v)vfMLJak}O zQN347g+C^^)b@nIr+wG^jxDvM~$DBR8 zqvlY`wz3kNl4N|3NpojwUMFGJ8Z&o!2?I!a3E^2C8n04lR&9fXR4TWH{WocLxl)q_Z{coG+Y{@-T5L}u5G_37Z z&C2=9!&ytJXNjP&*iT(*_Mv?@iw12_w1rCLNh0hb#2_y+heh&ibvcOK6PE| z*M1I;$nUmqEUHc(d1l`dv5aL?Ud5`rK(=c%f4Ka@E6@0h*JJF~k1qLlK~=a}ftTP1 z_amL-ubi|F4`(t^+hey)MrVz?xo3?lKlozDXD?~53*4?~$Er*8rx`EeUgPo#i(0J} z3d=7h&Q1KaHfrm`n$HhK1yv`!YLOV&gPy3+mpkD{%lw-B|?Z?gc5a91-577 za2{Sd1q8>SYP<-Il*l-QKTlQ>@DhYWSiumIg$gbjCE@FpXs|vY1lGsEAVTo+wDQog zF#sv5hVVLRtW3q$aR^3SHg;}kCK2$)5OoZP5GD-7bLC1DPbboeWWZM^iKh}gt?(X7 zM9f~sTQmfLU2zCeYPEt*B5Ac+qLxOKDiiR2nJhd{vk@o(oRRS1Re;AN^I6)-(WI!HmH5XmH|lr%g;rS^@- zK!zstml>)M?AAtFhN|QmC5-yUqcZi(;SdP?E?=Qh#v17$FbR!CrC6v68j80}z=(1?Uh90YDK|3{V*~1|1Yp#3&UR1|^WG)Q}8D4Nw?3 zQG(&1?qm?Ai%|d(QDA^hW-yi$AX6#tgF;cI3Ui_X zlR_ra25}8#VPj-4VIhN0F#ux*#)ZvQqL5my43W!YIRwL$@PuM&kyr2A4pr#Mp($8*R&m;K4yuP&_(V5iD=83yy+hktnvlhYa<$UGf*j5`$ud z#y}~6n8ic@Is&l(5t9xAA{NbEBnAp}W2XAcGp+sv`*54K@93GALjdUw+qvISO>fATZ5 zqW;Mt@c55|e2~5$<@zYs2PyDD!5`iAQLYbC;Ddrcy6bO~%j*4WD=NdDWwqE#X^~}i z4E91hTC~KEhZ`__vrm7w8*3S(;ICBSaKxF0!$g+?qnM{5hocZkA zaI>%HYD{WI|Cl|Nb*Bz;$$K!s+c%JMW9-GGT!?zR(92PIKcai`4b~0O{ackQEyu4M pWq(); 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; + } + } -- 1.7.10.2