UIManager.put("TabbedPane.tabWidthMode", "compact");
UIManager.put("TabbedPane.selectedBackground", Color.white);
}
+
+ Desktop.setLiveDragMode(Cache.getDefault("FLAT_LIVE_DRAG_MODE", true));
return set;
}
*/
void init()
{
+ setFrameIcon(WindowIcons.alignmentIcon);
+
// setBackground(Color.white); // BH 2019
if (!Jalview.isHeadlessMode())
.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.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceGroup;
-import jalview.util.MessageManager;
-
import java.awt.BorderLayout;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceGroup;
+import jalview.util.MessageManager;
+
/**
* A panel that allows the user to select which sequence-associated annotation
* rows to show or hide.
private void showFrame()
{
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.annotationIcon);
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
*/
package jalview.gui;
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.GraphLine;
-import jalview.datamodel.SequenceGroup;
-import jalview.gui.JalviewColourChooser.ColourChooserListener;
-import jalview.schemes.AnnotationColourGradient;
-import jalview.schemes.ColourSchemeI;
-import jalview.util.MessageManager;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.SequenceGroup;
+import jalview.gui.JalviewColourChooser.ColourChooserListener;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.schemes.ColourSchemeI;
+import jalview.util.MessageManager;
import net.miginfocom.swing.MigLayout;
@SuppressWarnings("serial")
}
}
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.annotationIcon);
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
package jalview.gui;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.HiddenColumns;
-import jalview.io.cache.JvCacheableInputBox;
-import jalview.schemes.AnnotationColourGradient;
-import jalview.util.MessageManager;
-import jalview.util.Platform;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
-
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import javax.swing.JRadioButton;
import javax.swing.border.TitledBorder;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.HiddenColumns;
+import jalview.io.cache.JvCacheableInputBox;
+import jalview.schemes.AnnotationColourGradient;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
import net.miginfocom.swing.MigLayout;
@SuppressWarnings("serial")
{
super(av, ap);
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.annotationIcon);
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
*/
package jalview.gui;
-import java.util.Locale;
-
-import jalview.api.FeatureRenderer;
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.SequenceI;
-import jalview.io.AnnotationFile;
-import jalview.io.FeaturesFile;
-import jalview.io.JalviewFileChooser;
-import jalview.io.JalviewFileView;
-import jalview.util.MessageManager;
-
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.util.Locale;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;
import javax.swing.SwingConstants;
+import jalview.api.FeatureRenderer;
+import jalview.bin.Cache;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceI;
+import jalview.io.AnnotationFile;
+import jalview.io.FeaturesFile;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.util.MessageManager;
+
/**
*
* GUI dialog for exporting features or alignment annotations depending upon
}
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.annotationIcon);
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Dimension preferredSize = frame.getPreferredSize();
*/
package jalview.gui;
-import jalview.analysis.AlignSeq;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.RnaViewerModel;
-import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.SequenceI;
-import jalview.ext.varna.RnaModel;
-import jalview.structure.SecondaryStructureListener;
-import jalview.structure.SelectionListener;
-import jalview.structure.SelectionSource;
-import jalview.structure.StructureSelectionManager;
-import jalview.structure.VamsasSource;
-import jalview.util.Comparison;
-import jalview.util.MessageManager;
-import jalview.util.ShiftList;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.Collection;
import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
import fr.orsay.lri.varna.models.rna.ModeleBase;
import fr.orsay.lri.varna.models.rna.RNA;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.RnaViewerModel;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.ext.varna.RnaModel;
+import jalview.structure.SecondaryStructureListener;
+import jalview.structure.SelectionListener;
+import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
+import jalview.structure.VamsasSource;
+import jalview.util.Comparison;
+import jalview.util.MessageManager;
+import jalview.util.ShiftList;
public class AppVarna extends JInternalFrame
implements SelectionListener, SecondaryStructureListener,
*/
protected AppVarna(AlignmentPanel ap)
{
+ this.setFrameIcon(null);
this.ap = ap;
this.viewId = System.currentTimeMillis() + "." + this.hashCode();
vab = new AppVarnaBinding();
*/
package jalview.gui;
-import jalview.analysis.TreeBuilder;
-import jalview.analysis.scoremodels.ScoreModels;
-import jalview.analysis.scoremodels.SimilarityParams;
-import jalview.api.analysis.ScoreModelI;
-import jalview.api.analysis.SimilarityParamsI;
-import jalview.bin.Cache;
-import jalview.datamodel.SequenceGroup;
-import jalview.util.MessageManager;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
+import jalview.analysis.TreeBuilder;
+import jalview.analysis.scoremodels.ScoreModels;
+import jalview.analysis.scoremodels.SimilarityParams;
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.SimilarityParamsI;
+import jalview.bin.Cache;
+import jalview.datamodel.SequenceGroup;
+import jalview.util.MessageManager;
+
/**
* A dialog where a user can choose and action Tree or PCA calculation options
*/
{
setLayout(new BorderLayout());
frame = new JInternalFrame();
+ frame.setFrameIcon(WindowIcons.treeIcon);
frame.setContentPane(this);
this.setBackground(Color.white);
frame.addFocusListener(new FocusListener()
*/
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
public static HashMap<String, FileWriter> savingFiles = new HashMap<String, FileWriter>();
+ private static int DRAG_MODE = JDesktopPane.OUTLINE_DRAG_MODE;
+
+ public static void setLiveDragMode(boolean b)
+ {
+ DRAG_MODE = b ? JDesktopPane.LIVE_DRAG_MODE
+ : JDesktopPane.OUTLINE_DRAG_MODE;
+ }
+
private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
public static boolean nosplash = false;
}
getContentPane().add(desktop, BorderLayout.CENTER);
- desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
+ desktop.setDragMode(DRAG_MODE);
// This line prevents Windows Look&Feel resizing all new windows to maximum
// if previous window was maximised
{
frame = new JInternalFrame();
frame.setContentPane(this);
+ frame.setFrameIcon(WindowIcons.featuresIcon);
Rectangle bounds = af.getFeatureSettingsGeometry();
String title;
if (af.getAlignPanels().size() > 1 || Desktop.getAlignmentPanels(
*/
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.JDialog;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
+import javax.swing.event.InternalFrameEvent;
+import javax.swing.event.InternalFrameListener;
import jalview.util.Platform;
import jalview.util.dialogrunner.DialogRunnerI;
{
private static final long serialVersionUID = -3019167117756785229L;
- private static Object mockResponse = JOptionPane.CANCEL_OPTION;
+ private static Object mockResponse = JvOptionPane.CANCEL_OPTION;
private static boolean interactiveMode = true;
}
switch (optionType)
{
- case JOptionPane.YES_NO_CANCEL_OPTION:
+ case JvOptionPane.YES_NO_CANCEL_OPTION:
// FeatureRenderer amendFeatures ?? TODO ??
// Chimera close
// PromptUserConfig
// $FALL-THROUGH$
default:
- case JOptionPane.YES_NO_OPTION:
+ case JvOptionPane.YES_NO_OPTION:
// PromptUserConfig usage stats
// for now treated as "OK CANCEL"
// $FALL-THROUGH$
- case JOptionPane.OK_CANCEL_OPTION:
+ case JvOptionPane.OK_CANCEL_OPTION:
// will fall back to simple HTML
return JOptionPane.showConfirmDialog(parentComponent, message, title,
optionType);
}
switch (optionType)
{
- case JOptionPane.YES_NO_CANCEL_OPTION:
+ case JvOptionPane.YES_NO_CANCEL_OPTION:
// ColourMenuHelper.addMenuItmers.offerRemoval TODO
- case JOptionPane.YES_NO_OPTION:
+ case JvOptionPane.YES_NO_OPTION:
// UserDefinedColoursSave -- relevant? TODO
// $FALL-THROUGH$
default:
- case JOptionPane.OK_CANCEL_OPTION:
+ case JvOptionPane.OK_CANCEL_OPTION:
// EditNameDialog --- uses panel for messsage TODO
}
switch (optionType)
{
- case JOptionPane.YES_NO_CANCEL_OPTION:
- case JOptionPane.YES_NO_OPTION:
+ case JvOptionPane.YES_NO_CANCEL_OPTION:
+ case JvOptionPane.YES_NO_OPTION:
// UserQuestionanaireCheck
// VamsasApplication
// $FALL-THROUGH$
default:
- case JOptionPane.OK_CANCEL_OPTION:
+ case JvOptionPane.OK_CANCEL_OPTION:
// will fall back to simple HTML
return JOptionPane.showConfirmDialog(parentComponent, message, title,
optionType, messageType);
}
switch (optionType)
{
- case JOptionPane.YES_NO_CANCEL_OPTION:
- case JOptionPane.YES_NO_OPTION:
+ case JvOptionPane.YES_NO_CANCEL_OPTION:
+ case JvOptionPane.YES_NO_OPTION:
//$FALL-THROUGH$
default:
- case JOptionPane.OK_CANCEL_OPTION:
+ case JvOptionPane.OK_CANCEL_OPTION:
// Preferences editLink/newLink
return JOptionPane.showConfirmDialog(parentComponent, message, title,
optionType, messageType, icon);
public static void resetMock()
{
- setMockResponse(JOptionPane.CANCEL_OPTION);
+ setMockResponse(JvOptionPane.CANCEL_OPTION);
setInteractiveMode(true);
}
{
switch (messageType)
{
- case JOptionPane.WARNING_MESSAGE:
+ case JvOptionPane.WARNING_MESSAGE:
prefix = "WARNING! ";
break;
- case JOptionPane.ERROR_MESSAGE:
+ case JvOptionPane.ERROR_MESSAGE:
prefix = "ERROR! ";
break;
default:
* attached to the button press of the dialog. This means we can use
* a non-modal JDialog for the confirmation without blocking the GUI.
*/
+ JOptionPane joptionpane = new JOptionPane();
+ // Make button options
+ int[] buttonActions = { JvOptionPane.YES_OPTION,
+ JvOptionPane.NO_OPTION, JvOptionPane.CANCEL_OPTION };
- JDialog dialog = createDialog(parentComponent, message, title,
- optionType, messageType, icon, options, initialValue, modal,
- buttons);
- jalview.bin.Console.debug("About to setVisible(true)");
+ // we need the strings to make the buttons with actionEventListener
+ if (options == null)
+ {
+ ArrayList<String> options_default = new ArrayList<>();
+ options_default
+ .add(UIManager.getString("OptionPane.yesButtonText"));
+ if (optionType == JvOptionPane.YES_NO_OPTION
+ || optionType == JvOptionPane.YES_NO_CANCEL_OPTION)
+ {
+ options_default
+ .add(UIManager.getString("OptionPane.noButtonText"));
+ }
+ if (optionType == JvOptionPane.YES_NO_CANCEL_OPTION)
+ {
+ options_default
+ .add(UIManager.getString("OptionPane.cancelButtonText"));
+ }
+ options = options_default.toArray();
+ }
+
+ ArrayList<JButton> options_btns = new ArrayList<>();
+ Object initialValue_btn = null;
+ if (!Platform.isJS()) // JalviewJS already uses callback, don't need to add them here
+ {
+ for (int i = 0; i < options.length && i < 3; i++)
+ {
+ Object o = options[i];
+ int buttonAction = buttonActions[i];
+ Runnable action = callbacks.get(buttonAction);
+ JButton jb = new JButton();
+ jb.setText((String) o);
+ jb.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ joptionpane.setValue(buttonAction);
+ if (action != null)
+ Executors.defaultThreadFactory().newThread(action).start();
+ // joptionpane.transferFocusBackward();
+ joptionpane.transferFocusBackward();
+ joptionpane.setVisible(false);
+ // put focus and raise parent window if possible, unless cancel
+ // button pressed
+ boolean raiseParent = (parentComponent != null);
+ if (buttonAction == JvOptionPane.CANCEL_OPTION)
+ raiseParent = false;
+ if (optionType == JvOptionPane.YES_NO_OPTION
+ && buttonAction == JvOptionPane.NO_OPTION)
+ raiseParent = false;
+ if (raiseParent)
+ {
+ parentComponent.requestFocus();
+ if (parentComponent instanceof JInternalFrame)
+ {
+ JInternalFrame jif = (JInternalFrame) parentComponent;
+ jif.show();
+ jif.moveToFront();
+ jif.grabFocus();
+ }
+ else if (parentComponent instanceof Window)
+ {
+ Window w = (Window) parentComponent;
+ w.toFront();
+ w.requestFocus();
+ }
+ }
+ joptionpane.setVisible(false);
+ }
+ });
+ options_btns.add(jb);
+ if (o.equals(initialValue))
+ initialValue_btn = jb;
+ }
+ }
+ joptionpane.setMessage(message);
+ joptionpane.setMessageType(messageType);
+ joptionpane.setOptionType(optionType);
+ joptionpane.setIcon(icon);
+ joptionpane.setOptions(
+ Platform.isJS() ? options : options_btns.toArray());
+ joptionpane.setInitialValue(
+ 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);
dialog.setVisible(true);
- jalview.bin.Console.debug("Just setVisible(true)");
}
}
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
return false;
}
+
+ /**
+ * 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();
{
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
frame = new JInternalFrame();
frame.setContentPane(this);
+ frame.setFrameIcon(WindowIcons.fetchIcon);
Desktop.addInternalFrame(frame, getFrameTitle(), true, 400,
Platform.isAMacAndNotJS() ? 240 : 180);
}
{
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);
}
*/
protected void init()
{
+ setFrameIcon(WindowIcons.splitIcon);
getTopFrame().setSplitFrame(this);
getBottomFrame().setSplitFrame(this);
getTopFrame().setVisible(true);
public StructureViewerBase()
{
super();
+ setFrameIcon(WindowIcons.structureIcon);
}
/**
*/
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);
{
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);
--- /dev/null
+package jalview.gui;
+
+import javax.swing.ImageIcon;
+
+import jalview.util.ChannelProperties;
+
+public class WindowIcons
+{
+ public static final ImageIcon logoIcon = new ImageIcon(
+ ChannelProperties.getImage("logo.16"));
+
+ protected static final ImageIcon plainIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/plainIcon.png"));
+
+ protected static final ImageIcon alignmentIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/alignmentIcon.png"));
+
+ protected static final ImageIcon featuresIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/featuresIcon.png"));
+
+ protected static final ImageIcon fetchIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/fetchIcon.png"));
+
+ protected static final ImageIcon annotationIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/annotationIcon.png"));
+
+ protected static final ImageIcon overviewIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/overviewIcon.png"));
+
+ protected static final ImageIcon treeIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/treeIcon.png"));
+
+ protected static final ImageIcon structureIcon = new ImageIcon(
+ WindowIcons.class
+ .getResource("/images/windowIcons/structureIcon.png"));
+
+ 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.JOptionPane;
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;
break;
}
}
+
+ @Override
+ protected JDialog createDialog(Component parent) throws HeadlessException
+ {
+ JDialog dialog = super.createDialog(parent);
+ dialog.setIconImage(WindowIcons.logoIcon.getImage());
+ return dialog;
+ }
+
}