コード例 #1
0
ファイル: Shapes.java プロジェクト: syzh1991/DigitalEarth
 public static void main(String[] args) {
   try {
     AppFrame frame = new AppFrame();
     frame.setTitle(APP_NAME);
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.setVisible(true);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
ファイル: App.java プロジェクト: cst316/spring16project-Basic
  void init() {
    /*
     * if (packFrame) { frame.pack(); } else { frame.validate(); }
     *
     * Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
     *
     * Dimension frameSize = frame.getSize(); if (frameSize.height >
     * screenSize.height) { frameSize.height = screenSize.height; } if
     * (frameSize.width > screenSize.width) { frameSize.width =
     * screenSize.width; }
     *
     *
     * Make the window fullscreen - On Request of users This seems not to
     * work on sun's version 1.4.1_01 Works great with 1.4.2 !!! So update
     * your J2RE or J2SDK.
     */
    /* Used to maximize the screen if the JVM Version if 1.4 or higher */
    /* --------------------------------------------------------------- */
    double JVMVer =
        Double.valueOf(System.getProperty("java.version").substring(0, 3)).doubleValue();

    frame.pack();
    if (JVMVer >= 1.4) {
      frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    } else {
      frame.setExtendedState(Frame.NORMAL);
    }
    /* --------------------------------------------------------------- */
    /* Added By Jeremy Whitlock (jcscoobyrs) 07-Nov-2003 at 15:54:24 */

    // Not needed ???
    frame.setVisible(true);
    frame.toFront();
    frame.requestFocus();
  }
コード例 #3
0
ファイル: App.java プロジェクト: cst316/spring16project-Basic
 public void show() {
   if (frame.isVisible()) {
     frame.toFront();
     frame.requestFocus();
   } else init();
 }
コード例 #4
0
ファイル: App.java プロジェクト: cst316/spring16project-Basic
 public static void closeWindow() {
   if (frame == null) return;
   frame.dispose();
 }
コード例 #5
0
ファイル: Win.java プロジェクト: Clubfan22/Hangman
 private void jButton1ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
   Main start = new Main();
   this.dispose();
   main.setVisible(false);
 } // GEN-LAST:event_jButton1ActionPerformed
コード例 #6
0
  protected static void makeMenu(final AppFrame appFrame) {
    JMenuBar menuBar = new JMenuBar();
    appFrame.setJMenuBar(menuBar);
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);

    JMenuItem openWfsItem =
        new JMenuItem(
            new AbstractAction("Add WFS layer...") {
              @Override
              public void actionPerformed(ActionEvent actionEvent) {
                JDialog dialog = new JDialog(appFrame, "Import WFS layer", true);
                WfsPanel wfsPanel = new WfsPanel();
                wfsPanel.setDialog(dialog);
                Dimension dimension = wfsPanel.getPreferredSize();
                dimension.setSize(dimension.getWidth() + 10, dimension.getHeight() + 25);
                dialog.getContentPane().add(wfsPanel);
                dialog.setSize(dimension);
                dialog.setModal(true);
                dialog.setVisible(true);

                if (wfsPanel.isConfirmed()) {
                  String url = wfsPanel.getUrl();
                  String name = wfsPanel.getFeatureName();
                  Sector sector = wfsPanel.getSector();
                  double dist = wfsPanel.getVisibleDistance();
                  Angle tile = wfsPanel.getTileDelta();
                  Color color = wfsPanel.getColor();
                  String lineLabelTag = wfsPanel.getFeatureLableTypeName();

                  try {
                    addWfsLayer(url, name, sector, tile, dist * 1000, color, lineLabelTag);
                  } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "Error: " + e.getMessage());
                  }
                }

                dialog.dispose();
              }
            });

    fileMenu.add(openWfsItem);

    JMenuItem quitItem =
        new JMenuItem(
            new AbstractAction("Quit") {
              @Override
              public void actionPerformed(ActionEvent e) {
                System.exit(0);
              }
            });
    fileMenu.add(quitItem);

    JMenu optionsMenu = new JMenu("Shading");
    menuBar.add(optionsMenu);
    ButtonGroup optionsGroup = new ButtonGroup();

    JMenuItem wwShading =
        new ShadingItem(new boolean[] {false, false, false, false}, "Default World Wind");
    optionsMenu.add(wwShading);
    optionsGroup.add(wwShading);
    JMenuItem gaeaShading =
        new ShadingItem(new boolean[] {true, true, true, false}, "Advanced Gaea+ shading");
    optionsMenu.add(gaeaShading);
    optionsGroup.add(gaeaShading);
    JMenuItem shadows =
        new ShadingItem(
            new boolean[] {true, true, true, true}, "Advanced Gaea+ shading with shadows");
    optionsMenu.add(shadows);
    optionsGroup.add(shadows);

    // depending on support for advanced shading, enable/disable menu items and select appropriate
    // shading model
    boolean gaeaShadingSupported = isGaeaShadingSupported(appFrame.getWwd());

    gaeaShading.setEnabled(gaeaShadingSupported);
    shadows.setEnabled(gaeaShadingSupported);
    if (gaeaShadingSupported) gaeaShading.doClick();
    else {
      wwShading.doClick();
      // if gaea shading is not supported by GPU/driver, we also have to remove the run-time
      // calculated layers
      ArrayList<Layer> unsupportedLayers = new ArrayList<Layer>();
      for (Layer layer : appFrame.getWwd().getModel().getLayers()) {
        if (layer instanceof SlopeLayer || layer instanceof ElevationLayer)
          unsupportedLayers.add(layer);
      }
      appFrame.getWwd().getModel().getLayers().removeAll(unsupportedLayers);
      if (appFrame instanceof GaeaAppFrame) ((GaeaAppFrame) appFrame).updateLayerPanel();
    }

    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    String licenseMsg =
        "This application, together with the NASA World Wind Java SDK and the modifications to the SDK done by XLAB d.o.o.,"
            + "are distributed under the terms of NASA Open Source Agreement license.\n"
            + "You should have received this license together with this application. If not, please contact [email protected] or visit http://www.gaeaplus.eu.\n\n"
            + "The data layers included in this application are either licensed for use in World Wind, owned by XLAB d.o.o., or available for free from servers intended for public use.";
    helpMenu.add(new MessageItem(licenseMsg, "Terms of use"));
    String aboutMsg =
        "This is a demonstration of features that Gaea+ Open Source adds to NASA World Wind Java SDK.\n"
            + "For more information, visit http://www.gaeaplus.eu/en/, https://github.com/gaeaplus/gaeaplus, and http://worldwind.arc.nasa.gov/java/.";
    helpMenu.add(new MessageItem(aboutMsg, "About..."));
  }
コード例 #7
0
ファイル: Controller.java プロジェクト: andrnil/marenor
  public Frame getFrame() {
    AppFrame appFrame = (AppFrame) getRegisteredObject(Constants.APP_FRAME);
    if (appFrame != null) return appFrame.getFrame();

    return Util.findParentFrame((Container) getRegisteredObject(Constants.APP_PANEL));
  }