public BulkDownloadPanel(WorldWindow wwd) {
    this.wwd = wwd;

    // Init retievable list
    this.retrievables = new ArrayList<BulkRetrievablePanel>();
    // Layers
    for (Layer layer : this.wwd.getModel().getLayers()) {
      if (layer instanceof BulkRetrievable)
        this.retrievables.add(new BulkRetrievablePanel((BulkRetrievable) layer));
    }
    // Elevation models
    CompoundElevationModel cem =
        (CompoundElevationModel) wwd.getModel().getGlobe().getElevationModel();
    for (ElevationModel elevationModel : cem.getElevationModels()) {
      if (elevationModel instanceof BulkRetrievable)
        this.retrievables.add(new BulkRetrievablePanel((BulkRetrievable) elevationModel));
    }

    // Init sector selector
    this.selector = new SectorSelector(wwd);
    this.selector.setInteriorColor(new Color(1f, 1f, 1f, 0.1f));
    this.selector.setBorderColor(new Color(1f, 0f, 0f, 0.5f));
    this.selector.setBorderWidth(3);
    this.selector.addPropertyChangeListener(
        SectorSelector.SECTOR_PROPERTY,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            updateSector();
          }
        });

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
    this.initComponents();
  }
Exemplo n.º 2
0
  public IvusFrame(World world) {
    OrbitView view = (world != null) ? new OrbitView(world) : new OrbitView();
    view.setAxesOrientation(AxesOrientation.XRIGHT_YOUT_ZDOWN);
    ViewCanvas canvas = new ViewCanvas(view);
    canvas.setView(view);

    ModeManager mm = new ModeManager();
    mm.add(canvas);
    OrbitViewMode ovm = new OrbitViewMode(mm);
    SelectDragMode sdm = new SelectDragMode(mm);

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    Action exitAction =
        new AbstractAction("Exit") {
          private static final long serialVersionUID = 1L;

          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        };
    JMenuItem exitItem = fileMenu.add(exitAction);
    exitItem.setMnemonic('x');

    JMenu modeMenu = new JMenu("Mode");
    modeMenu.setMnemonic('M');
    JMenuItem ovmItem = new ModeMenuItem(ovm);
    modeMenu.add(ovmItem);
    JMenuItem sdmItem = new ModeMenuItem(sdm);
    modeMenu.add(sdmItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(modeMenu);

    JToolBar toolBar = new JToolBar(SwingConstants.VERTICAL);
    toolBar.setRollover(true);
    JToggleButton ovmButton = new ModeToggleButton(ovm);
    toolBar.add(ovmButton);
    JToggleButton sdmButton = new ModeToggleButton(sdm);
    toolBar.add(sdmButton);

    ovm.setActive(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(new Dimension(SIZE, SIZE));
    this.add(canvas, BorderLayout.CENTER);
    this.add(toolBar, BorderLayout.WEST);
    this.setJMenuBar(menuBar);
  }
  public static void main(String[] args) {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);

    Browser browser = new Browser();
    BrowserView view = new BrowserView(browser);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.add(view, BorderLayout.CENTER);
    frame.setSize(700, 500);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    browser.setContextMenuHandler(new MyContextMenuHandler(view));
    browser.loadURL("http://www.google.com");
  }
Exemplo n.º 4
0
 private void init() {
   setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
   addWindowListener(
       new WindowAdapter() {
         @Override
         public void windowClosing(final WindowEvent e) {
           cleanExit();
         }
       });
   addWindowStateListener(
       new WindowStateListener() {
         public void windowStateChanged(final WindowEvent arg0) {
           switch (arg0.getID()) {
             case WindowEvent.WINDOW_ICONIFIED:
               lessCpu(true);
               break;
             case WindowEvent.WINDOW_DEICONIFIED:
               lessCpu(false);
               break;
           }
         }
       });
   setIconImage(Configuration.getImage(Configuration.Paths.Resources.ICON));
   JPopupMenu.setDefaultLightWeightPopupEnabled(false);
   WindowUtil.setFrame(this);
   panel = new BotPanel();
   menuBar = new BotMenuBar(this);
   toolBar = new BotToolBar(this, menuBar);
   panel.setFocusTraversalKeys(0, new HashSet<AWTKeyStroke>());
   new BotKeyboardShortcuts(KeyboardFocusManager.getCurrentKeyboardFocusManager(), this, this);
   menuBar.setBot(null);
   setJMenuBar(menuBar);
   textScroll =
       new JScrollPane(
           TextAreaLogHandler.TEXT_AREA,
           ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
           ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   textScroll.setBorder(null);
   textScroll.setPreferredSize(new Dimension(PANEL_WIDTH, 120));
   textScroll.setVisible(true);
   JScrollPane scrollableBotPanel = new JScrollPane(panel);
   add(toolBar, BorderLayout.NORTH);
   add(scrollableBotPanel, BorderLayout.CENTER);
   add(textScroll, BorderLayout.SOUTH);
 }
Exemplo n.º 5
0
  public void initUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      JPopupMenu.setDefaultLightWeightPopupEnabled(false);
      frame = new JFrame("Project Benelux | 317 | Fullscreen - Resizeable");
      frame.setLayout(new BorderLayout());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      gamePanel = new JPanel();
      new AutoUpdater().run();
      webclient = false;
      gamePanel.setLayout(new BorderLayout());
      gamePanel.add(this);
      JMenu fileMenu = new JMenu("File");

      String[] mainButtons = new String[] {"-", "Exit", "-"};

      for (String name : mainButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) {
          fileMenu.addSeparator();
        } else {
          menuItem.addActionListener(this);
          fileMenu.add(menuItem);
        }
      }

      JMenuBar menuBar = new JMenuBar();
      JMenuBar jmenubar = new JMenuBar();
      Dimension dimension1 = new Dimension(765 + 16, 503 + 59);
      frame.setMinimumSize(dimension1);
      frame.add(jmenubar);
      menuBar.add(fileMenu);
      frame.getContentPane().add(menuBar, BorderLayout.NORTH);
      frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
      frame.pack();

      frame.setVisible(true); // can see the client
      frame.setResizable(true); // resizeable frame
      init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 6
0
  public void initUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      JPopupMenu.setDefaultLightWeightPopupEnabled(false);
      frame = new JFrame("Vestige-x Developers Client");
      frame.setIconImage(
          Toolkit.getDefaultToolkit().getImage(signlink.findcachedir() + "Cursor.png"));
      frame.setLayout(new BorderLayout());
      frame.setResizable(false);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      JPanel gamePanel = new JPanel();
      gamePanel.setLayout(new BorderLayout());
      gamePanel.add(this);
      Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
      int w = 765;
      int h = 503;
      int x = (dim.width - w) / 2;
      int y = (dim.height - h) / 2;
      frame.setLocation(x, y);
      gamePanel.setPreferredSize(new Dimension(765, 503));
      JMenu fileMenu = new JMenu("  File  ");
      JMenu toolMenu = new JMenu("  Tools  ");
      JMenu infoMenu = new JMenu("  Info  ");
      JMenu toggleMenu = new JMenu("  Toggles  ");
      JMenu profileMenu = new JMenu("  Links  ");
      JButton shotMenu = new JButton("Take Screenshot");
      shotMenu.setActionCommand("Screenshot");
      shotMenu.addActionListener(this);
      String[] mainButtons = new String[] {"View Images", "Exit"};
      String[] toolButtons = new String[] {"World Map"};
      String[] infoButtons = new String[] {"Client Information", "Support"};
      String[] toggleButtons = new String[] {"Toggle 10x Damage", "Untoggle 10x Damage"};
      String[] profileButtons =
          new String[] {"Donate", "Vote", "-", "Highscores", "Guides", "YouTube", "Forums"};

      for (String name : mainButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) {
          fileMenu.addSeparator();
        } else {
          menuItem.addActionListener(this);
          fileMenu.add(menuItem);
        }
      }
      for (String name : toolButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) toolMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          toolMenu.add(menuItem);
        }
      }

      for (String name : infoButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) infoMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          infoMenu.add(menuItem);
        }
      }
      for (String name : toggleButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) toggleMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          toggleMenu.add(menuItem);
        }
      }
      for (String name : profileButtons) {
        JMenuItem menuItem = new JMenuItem(name);
        if (name.equalsIgnoreCase("-")) toggleMenu.addSeparator();
        else {
          menuItem.addActionListener(this);
          profileMenu.add(menuItem);
        }
      }
      JMenuBar menuBar = new JMenuBar();
      JMenuBar jmenubar = new JMenuBar();

      frame.add(jmenubar);
      menuBar.add(fileMenu);
      menuBar.add(toolMenu);
      menuBar.add(infoMenu);
      // menuBar.add(toggleMenu);
      menuBar.add(profileMenu);
      menuBar.add(shotMenu);
      frame.getContentPane().add(menuBar, BorderLayout.NORTH);
      frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
      frame.pack();

      frame.setVisible(true); // can see the client
      frame.setResizable(false); // resizeable frame
      init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 7
0
 static {
   // The following is required to use Swing menus with the heavyweight canvas used by World Wind.
   ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
   JPopupMenu.setDefaultLightWeightPopupEnabled(false);
 }
Exemplo n.º 8
0
  /** Initializes the layout and the ribbon. */
  private void initRibbon() {
    this.setLayout(new RibbonFrameLayout());
    this.ribbon = new JRibbon(this);
    this.add(this.ribbon, BorderLayout.NORTH);

    // this.keyTipManager = new KeyTipManager(this);
    Toolkit.getDefaultToolkit()
        .addAWTEventListener(
            new AWTEventListener() {
              private boolean prevAltModif = false;

              @Override
              public void eventDispatched(AWTEvent event) {
                Object src = event.getSource();
                if (src instanceof Component) {
                  Component c = (Component) src;
                  if ((c == JRibbonFrame.this)
                      || (SwingUtilities.getWindowAncestor(c) == JRibbonFrame.this)) {
                    if (event instanceof KeyEvent) {
                      KeyEvent keyEvent = (KeyEvent) event;
                      // System.out.println(keyEvent.getID() + ":"
                      // + keyEvent.getKeyCode());
                      switch (keyEvent.getID()) {
                        case KeyEvent.KEY_PRESSED:
                          // if (keyEvent.getKeyCode() ==
                          // KeyEvent.VK_ESCAPE) {
                          // keyTipManager.showPreviousChain();
                          // }

                          break;
                        case KeyEvent.KEY_RELEASED:
                          boolean wasAltModif = prevAltModif;
                          prevAltModif = keyEvent.getModifiersEx() == InputEvent.ALT_DOWN_MASK;
                          if (wasAltModif && keyEvent.getKeyCode() == KeyEvent.VK_ALT) break;
                          char keyChar = keyEvent.getKeyChar();
                          if (Character.isLetter(keyChar) || Character.isDigit(keyChar)) {
                            // System.out.println("Will handle key press "
                            // + keyChar);
                            KeyTipManager.defaultManager().handleKeyPress(keyChar);
                          }
                          if ((keyEvent.getKeyCode() == KeyEvent.VK_ALT)
                              || (keyEvent.getKeyCode() == KeyEvent.VK_F10)) {
                            if (keyEvent.getModifiers() != 0 || keyEvent.getModifiersEx() != 0)
                              break;
                            boolean hadPopups =
                                !PopupPanelManager.defaultManager().getShownPath().isEmpty();
                            PopupPanelManager.defaultManager().hidePopups(null);
                            if (hadPopups || KeyTipManager.defaultManager().isShowingKeyTips()) {
                              KeyTipManager.defaultManager().hideAllKeyTips();
                            } else {
                              KeyTipManager.defaultManager().showRootKeyTipChain(JRibbonFrame.this);
                            }
                          }
                          if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE) {
                            // System.out.println("In KTM");
                            KeyTipManager.defaultManager().showPreviousChain();
                          }
                          break;
                      }
                    }
                    if (event instanceof MouseEvent) {
                      MouseEvent mouseEvent = (MouseEvent) event;
                      switch (mouseEvent.getID()) {
                        case MouseEvent.MOUSE_CLICKED:
                        case MouseEvent.MOUSE_DRAGGED:
                        case MouseEvent.MOUSE_PRESSED:
                        case MouseEvent.MOUSE_RELEASED:
                          KeyTipManager.defaultManager().hideAllKeyTips();
                      }
                    }
                  }
                }
              }
            },
            AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);

    final KeyTipLayer keyTipLayer = new KeyTipLayer();
    JRootPane rootPane = this.getRootPane();
    JLayeredPane layeredPane = rootPane.getLayeredPane();
    final LayoutManager currLM = rootPane.getLayout();
    rootPane.setLayout(
        new LayoutManager() {
          @Override
          public void addLayoutComponent(String name, Component comp) {
            currLM.addLayoutComponent(name, comp);
          }

          @Override
          public void layoutContainer(Container parent) {
            currLM.layoutContainer(parent);
            JRibbonFrame ribbonFrame = JRibbonFrame.this;
            if (ribbonFrame.getRootPane().getWindowDecorationStyle() != JRootPane.NONE)
              keyTipLayer.setBounds(ribbonFrame.getRootPane().getBounds());
            else keyTipLayer.setBounds(ribbonFrame.getRootPane().getContentPane().getBounds());
          }

          @Override
          public Dimension minimumLayoutSize(Container parent) {
            return currLM.minimumLayoutSize(parent);
          }

          @Override
          public Dimension preferredLayoutSize(Container parent) {
            return currLM.preferredLayoutSize(parent);
          }

          @Override
          public void removeLayoutComponent(Component comp) {
            currLM.removeLayoutComponent(comp);
          }
        });
    // layeredPane.setLayout(new OverlayLayout(layeredPane));
    layeredPane.add(keyTipLayer, (Integer) (JLayeredPane.DEFAULT_LAYER + 60));

    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowDeactivated(WindowEvent e) {
            // hide all key tips on window deactivation
            KeyTipManager keyTipManager = KeyTipManager.defaultManager();
            if (keyTipManager.isShowingKeyTips()) {
              keyTipManager.hideAllKeyTips();
            }
          }
        });

    KeyTipManager.defaultManager()
        .addKeyTipListener(
            new KeyTipManager.KeyTipListener() {
              @Override
              public void keyTipsHidden(KeyTipEvent event) {
                if (event.getSource() == JRibbonFrame.this) keyTipLayer.setVisible(false);
              }

              @Override
              public void keyTipsShown(KeyTipEvent event) {
                if (event.getSource() == JRibbonFrame.this) keyTipLayer.setVisible(true);
              }
            });

    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);

    super.setIconImages(Arrays.asList(FlamingoUtilities.getBlankImage(16, 16)));
  }
Exemplo n.º 9
0
  /**
   * Constructs a simple frame with the specified world and orientation.
   *
   * @param world the world view.
   * @param ao the axes orientation.
   */
  public RSFFrame(World world, AxesOrientation ao) {
    super(new PlotPanel());
    if (world == null) world = new World();
    if (ao == null) ao = AxesOrientation.XRIGHT_YOUT_ZDOWN;
    _world = world;
    _view = new OrbitView(_world);
    _view.setAxesOrientation(ao);
    _canvas = new ViewCanvas();
    _canvas.setView(_view);
    _canvas.setBackground(Color.WHITE);

    _points = new ArrayList<PointGroup>();
    _lines = new ArrayList<LineGroup>();

    _d = null;
    _tpx = null;
    _tpy = null;
    _ipg = null;

    _etc = null;
    _coord = null;

    ModeManager mm = new ModeManager();
    mm.add(_canvas);
    OrbitViewMode ovm = new OrbitViewMode(mm);
    SelectDragMode sdm = new SelectDragMode(mm);

    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    Action exitAction =
        new AbstractAction("Exit") {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        };

    Action cubeAction =
        new AbstractAction("Add Cube") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) addRSFCube(filename);
          }
        };

    Action lineAction =
        new AbstractAction("Add Line") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) addRSFLine(filename);
          }
        };

    Action pointAction =
        new AbstractAction("Add Points") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) addRSFPoint(filename);
          }
        };

    Action loadViewAction =
        new AbstractAction("Load Viewpoint") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) loadView(filename);
          }
        };

    Action saveViewAction =
        new AbstractAction("Save Viewpoint") {
          public void actionPerformed(ActionEvent event) {
            JFileChooser chooser = new JFileChooser(new File("."));
            int returnVal = chooser.showSaveDialog(new JFrame());
            String filename = null;
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              filename = chooser.getSelectedFile().getPath();
              saveView(filename);
            }
          }
        };

    Action saveFrameAction =
        new AbstractAction("Save to PNG") {
          public void actionPerformed(ActionEvent event) {
            JFileChooser chooser = new JFileChooser(new File("."));
            int returnVal = chooser.showSaveDialog(new JFrame());
            String filename = null;
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              filename = chooser.getSelectedFile().getPath();
              saveFrametoPNG(filename);
            }
          }
        };

    JMenuItem cubeItem = fileMenu.add(cubeAction);
    cubeItem.setMnemonic('C');

    JMenuItem lineItem = fileMenu.add(lineAction);
    lineItem.setMnemonic('L');

    JMenuItem pointItem = fileMenu.add(pointAction);
    pointItem.setMnemonic('P');

    JMenuItem saveViewItem = fileMenu.add(saveViewAction);
    saveViewItem.setMnemonic('V');

    JMenuItem loadViewItem = fileMenu.add(loadViewAction);
    loadViewItem.setMnemonic('I');

    JMenuItem saveFrameItem = fileMenu.add(saveFrameAction);
    saveFrameItem.setMnemonic('S');

    JMenuItem exitItem = fileMenu.add(exitAction);
    exitItem.setMnemonic('X');

    JMenu colorMenu = new JMenu("Color");

    Action jetAction =
        new AbstractAction("Jet") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.JET;
            setColorMap();
          }
        };

    Action prismAction =
        new AbstractAction("Prism") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.PRISM;
            setColorMap();
          }
        };

    Action grayAction =
        new AbstractAction("Gray") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.GRAY;
            setColorMap();
          }
        };

    Action rwbAction =
        new AbstractAction("Red-White-Blue") {
          public void actionPerformed(ActionEvent event) {
            _color = ColorList.RWB;
            setColorMap();
          }
        };

    colorMenu.add(jetAction);
    colorMenu.add(prismAction);
    colorMenu.add(grayAction);
    colorMenu.add(rwbAction);

    JMenu clipMenu = new JMenu("% Clip");
    Action clipUp =
        new AbstractAction("Set max pclip") {
          public void actionPerformed(ActionEvent event) {
            String value =
                JOptionPane.showInputDialog(new JFrame(), "Percentile Clip Max (0-100.0):", _pmax);
            try {
              _pmax = Float.parseFloat(value);
              if (_pmax > 100.0f) _pmax = 100.0f;
              if (_pmax < _pmin) _pmax = _pmin + 1.0f;
              System.out.printf("pclip: (%f,%f) \n", _pmin, _pmax);
              _ipg.setPercentiles(_pmin, _pmax);

            } catch (Exception e) {
              System.out.println(e);
            }
          }
        };
    Action clipDown =
        new AbstractAction("Set min pclip") {
          public void actionPerformed(ActionEvent event) {
            String value =
                JOptionPane.showInputDialog(
                    new JFrame(), String.format("Percentile Clip Min (0-%f):", _pmax), _pmin);
            try {
              _pmin = Float.parseFloat(value);
              if (_pmin < 0.0f) _pmin = 0.0f;
              if (_pmin > _pmax) _pmin = _pmax - 1.0f;
              System.out.printf("pclip: (%f,%f) \n", _pmin, _pmax);
              _ipg.setPercentiles(_pmin, _pmax);

            } catch (Exception e) {
              System.out.println(e);
            }
          }
        };

    clipMenu.add(clipUp);
    clipMenu.add(clipDown);

    JMenu modeMenu = new JMenu("Mode");
    modeMenu.setMnemonic('M');
    JMenuItem ovmItem = new JMenuItem(ovm);
    modeMenu.add(ovmItem);
    JMenuItem sdmItem = new JMenuItem(sdm);
    modeMenu.add(sdmItem);

    JMenu tensorMenu = new JMenu("Tensor");

    Action tenLoadAction =
        new AbstractAction("Load Tensors") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) loadTensors(filename);
          }
        };

    Action tenCoordLoadAction =
        new AbstractAction("Load Tensor Coordinates") {
          public void actionPerformed(ActionEvent event) {
            String filename = chooseFile(".");
            if (filename != null) loadTensorCoords(filename);
          }
        };

    Action showTenAction =
        new AbstractAction("Show Tensors at Coordinates") {
          public void actionPerformed(ActionEvent event) {

            String filename;
            int sel;

            if (_ipg == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "An RSF Cube (Image) needs to be loaded. " + " Would you like to load one?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) addRSFCube(filename);
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot load tensors because an RFC cube was not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }
            if (_coord == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "The tensors coordinates need to be loaded. "
                          + " Would you like to load them?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) loadCoord(filename);
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Error loading coordinates.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }
            if (_etc == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "The tensors at coordinates need to be loaded. "
                          + " Would you like to load them?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) loadTensorCoords(filename);
                return;
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot show tensors because the tensors at coordinates" + " were not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }
            /*
            if(_d == null) {
            	sel = JOptionPane.showConfirmDialog(null,
            						"The tensors need to be loaded. "
            						+ " Would you like to load them?",
            						"Notice",
            						JOptionPane.OK_CANCEL_OPTION,
            						JOptionPane.QUESTION_MESSAGE);
            	if(sel == JOptionPane.OK_OPTION) {
            		filename = chooseFile(".");
            		if (filename != null) loadTensors(filename);
            	} else {
            		JOptionPane.showConfirmDialog(null,
            				"Cannot show tensors because the tensors were not loaded.",
            				"Error",
            				JOptionPane.DEFAULT_OPTION,
            				JOptionPane.ERROR_MESSAGE);
            		return;
            	}
            }
            if(_etg == null) {
            	sel = JOptionPane.showConfirmDialog(null,
            						"The tensor coordinates need to be loaded. "
            						+ " Would you like to load them?",
            						"Notice",
            						JOptionPane.OK_CANCEL_OPTION,
            						JOptionPane.QUESTION_MESSAGE);
            	if(sel == JOptionPane.OK_OPTION) {
            		filename = chooseFile(".");
            		if (filename != null) loadTensorCoords(filename);
            		return;
            	} else {
            		JOptionPane.showConfirmDialog(null,
            				"Cannot show tensors because the tensor coordinates"
            				+ " were not loaded.",
            				"Error",
            				JOptionPane.DEFAULT_OPTION,
            				JOptionPane.ERROR_MESSAGE);
            		return;
            	}
            }
            */
            _world.addChild(_etg);
          }
        };

    Action hideTenAction =
        new AbstractAction("Hide Tensors at Coordinates") {
          public void actionPerformed(ActionEvent event) {
            if (_etg != null) _world.removeChild(_etg);
          }
        };

    Action showTenPanAction =
        new AbstractAction("Show Tensor Panels") {
          public void actionPerformed(ActionEvent event) {

            String filename;
            int sel;
            if (_ipg == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "An RSF Cube (Image) needs to be loaded. " + " Would you like to load one?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) addRSFCube(filename);
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot load tensors because an RFC cube was not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            }

            if (_d == null) {
              sel =
                  JOptionPane.showConfirmDialog(
                      null,
                      "The tensors need to be loaded. " + " Would you like to load them?",
                      "Notice",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
              if (sel == JOptionPane.OK_OPTION) {
                filename = chooseFile(".");
                if (filename != null) loadTensors(filename);
                addRSFTensorEllipsoids();
              } else {
                JOptionPane.showConfirmDialog(
                    null,
                    "Cannot show tensors because the tensors were not loaded.",
                    "Error",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.ERROR_MESSAGE);
                return;
              }
            } else if (_tpx == null || _tpy == null) {
              addRSFTensorEllipsoids();
            } else {
              ImagePanel ipx = _ipg.getImagePanel(Axis.X);
              ImagePanel ipy = _ipg.getImagePanel(Axis.Y);
              ipx.getFrame().addChild(_tpx);
              ipy.getFrame().addChild(_tpy);
            }
          }
        };

    Action hideTenPanAction =
        new AbstractAction("Hide Tensor Panels") {
          public void actionPerformed(ActionEvent event) {
            if (_tpx != null) {
              ImagePanel ipx = _ipg.getImagePanel(Axis.X);
              ipx.getFrame().removeChild(_tpx);
            }
            if (_tpy != null) {
              ImagePanel ipy = _ipg.getImagePanel(Axis.Y);
              ipy.getFrame().removeChild(_tpy);
            }
          }
        };

    JMenuItem tensorItem0 = tensorMenu.add(tenLoadAction);
    tensorItem0.setMnemonic('L');

    JMenuItem tensorItem2 = tensorMenu.add(tenCoordLoadAction);
    tensorItem2.setMnemonic('C');

    JMenuItem tensorItem1 = tensorMenu.add(showTenPanAction);
    tensorItem1.setMnemonic('T');

    JMenuItem tensorItem5 = tensorMenu.add(hideTenPanAction);
    tensorItem5.setMnemonic('R');

    JMenuItem tensorItem4 = tensorMenu.add(showTenAction);
    tensorItem4.setMnemonic('S');

    JMenuItem tensorItem3 = tensorMenu.add(hideTenAction);
    tensorItem3.setMnemonic('H');

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(modeMenu);
    menuBar.add(tensorMenu);
    menuBar.add(colorMenu);
    menuBar.add(clipMenu);

    JToolBar toolBar = new JToolBar(SwingConstants.VERTICAL);
    toolBar.setRollover(true);
    JToggleButton ovmButton = new ModeToggleButton(ovm);
    toolBar.add(ovmButton);
    JToggleButton sdmButton = new ModeToggleButton(sdm);
    toolBar.add(sdmButton);

    _cb = new ColorBar();
    _cb.setWidthMinimum(45);
    _cb.setFont(_cb.getFont().deriveFont(18.f));
    // _ipg.addColorMapListener(_cb);

    ovm.setActive(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(new Dimension(SIZE, SIZE));
    this.add(_canvas, BorderLayout.CENTER);
    this.add(toolBar, BorderLayout.WEST);
    this.add(_cb, BorderLayout.EAST);
    this.setJMenuBar(menuBar);
    this.setVisible(true);
  }