import java.awt.Component;
import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
private static void adaptAptxGui(MainFrame aptxFrame)
{
JMenuBar frameBar = aptxFrame.getJMenuBar();
-
+ boolean epsAdded = false;
for (int i = 0; i < frameBar.getMenuCount();i++) {
JMenu menu = frameBar.getMenu(i);
+ int menuCount = menu.getMenuComponentCount();
if (menu.getText().contains("File"))
{
// hide all "Read from ..." and "New" menu items and any Separators that
// come directly after them
- Component previousMenuItem = null;
- for (Component menuItem : menu.getMenuComponents()) {
- if (previousMenuItem instanceof JMenuItem)
+ Component previousComp = null;
+ for (int x = 0; x < menuCount; x++)
+ {
+ Component menuItem = menu.getMenuComponent(x);
+ if (previousComp instanceof JMenuItem)
{
- if (((JMenuItem) previousMenuItem).getText().startsWith("Read")
- || ((JMenuItem) previousMenuItem).getText()
- .startsWith("New"))
+ JMenuItem previousMenuItem = (JMenuItem) previousComp;
+ if (previousMenuItem.getText().startsWith("Read")
+ || previousMenuItem.getText()
+ .startsWith("New")
+ || previousMenuItem.getText()
+ .startsWith("Close Tab"))
{
- previousMenuItem.setVisible(false);
+ previousComp.setVisible(false);
if (menuItem instanceof JSeparator)
{
menuItem.setVisible(false);
}
+
+ }
+
+ if ((!epsAdded) && previousMenuItem.getText()
+ .startsWith("Export to"))
+ {
+ JMenuItem exportEps = new JMenuItem("Export to EPS file...");
+ menu.add(exportEps, x);
+ exportEps.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+ epsAdded = true;
+
}
}
- previousMenuItem = menuItem;
+ previousComp = menuItem;
}
}
else if (menu.getText().contains("Inference"))
menu.add(refreshJalview);
sortByTree.setFont(menu.getFont());
- sortByTree.setVisible(false); // don't show unless it's actually
- // possible
-
refreshJalview.addActionListener(activeAptx.get(aptxFrame));