import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
{
private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
- protected JInternalFrame mainFrame = new JInternalFrame(
+ protected ClassicJInternalFrame mainFrame = new ClassicJInternalFrame(
getFTSFrameTitle());
protected JTabbedPane tabs = new JTabbedPane();
return cmb_searchTarget;
}
- public JInternalFrame getMainFrame()
+ public ClassicJInternalFrame getMainFrame()
{
return mainFrame;
}
*/
package jalview.gui;
-import java.util.Locale;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
+import java.util.Locale;
import java.util.Vector;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
-import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import jalview.io.ScoreMatrixFile;
import jalview.io.TCoffeeScoreFile;
import jalview.io.vcf.VCFLoader;
+import jalview.jbgui.ClassicJInternalFrame;
import jalview.jbgui.GAlignFrame;
import jalview.project.Jalview2XML;
import jalview.schemes.ColourSchemeI;
// file is reloaded.
if (FileFormat.Jalview.equals(currentFileFormat))
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = (ClassicJInternalFrame[]) Desktop.desktop
+ .getAllFrames();
for (int i = 0; i < frames.length; i++)
{
if (frames[i] instanceof AlignFrame && frames[i] != this
pane = editPane;
}
- JInternalFrame frame = new JInternalFrame();
+ ClassicJInternalFrame frame = new ClassicJInternalFrame();
frame.getContentPane().add(new JScrollPane(pane));
return;
}
- JInternalFrame frame = new JInternalFrame();
+ ClassicJInternalFrame frame = new ClassicJInternalFrame();
final OverviewPanel overview = new OverviewPanel(alignPanel);
frame.setContentPane(overview);
Desktop.addInternalFrame(frame, MessageManager
}
else
{
- JInternalFrame frame = new JInternalFrame();
+ ClassicJInternalFrame frame = new ClassicJInternalFrame();
frame.setContentPane(new PairwiseAlignPanel(viewport));
Desktop.addInternalFrame(frame,
MessageManager.getString("action.pairwise_alignment"), 600,
import java.util.Hashtable;
import java.util.List;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
/**
* DOCUMENT ME!
/*
* Open in split pane. DNA sequence above, protein below.
*/
- JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
+ ClassicJInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);
Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
return proteinFrame.viewport.getAlignment();
import java.util.Map;
import javax.swing.JButton;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
private static final int MY_FRAME_HEIGHT = 250;
- private JInternalFrame frame;
+ private ClassicJInternalFrame frame;
private AlignmentPanel ap;
*/
private void showFrame()
{
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
}
}
}
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap)
{
super(av, ap);
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
*/
public class AnnotationExporter extends JPanel
{
- private JInternalFrame frame;
+ private ClassicJInternalFrame frame;
private AlignmentPanel ap;
ex.printStackTrace();
}
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Dimension preferredSize = frame.getPreferredSize();
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
protected JTextField thresholdValue = new JTextField(20);
- protected JInternalFrame frame;
+ protected ClassicJInternalFrame frame;
protected JButton ok = new JButton();
import java.util.List;
import java.util.Map;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JSplitPane;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import fr.orsay.lri.varna.models.rna.ModeleBase;
import fr.orsay.lri.varna.models.rna.RNA;
-public class AppVarna extends JInternalFrame
+public class AppVarna extends ClassicJInternalFrame
implements SelectionListener, SecondaryStructureListener,
InterfaceVARNASelectionListener, VamsasSource
{
import javax.swing.DesktopManager;
import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
+
/**
* Based on AquaInternalFrameManager
*
/* The frame which is currently selected/activated.
* We store this value to enforce Mac's single-selection model.
*/
- JInternalFrame fCurrentFrame;
+ ClassicJInternalFrame fCurrentFrame;
- JInternalFrame fInitialFrame;
+ ClassicJInternalFrame fInitialFrame;
/* The list of frames, sorted by order of creation.
* This list is necessary because by default the order of
* We preserve the creation order so that "next" and "previous"
* frame actions make sense.
*/
- Vector<JInternalFrame> fChildFrames = new Vector<>(1);
+ Vector<ClassicJInternalFrame> fChildFrames = new Vector<>(1);
/**
* keep a reference to the original LAF manager so we can iconise/de-iconise
@Override
public void deiconifyFrame(final JInternalFrame f)
{
- JInternalFrame.JDesktopIcon desktopIcon;
+ ClassicJInternalFrame.JDesktopIcon desktopIcon;
desktopIcon = f.getDesktopIcon();
// If the icon moved, move the frame to that spot before expanding it
}
void addIcon(final Container c,
- final JInternalFrame.JDesktopIcon desktopIcon)
+ final ClassicJInternalFrame.JDesktopIcon desktopIcon)
{
c.add(desktopIcon);
}
{
fChildFrames.remove(f);
}
- fChildFrames.addElement(f);
+ fChildFrames.addElement((ClassicJInternalFrame) f);
if (fCurrentFrame != null && f != fCurrentFrame)
{
f.setSelected(true);
}
- fCurrentFrame = f;
+ fCurrentFrame = (ClassicJInternalFrame) f;
} catch (final PropertyVetoException e)
{
}
nextIndex = count - 1;
}
}
- final JInternalFrame f = fChildFrames.elementAt(nextIndex);
+ final ClassicJInternalFrame f = fChildFrames.elementAt(nextIndex);
activateFrame(f);
fCurrentFrame = f;
}
/**
- * Activate the next child JInternalFrame, as determined by the frames'
+ * Activate the next child ClassicJInternalFrame, as determined by the frames'
* Z-order. If there is only one child frame, it remains activated. If there
* are no child frames, nothing happens.
*/
/**
* same as above but will activate a frame if none have been selected
*/
- public void activateNextFrame(final JInternalFrame f)
+ public void activateNextFrame(final ClassicJInternalFrame f)
{
fInitialFrame = f;
switchFrame(true);
}
/**
- * Activate the previous child JInternalFrame, as determined by the frames'
- * Z-order. If there is only one child frame, it remains activated. If there
- * are no child frames, nothing happens.
+ * Activate the previous child ClassicJInternalFrame, as determined by the
+ * frames' Z-order. If there is only one child frame, it remains activated. If
+ * there are no child frames, nothing happens.
*/
public void activatePreviousFrame()
{
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
JButton calculate;
- private JInternalFrame frame;
+ private ClassicJInternalFrame frame;
private JCheckBox includeGaps;
void init()
{
setLayout(new BorderLayout());
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
this.setBackground(Color.white);
frame.addFocusListener(new FocusListener()
import java.util.List;
import java.util.Map;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.event.InternalFrameAdapter;
* closeViewer will decide whether or not to close this frame
* depending on whether user chooses to Cancel or not
*/
- setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
+ setDefaultCloseOperation(ClassicJInternalFrame.DO_NOTHING_ON_CLOSE);
}
/**
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.jbgui.ClassicJInternalFrame;
import jalview.jbgui.GSplitFrame;
import jalview.jbgui.GStructureViewer;
import jalview.project.Jalview2XML;
// sp.getViewport().setView(desktop);
// getContentPane().add(sp, BorderLayout.CENTER);
- // BH 2018 - just an experiment to try unclipped JInternalFrames.
+ // BH 2018 - just an experiment to try unclipped ClassicJInternalFrames.
if (Platform.isJS())
{
getRootPane().putClientProperty("swingjs.overflow.hidden", "false");
* height
*/
public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, int w, int h)
+ final ClassicJInternalFrame frame, String title, int w, int h)
{
addInternalFrame(frame, title, true, w, h, true, false);
}
* height
*/
public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, boolean makeVisible,
- int w, int h)
+ final ClassicJInternalFrame frame, String title,
+ boolean makeVisible, int w, int h)
{
addInternalFrame(frame, title, makeVisible, w, h, true, false);
}
* Allow resize
*/
public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, int w, int h,
+ final ClassicJInternalFrame frame, String title, int w, int h,
boolean resizable)
{
addInternalFrame(frame, title, true, w, h, resizable, false);
* Do not set the default minimum size for frame
*/
public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, boolean makeVisible,
- int w, int h, boolean resizable, boolean ignoreMinSize)
+ final ClassicJInternalFrame frame, String title,
+ boolean makeVisible, int w, int h, boolean resizable,
+ boolean ignoreMinSize)
{
// TODO: allow callers to determine X and Y position of frame (eg. via
@Override
public void internalFrameActivated(InternalFrameEvent evt)
{
- JInternalFrame itf = desktop.getSelectedFrame();
+ ClassicJInternalFrame itf = desktop.getSelectedFrame();
if (itf != null)
{
if (itf instanceof AlignFrame)
}
/**
- * Add key bindings to a JInternalFrame so that Ctrl-W and Cmd-W will close
- * the window
+ * Add key bindings to a ClassicJInternalFrame so that Ctrl-W and Cmd-W will
+ * close the window
*
* @param frame
*/
- private static void setKeyBindings(JInternalFrame frame)
+ private static void setKeyBindings(ClassicJInternalFrame frame)
{
@SuppressWarnings("serial")
final Action closeAction = new AbstractAction()
public void closeAll_actionPerformed(ActionEvent e)
{
// TODO show a progress bar while closing?
- JInternalFrame[] frames = desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++)
{
try
void reorderAssociatedWindows(boolean minimize, boolean close)
{
- JInternalFrame[] frames = desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = desktop.getAllFrames();
if (frames == null || frames.length < 1)
{
return;
{
source.viewport.setGatherViewsHere(true);
source.viewport.setExplodedGeometry(source.getBounds());
- JInternalFrame[] frames = desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = desktop.getAllFrames();
String viewId = source.viewport.getSequenceSetId();
for (int t = 0; t < frames.length; t++)
{
}
- public JInternalFrame[] getAllFrames()
+ public ClassicJInternalFrame[] getAllFrames()
{
return desktop.getAllFrames();
}
// output debug scale message. Important for jalview.bin.HiDPISettingTest2
Desktop.debugScaleMessage(Desktop.getDesktop().getGraphics());
}
+
+ public ClassicJInternalFrame getSelectedFrame()
+ {
+ return (ClassicJInternalFrame) super.getSelectedFrame();
+ }
+
+ public ClassicJInternalFrame[] getAllFrames()
+ {
+ return (ClassicJInternalFrame[]) super.getAllFrames();
+ }
}
/**
return new AlignFrame[] { Jalview.currentAlignFrame };
}
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
if (frames == null)
{
*/
public GStructureViewer[] getJmols()
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
if (frames == null)
{
topPanel.av.setGatherViewsHere(false);
bottomPanel.av.setGatherViewsHere(false);
- JInternalFrame splitFrame = new SplitFrame(newTopFrame,
+ ClassicJInternalFrame splitFrame = new SplitFrame(newTopFrame,
newBottomFrame);
if (geometry != null)
{
String topViewId = myTopFrame.viewport.getSequenceSetId();
String bottomViewId = myBottomFrame.viewport.getSequenceSetId();
- JInternalFrame[] frames = desktop.getAllFrames();
- for (JInternalFrame frame : frames)
+ ClassicJInternalFrame[] frames = (ClassicJInternalFrame[]) desktop
+ .getAllFrames();
+ for (ClassicJInternalFrame frame : frames)
{
if (frame instanceof SplitFrame && frame != source)
{
Class<? extends StructureViewerBase> structureViewerClass)
{
List<StructureViewerBase> result = new ArrayList<>();
- JInternalFrame[] frames = Desktop.instance.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.instance.getAllFrames();
- for (JInternalFrame frame : frames)
+ for (ClassicJInternalFrame frame : frames)
{
if (frame instanceof StructureViewerBase)
{
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JMenuItem;
private Map<String, FeatureMatcherSetI> originalFilters;
- final JInternalFrame frame;
+ final ClassicJInternalFrame frame;
JScrollPane scrollPane = new JScrollPane();
}
else
{
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
Rectangle bounds = af.getFeatureSettingsGeometry();
String title;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.KeyStroke;
import javax.swing.event.InternalFrameAdapter;
private AlignmentPanel ap;
- private JInternalFrame frame;
+ private ClassicJInternalFrame frame;
/*
* Finder agent per viewport searched
ap = alignPanel;
focusFixed = fixedFocus;
finders = new HashMap<>();
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.addInternalFrameListener(new InternalFrameAdapter()
}
// now checks further down the window stack to fix bug
// https://mantis.lifesci.dundee.ac.uk/view.php?id=36008
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
for (int f = 0; f < frames.length; f++)
{
- JInternalFrame alignFrame = frames[f];
+ ClassicJInternalFrame alignFrame = frames[f];
if (alignFrame != null && alignFrame instanceof AlignFrame
&& !alignFrame.isIcon())
{
import java.awt.FontMetrics;
import java.awt.geom.Rectangle2D;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLayeredPane;
/**
boolean init = true;
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
/*
* The last font settings selected in the dialog
void init()
{
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
smoothFont.setSelected(ap.av.antiAlias);
import java.beans.PropertyVetoException;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
* close the parent frame (which also removes it from the
* Desktop Windows menu)
*/
- ((JInternalFrame) SwingUtilities
- .getAncestorOfClass(JInternalFrame.class, (this)))
+ ((ClassicJInternalFrame) SwingUtilities
+ .getAncestorOfClass(ClassicJInternalFrame.class, (this)))
.setClosed(true);
} catch (PropertyVetoException e)
{
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
protected void showFeatureDetails(SequenceFeature sf, String seqName,
MappedFeatures mf)
{
- JInternalFrame details;
+ ClassicJInternalFrame details;
if (Platform.isJS())
{
- details = new JInternalFrame();
+ details = new ClassicJInternalFrame();
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(true);
panel.setBackground(Color.white);
contents.append("</body></html>");
String report = contents.toString();
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
if (Platform.isJS())
{
JLabel textLabel = new JLabel();
pane.setOpaque(true);
pane.setBackground(Color.WHITE);
pane.add(textLabel, BorderLayout.NORTH);
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.getContentPane().add(new JScrollPane(pane));
}
else
import javax.help.HelpSetException;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JPanel;
import javax.swing.ListSelectionModel;
import javax.swing.RowFilter;
groupURLLinks = new ArrayList<>();
}
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
private WsPreferences wsPrefs;
private Preferences()
{
super();
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
if (!Platform.isJS())
/**
import java.util.List;
import java.util.Map;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JMenuItem;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
* closeViewer will decide whether or not to close this frame
* depending on whether user chooses to Cancel or not
*/
- setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
+ setDefaultCloseOperation(ClassicJInternalFrame.DO_NOTHING_ON_CLOSE);
}
public PymolViewer(PDBEntry pdb, SequenceI[] seqs, Object object,
import java.util.Stack;
import java.util.Vector;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JProgressBar;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
SequenceI[] originalSequences;
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
Vector redundantSeqs;
Thread worker = new Thread(this);
worker.start();
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
Desktop.addInternalFrame(frame,
MessageManager
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
JTextArea textArea;
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
IProgressIndicator guiWindow;
jbInit(selectedDb);
textArea.setText(queryString);
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
Desktop.addInternalFrame(frame, getFrameTitle(), true, 400,
Platform.isAMacAndNotJS() ? 240 : 180);
import java.beans.PropertyVetoException;
import java.util.List;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
{
private static final String BACKGROUND = "Background";
- static JInternalFrame conservationSlider;
+ static ClassicJInternalFrame conservationSlider;
- static JInternalFrame PIDSlider;
+ static ClassicJInternalFrame PIDSlider;
AlignmentPanel ap;
if (conservationSlider == null)
{
sliderPanel = new SliderPanel(ap, rs.getConservationInc(), true, rs);
- conservationSlider = new JInternalFrame();
+ conservationSlider = new ClassicJInternalFrame();
conservationSlider.setContentPane(sliderPanel);
conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
}
if (PIDSlider == null)
{
sliderPanel = new SliderPanel(ap, threshold, false, rs);
- PIDSlider = new JInternalFrame();
+ PIDSlider = new ClassicJInternalFrame();
PIDSlider.setContentPane(sliderPanel);
PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
}
*
* @return
*/
- public static JInternalFrame showPIDSlider()
+ public static ClassicJInternalFrame showPIDSlider()
{
hideConservationSlider();
return getValue(conservationSlider);
}
- static int getValue(JInternalFrame slider)
+ static int getValue(ClassicJInternalFrame slider)
{
return slider == null ? 0
: ((SliderPanel) slider.getContentPane()).getValue();
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
*/
private Component splashText;
- private JInternalFrame iframe;
+ private ClassicJInternalFrame iframe;
private Image image;
this.setForeground(fg);
this.setFont(font);
- iframe = new JInternalFrame();
+ iframe = new ClassicJInternalFrame();
iframe.setFrameIcon(null);
iframe.setClosable(true);
this.setLayout(new BorderLayout());
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
-import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import jalview.api.SplitContainerI;
import jalview.controller.FeatureSettingsControllerGuiI;
import jalview.datamodel.AlignmentI;
+import jalview.jbgui.ClassicJInternalFrame;
import jalview.jbgui.GAlignFrame;
import jalview.jbgui.GSplitFrame;
import jalview.structure.StructureSelectionManager;
public void setSelected(boolean selected) throws PropertyVetoException
{
JDesktopPane desktopPane = getDesktopPane();
- JInternalFrame fr = desktopPane == null ? null
- : desktopPane.getSelectedFrame();
+ ClassicJInternalFrame fr = desktopPane == null ? null
+ : (ClassicJInternalFrame) desktopPane.getSelectedFrame();
if (fr == getTopFrame() || fr == getBottomFrame())
{
/*
* holds the frame for feature settings, so Protein and DNA tabs can be
* managed
*/
- JInternalFrame featureSettingsUI;
+ ClassicJInternalFrame featureSettingsUI;
JTabbedPane featureSettingsPanels;
getAlignFrames().get(tab).showFeatureSettingsUI();
}
});
- featureSettingsUI = new JInternalFrame(MessageManager.getString(
- "label.sequence_feature_settings_for_CDS_and_Protein"));
+ featureSettingsUI = new ClassicJInternalFrame(
+ MessageManager.getString(
+ "label.sequence_feature_settings_for_CDS_and_Protein"));
featureSettingsPanels.setOpaque(true);
JPanel dialog = new JPanel();
import java.util.List;
import javax.swing.JButton;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.xml.bind.JAXBContext;
*/
boolean changedButNotSaved;
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
List<JButton> upperCaseButtons;
void showFrame()
{
colorChooser.getSelectionModel().addChangeListener(this);
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
Desktop.addInternalFrame(frame,
MessageManager.getString("label.user_defined_colours"),
import java.util.IdentityHashMap;
import java.util.Iterator;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import uk.ac.vamsas.client.ClientHandle;
import uk.ac.vamsas.client.IClient;
*/
protected void updateJalviewGui()
{
- JInternalFrame[] frames = jdesktop.getAllFrames();
+ ClassicJInternalFrame[] frames = jdesktop.getAllFrames();
if (frames == null)
{
VamsasAppDatastore vds = new VamsasAppDatastore(doc, vobj2jv, jv2vobj,
baseProvEntry(), alRedoState);
// wander through frames
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
if (frames == null)
{
import javax.swing.JComponent;
import javax.swing.JEditorPane;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
boolean serviceIsCancellable;
- JInternalFrame frame;
+ ClassicJInternalFrame frame;
private IProgressIndicator progressBar;
void init(String title, String info, int width, int height,
boolean makeVisible)
{
- frame = new JInternalFrame();
+ frame = new ClassicJInternalFrame();
frame.setContentPane(this);
Desktop.addInternalFrame(frame, title, makeVisible, width, height);
frame.setClosable(false);
// FIND ANY ASSOCIATED TREES
if (Desktop.desktop != null)
{
- javax.swing.JInternalFrame[] frames = Desktop.instance
+ jalview.jbgui.ClassicJInternalFrame[] frames = Desktop.instance
.getAllFrames();
for (int t = 0; t < frames.length; t++)
--- /dev/null
+package jalview.jbgui;
+
+/*
+ * bsoares 2022-04-18
+ * ClassicJInternalFrame is a hacked fix for ClassicJInternalFrame's menu (and JComboBox)
+ * widgets not retaining focus when clicked on prior to the frame having focus (e.g.
+ * if another frame has focus and you click on the menu of an unfocused frame then
+ * the menu doesn't open (or more accurately does open and immediately closes again).
+ * This is well documented Java 11+ behaviour, see
+ * https://bugs.openjdk.java.net/browse/JDK-8274931
+ * A workaround is to reinstate the old setSelected() and dispose() methods that do
+ * not send out an ungrab event. This is taken from
+ * https://github.com/george-hawkins/jinternalframe-bug/blob/main/src/main/java/com/example/InternalFrameBugFixDemo.java
+ *
+ * We now extend GAlignFrame from jalview.jbgui.ClassicJInternalFrame.
+ */
+
+import java.beans.BeanProperty;
+import java.beans.PropertyVetoException;
+
+import javax.swing.JInternalFrame;
+import javax.swing.event.InternalFrameEvent;
+
+public class ClassicJInternalFrame extends JInternalFrame
+{
+ public ClassicJInternalFrame()
+ {
+ super();
+ }
+
+ public ClassicJInternalFrame(String title)
+ {
+ super(title);
+ }
+
+ public ClassicJInternalFrame(String title, boolean resizable)
+ {
+ super(title, resizable);
+ }
+
+ public ClassicJInternalFrame(String title, boolean resizable,
+ boolean closable)
+ {
+ super(title, resizable, closable);
+ }
+
+ public ClassicJInternalFrame(String title, boolean resizable,
+ boolean closable, boolean maximizable)
+ {
+ super(title, resizable, closable, maximizable);
+ }
+
+ public ClassicJInternalFrame(String title, boolean resizable,
+ boolean closable, boolean maximizable, boolean iconifiable)
+ {
+ super(title, resizable, closable, maximizable, iconifiable);
+ }
+
+ // -----------------------------------------------------------------
+
+ // The two methods below, `setSelected` and `dispose`, are copied from
+ // `ClassicJInternalFrame` as it existed here:
+ // https://github.com/openjdk/jdk/blob/jdk-11%2B12/src/java.desktop/share/classes/jalview.jbgui.ClassicJInternalFrame.java
+ // They've then been modified to back out this change:
+ // https://github.com/openjdk/jdk/commit/4b8cfe5a6058cdada1ad6efbb8f81e2f8f53a177
+ // The ticket for that change is
+ // https://bugs.openjdk.java.net/browse/JDK-8173739
+ //
+ // On moving to Java 11 we found that if you had two windows, A and B, where A
+ // currently has focus and
+ // B has a combo-box, if you click on the combo-box of B you see the combo's
+ // dropdown list appear
+ // and then immediately disappear - the trigger for this disappearance is an
+ // ungrab events generated
+ // by A, i.e. the window losing focus as a result of you clicking on a
+ // component in window B.
+ // The generation of ungrab events in this situation was introduced in the
+ // change linked to above.
+
+ @BeanProperty(
+ description = "Indicates whether this internal frame is currently the active frame.")
+ public void setSelected(boolean selected) throws PropertyVetoException
+ {
+ // The InternalFrame may already be selected, but the focus
+ // may be outside it, so restore the focus to the subcomponent
+ // which previously had it. See Bug 4302764.
+ if (selected && isSelected)
+ {
+ restoreSubcomponentFocus();
+ return;
+ }
+ // The internal frame or the desktop icon must be showing to allow
+ // selection. We may deselect even if neither is showing.
+ if ((isSelected == selected) || (selected
+ && (isIcon ? !desktopIcon.isShowing() : !isShowing())))
+ {
+ return;
+ }
+
+ Boolean oldValue = isSelected ? Boolean.TRUE : Boolean.FALSE;
+ Boolean newValue = selected ? Boolean.TRUE : Boolean.FALSE;
+ fireVetoableChange(IS_SELECTED_PROPERTY, oldValue, newValue);
+
+ /* We don't want to leave focus in the previously selected
+ frame, so we have to set it to *something* in case it
+ doesn't get set in some other way (as if a user clicked on
+ a component that doesn't request focus). If this call is
+ happening because the user clicked on a component that will
+ want focus, then it will get transfered there later.
+ We test for parent.isShowing() above, because AWT throws a
+ NPE if you try to request focus on a lightweight before its
+ parent has been made visible */
+
+ if (selected)
+ {
+ restoreSubcomponentFocus();
+ }
+
+ isSelected = selected;
+ firePropertyChange(IS_SELECTED_PROPERTY, oldValue, newValue);
+ if (isSelected)
+ fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED);
+ else
+ {
+ fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
+ }
+ repaint();
+ }
+
+ public void dispose()
+ {
+ if (isVisible())
+ {
+ setVisible(false);
+ }
+ if (!isClosed)
+ {
+ firePropertyChange(IS_CLOSED_PROPERTY, Boolean.FALSE, Boolean.TRUE);
+ isClosed = true;
+ }
+ fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED);
+ }
+}
*/
package jalview.jbgui;
-import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
-import jalview.analysis.GeneticCodeI;
-import jalview.analysis.GeneticCodes;
-import jalview.api.SplitContainerI;
-import jalview.bin.Cache;
-import jalview.gui.JvSwingUtils;
-import jalview.gui.Preferences;
-import jalview.io.FileFormats;
-import jalview.schemes.ResidueColourScheme;
-import jalview.util.MessageManager;
-import jalview.util.Platform;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.analysis.GeneticCodeI;
+import jalview.analysis.GeneticCodes;
+import jalview.api.SplitContainerI;
+import jalview.bin.Cache;
+import jalview.gui.JvSwingUtils;
+import jalview.gui.Preferences;
+import jalview.io.FileFormats;
+import jalview.schemes.ResidueColourScheme;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
+
@SuppressWarnings("serial")
-public class GAlignFrame extends JInternalFrame
+public class GAlignFrame extends ClassicJInternalFrame
{
protected JMenuBar alignFrameMenuBar = new JMenuBar();
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
* @author $author$
* @version $Revision$
*/
-public class GCutAndPasteHtmlTransfer extends JInternalFrame
+public class GCutAndPasteHtmlTransfer extends ClassicJInternalFrame
{
protected JEditorPane textarea = new JEditorPane("text/html", "");
import java.awt.event.MouseEvent;
import javax.swing.JButton;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
* @author $author$
* @version $Revision$
*/
-public class GCutAndPasteTransfer extends JInternalFrame
+public class GCutAndPasteTransfer extends ClassicJInternalFrame
{
protected JTextArea textarea = new JTextArea();
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComboBox;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
-public class GPCAPanel extends JInternalFrame
+public class GPCAPanel extends ClassicJInternalFrame
{
private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
*/
package jalview.jbgui;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
@SuppressWarnings("serial")
-public class GRnaStructureViewer extends JInternalFrame
+public class GRnaStructureViewer extends ClassicJInternalFrame
{
public GRnaStructureViewer()
{
import java.awt.Point;
import java.awt.Rectangle;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JSplitPane;
import javax.swing.plaf.basic.BasicInternalFrameUI;
-public class GSplitFrame extends JInternalFrame
+public class GSplitFrame extends ClassicJInternalFrame
{
protected static final int DIVIDER_SIZE = 5;
if (Platform.isAMacAndNotJS())
{
// this saves some space - but doesn't hide the title bar
- topFrame.putClientProperty("JInternalFrame.isPalette", true);
+ topFrame.putClientProperty("ClassicJInternalFrame.isPalette", true);
// topFrame.getRootPane().putClientProperty("Window.style", "small");
- bottomFrame.putClientProperty("JInternalFrame.isPalette", true);
+ bottomFrame.putClientProperty("ClassicJInternalFrame.isPalette", true);
}
else
{
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
protected String frameTitle = MessageManager
.getString("label.structure_chooser");
- protected JInternalFrame mainFrame = new JInternalFrame(frameTitle);
+ protected ClassicJInternalFrame mainFrame = new ClassicJInternalFrame(frameTitle);
protected JComboBox<FilterOption> cmb_filterOption = new JComboBox<>();
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import jalview.util.MessageManager;
@SuppressWarnings("serial")
-public abstract class GStructureViewer extends JInternalFrame
+public abstract class GStructureViewer extends ClassicJInternalFrame
implements JalviewStructureDisplayI, ColourChangeListener
{
// private AAStructureBindingModel bindingModel;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.event.MenuListener;
@SuppressWarnings("serial")
-public class GTreePanel extends JInternalFrame
+public class GTreePanel extends ClassicJInternalFrame
{
BorderLayout borderLayout1 = new BorderLayout();
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import javax.swing.SwingUtilities;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
* only view *should* be coped with sensibly.
*/
// This must have been loaded, is it still visible?
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
String matchedFile = null;
for (int f = frames.length - 1; f > -1; f--)
{
// NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT
if (Desktop.desktop != null)
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
for (int t = 0; t < frames.length; t++)
{
*/
if (!storeDS && Desktop.desktop != null)
{
- for (JInternalFrame frame : Desktop.desktop.getAllFrames())
+ for (ClassicJInternalFrame frame : Desktop.desktop.getAllFrames())
{
if (frame instanceof PCAPanel)
{
{
return;
}
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ ClassicJInternalFrame[] frames = Desktop.desktop.getAllFrames();
for (int f = frames.length - 1; f > -1; f--)
{
if (frames[f] instanceof AppVarna)
* if load is repeated
*/
String postLoadId = viewer.getViewId() + viewIdSuffix;
- for (JInternalFrame frame : getAllFrames())
+ for (ClassicJInternalFrame frame : getAllFrames())
{
if (frame instanceof AppVarna)
{
final String sviewid = viewerData.getKey();
final StructureViewerModel svattrib = viewerData.getValue();
StructureViewerBase comp = null;
- JInternalFrame[] frames = getAllFrames();
- for (JInternalFrame frame : frames)
+ ClassicJInternalFrame[] frames = getAllFrames();
+ for (ClassicJInternalFrame frame : frames)
{
if (frame instanceof StructureViewerBase)
{
*
* @return
*/
- protected JInternalFrame[] getAllFrames()
+ protected ClassicJInternalFrame[] getAllFrames()
{
- JInternalFrame[] frames = null;
+ ClassicJInternalFrame[] frames = null;
// TODO is this necessary - is it safe - risk of hanging?
do
{
import java.util.Map;
import java.util.Vector;
-import javax.swing.JInternalFrame;
+import jalview.jbgui.ClassicJInternalFrame;
import compbio.data.msa.MsaWS;
import compbio.metadata.Argument;
af2.setTitle(complementTitle);
String linkedTitle = MessageManager
.getString("label.linked_view_title");
- JInternalFrame splitFrame = new SplitFrame(
+ ClassicJInternalFrame splitFrame = new SplitFrame(
al.isNucleotide() ? af : af2, al.isNucleotide() ? af2 : af);
Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1);
return;