Package javax.swing

Examples of javax.swing.JRootPane


    final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (SwingTools.showConfirmDialog((JComponent)parentView,
            this, this.dialogTitle, this.nameTextField) == JOptionPane.OK_OPTION) {
      if (this.controller.getBackFaceShown() != null
          && this.controller.getBackFaceShown()) {
        JRootPane rootPane = SwingUtilities.getRootPane((JComponent)parentView);
        Cursor defaultCursor = rootPane.getCursor();
        try {
          rootPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
          this.controller.setModel(ImportFurnitureTaskPanel.copyToTemporaryOBJContent(
              this.iconComponent.getModel(), this.controller.getModel()));
        } catch (IOException e) {
          JOptionPane.showMessageDialog(rootPane,
              preferences.getLocalizedString(FurniturePanel.class, "backFaceShownError"),
              preferences.getLocalizedString(FurniturePanel.class, "errorTitle"),
              JOptionPane.ERROR_MESSAGE);
        } finally {
          rootPane.setCursor(defaultCursor);
        }
      }
      this.controller.modifyFurniture();
    }
    if (focusOwner != null) {
View Full Code Here


     */
    protected JPanel getGraphicPalette(final GraphicBase obj, final String title) {

        final JComboBox jcb;
        final JFrame jframe;
        final JRootPane main;
        final JPanel parent;

        parent = PaletteHelper.createVerticalPanel(title);
        jframe = new JFrame();
        main = jframe.getRootPane();

        // different controls for different render types
        jcb = new JComboBox();
        jcb.addItem("LatLon");// indices correspond to LineType.java
        jcb.addItem("XY");
        jcb.addItem("Offset");
        jcb.setSelectedIndex(obj.rt - 1);
        jcb.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                obj.setRender(jcb);
                switch (obj.rt) {
                case OMGraphic.RENDERTYPE_LATLON:
                    jframe.setTitle(title + " - LatLon");
                    main.getContentPane().removeAll();
                    main.getContentPane().add(obj.getGUI());
                    jframe.pack();
                    jframe.setVisible(true);
                    break;
                case OMGraphic.RENDERTYPE_XY:
                    jframe.setTitle(title + " - XY");
                    main.getContentPane().removeAll();
                    main.getContentPane().add(obj.getGUI());
                    jframe.pack();
                    jframe.setVisible(true);
                    break;
                case OMGraphic.RENDERTYPE_OFFSET:
                    jframe.setTitle(title + " - XY Offset");
                    main.getContentPane().removeAll();
                    main.getContentPane().add(obj.getGUI());
                    jframe.pack();
                    jframe.setVisible(true);
                    break;
                default:
                    System.err.println("ARRRR!");
View Full Code Here


   /** Install popup panel to current textComponent root pane */
  private void installToRootPane(JComponent c)
  {
    JRootPane rp = _popupParent.getRootPane();
    if (rp != null)
    {
      rp.getLayeredPane().add(c, JLayeredPane.POPUP_LAYER, 0);
    }
  }
View Full Code Here

  }

  /** Remove popup panel from previous textComponent root pane */
  private void removeFromRootPane(JComponent c)
  {
    JRootPane rp = c.getRootPane();
    if (rp != null)
    {
      rp.getLayeredPane().remove(c);
    }
  }
View Full Code Here

    // The best MVC solution should be to avoid the following statements
    // but Mac OS X accepts to display the menu bar of a frame in the screen
    // menu bar only if this menu bar depends directly on its root pane 
    HomeView homeView = this.controller.getHomeController().getView();
    if (homeView instanceof JRootPane) {
      JRootPane homePane = (JRootPane)homeView;
      setJMenuBar(homePane.getJMenuBar());
      homePane.setJMenuBar(null);
    }
   
    // Add listeners to model and frame   
    addListeners(this.home, this.application, this.controller.getHomeController(), homeFrame);
   
View Full Code Here

 
  /**
   * Returns the action Attach / Detach menu item.
   */
  private Action createAttachDetach3DViewAction(HomeController controller, boolean popup) {
    JRootPane view3DRootPane = SwingUtilities.getRootPane((JComponent)controller.getHomeController3D().getView());
    ActionType display3DViewActionType = view3DRootPane == this       
        ? ActionType.DETACH_3D_VIEW
        : ActionType.ATTACH_3D_VIEW;
    Action backgroundImageAction = getActionMap().get(display3DViewActionType);
    return popup
View Full Code Here

   
    final HomeController controller = new HomeAppletController(
        home, AppletApplication.this, getViewFactory(), getContentManager(), getPluginManager(),
        newHomeEnabled, openEnabled, saveEnabled, saveAsEnabled);
   
    JRootPane homeView = (JRootPane)controller.getView();
    // Remove menu bar
    homeView.setJMenuBar(null);
   
    // As the applet has no menu, activate accelerators directly on home view
    for (HomeView.ActionType actionType : HomeView.ActionType.values()) {
      Action action = homeView.getActionMap().get(actionType);
      if (action != null) {
        ResourceAction.MenuItemAction menuAction = new ResourceAction.MenuItemAction(action);
        KeyStroke accelerator = (KeyStroke)menuAction.getValue(Action.ACCELERATOR_KEY);
        if (accelerator != null) {
          homeView.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(accelerator, actionType);
        }
      }
    }
   
    // Change default buttons in toolbar
    JToolBar toolBar = (JToolBar)homeView.getContentPane().getComponent(0);
    toolBar.setFloatable(false);   
    // Retrieve all buttons that are plug-in actions
    List<JComponent> pluginButtons = new ArrayList<JComponent>();
    for (int i = 0; i < toolBar.getComponentCount(); i++) {
      JComponent component = (JComponent)toolBar.getComponent(i);
      if (component instanceof AbstractButton
          && ((AbstractButton)component).getAction().
                getValue(PluginAction.Property.TOOL_BAR.name()) == Boolean.TRUE) {
        pluginButtons.add(component);
      }
    }
    toolBar.removeAll();
    // Add New, Open, Save, Save as buttons if they are enabled
    Action newHomeAction = getToolBarAction(homeView, HomeView.ActionType.NEW_HOME);
    if (newHomeAction != null && newHomeAction.isEnabled()) {
      toolBar.add(newHomeAction);
    }
    Action openAction = getToolBarAction(homeView, HomeView.ActionType.OPEN);
    if (openAction != null && openAction.isEnabled()) {
      toolBar.add(openAction);
    }
    Action saveAction = getToolBarAction(homeView, HomeView.ActionType.SAVE);
    if (saveAction != null && saveAction.isEnabled()) {
      toolBar.add(saveAction);
    }
    Action saveAsAction = getToolBarAction(homeView, HomeView.ActionType.SAVE_AS);
    if (saveAsAction != null && saveAsAction.isEnabled()) {
      toolBar.add(saveAsAction);
    }
   
    if (getAppletBooleanParameter(this.applet, ENABLE_EXPORT_TO_SH3D)) {
      try {
        // Add export to SH3D action
        Action exportToSH3DAction = new ControllerAction(getUserPreferences(),
            AppletApplication.class, "EXPORT_TO_SH3D", controller, "exportToSH3D");
        exportToSH3DAction.setEnabled(true);
        toolBar.add(new ResourceAction.ToolBarAction(exportToSH3DAction));
      } catch (NoSuchMethodException ex) {
        ex.printStackTrace();
      }
    }
   
    if (toolBar.getComponentCount() > 0) {
      toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    }
    addToolBarAction(homeView, HomeView.ActionType.PAGE_SETUP, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.PRINT, toolBar);
    Action printToPdfAction = getToolBarAction(homeView, HomeView.ActionType.PRINT_TO_PDF);
    if (printToPdfAction != null
        && getAppletBooleanParameter(this.applet, ENABLE_PRINT_TO_PDF)
        && !OperatingSystem.isMacOSX()) {
      controller.getView().setEnabled(HomeView.ActionType.PRINT_TO_PDF, true);
      toolBar.add(printToPdfAction);
    }
    Action preferencesAction = getToolBarAction(homeView, HomeView.ActionType.PREFERENCES);
    if (preferencesAction != null) {
      toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
      toolBar.add(preferencesAction);
    }
    toolBar.addSeparator();

    addToolBarAction(homeView, HomeView.ActionType.UNDO, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.REDO, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    addToolBarAction(homeView, HomeView.ActionType.CUT, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.COPY, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.PASTE, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    addToolBarAction(homeView, HomeView.ActionType.DELETE, toolBar);
    toolBar.addSeparator();

    Action addHomeFurnitureAction = getToolBarAction(homeView, HomeView.ActionType.ADD_HOME_FURNITURE);
    if (addHomeFurnitureAction != null) {
      toolBar.add(addHomeFurnitureAction);
      toolBar.addSeparator();
    }
   
    final JToggleButton selectToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.SELECT));
    selectToggleButton.setSelected(true);
    toolBar.add(selectToggleButton);
    final JToggleButton panToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.PAN));
    toolBar.add(panToggleButton);
    final JToggleButton createWallsToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_WALLS));
    toolBar.add(createWallsToggleButton);
    final JToggleButton createRoomsToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_ROOMS));
    toolBar.add(createRoomsToggleButton);
    final JToggleButton createDimensionLinesToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_DIMENSION_LINES));
    toolBar.add(createDimensionLinesToggleButton);
    final JToggleButton createLabelsToggleButton =
        new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_LABELS));
    toolBar.add(createLabelsToggleButton);
    // Add Select, Create Walls and Create dimensions buttons to radio group
    ButtonGroup group = new ButtonGroup();
    group.add(selectToggleButton);
    group.add(panToggleButton);
    group.add(createWallsToggleButton);
    group.add(createRoomsToggleButton);
    group.add(createDimensionLinesToggleButton);
    group.add(createLabelsToggleButton);
    controller.getPlanController().addPropertyChangeListener(PlanController.Property.MODE,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            PlanController.Mode mode = controller.getPlanController().getMode();
            selectToggleButton.setSelected(mode == PlanController.Mode.SELECTION);
            panToggleButton.setSelected(mode == PlanController.Mode.PANNING);
            createWallsToggleButton.setSelected(mode == PlanController.Mode.WALL_CREATION);
            createRoomsToggleButton.setSelected(mode == PlanController.Mode.ROOM_CREATION);
            createDimensionLinesToggleButton.setSelected(mode == PlanController.Mode.DIMENSION_LINE_CREATION);
            createLabelsToggleButton.setSelected(mode == PlanController.Mode.LABEL_CREATION);
          }
        });
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
   
    addToolBarAction(homeView, HomeView.ActionType.ZOOM_OUT, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.ZOOM_IN, toolBar);

    Action createPhotoAction = getToolBarAction(homeView, HomeView.ActionType.CREATE_PHOTO);
    if (createPhotoAction != null) {
      boolean enableCreatePhoto = getAppletBooleanParameter(this.applet, ENABLE_CREATE_PHOTO);
      controller.getView().setEnabled(HomeView.ActionType.CREATE_PHOTO, enableCreatePhoto);
      if (enableCreatePhoto) {
        toolBar.addSeparator();
        toolBar.add(createPhotoAction);
      }
    }

    // Add plug-in buttons
    if (pluginButtons.size() > 0) {
      toolBar.addSeparator();
      for (JComponent pluginButton : pluginButtons) {
        toolBar.add(pluginButton);
      }
    }
   
    Action aboutAction = getToolBarAction(homeView, HomeView.ActionType.ABOUT);
    if (aboutAction != null) {
      toolBar.addSeparator();
      toolBar.add(aboutAction);
    }
   
    controller.getView().setEnabled(HomeView.ActionType.EXPORT_TO_SVG,
        getAppletBooleanParameter(this.applet, ENABLE_EXPORT_TO_SVG));
    controller.getView().setEnabled(HomeView.ActionType.EXPORT_TO_OBJ,
        getAppletBooleanParameter(this.applet, ENABLE_EXPORT_TO_OBJ));
    controller.getView().setEnabled(HomeView.ActionType.CREATE_VIDEO,
        getAppletBooleanParameter(this.applet, ENABLE_CREATE_VIDEO));
   
    // Add a border
    homeView.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
   
    return controller;
  }
View Full Code Here

        }

        //System.err.println("prep: " + Arrays.asList(options) + " " + Arrays.asList(closingOptions) + " " + buttonListener);
        buttonPanel.removeAll();

        JRootPane rp = getRootPane();

        for (int i = 0; i < options.length; i++) {
            addedOptions.add(options[i]);
            buttonPanel.add(option2Button(options[i], nd, makeListener(options[i]), rp));
        }
View Full Code Here

    protected JRootPane createRootPane() {
        KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        KeyStroke enterStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
       
        JRootPane rootPane = new JRootPane();
        rootPane.registerKeyboardAction(this, escapeStroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
        rootPane.registerKeyboardAction(this, enterStroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
       
        return rootPane;
    }
View Full Code Here

    final JButton        ggPeakReset;
    final JToolBar        tbMonitoring;
    final TimeLabel        lbTime;
    final MessageFormat      frmtPeak    = new MessageFormat( getResourceString( "msgPeak" ), Locale.US ); // XXX Locale.US
    final Object[]        peakArgs    = new Object[1];
    final JRootPane        rp        = getRootPane();
    final InputMap        imap      = rp.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW );
    final ActionMap        amap      = rp.getActionMap();
    final JButton        ggAbort, ggRecord, ggStop, ggClose;
    final int          myMeta      = BasicMenuFactory.MENU_SHORTCUT == InputEvent.CTRL_MASK ?
      InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK : BasicMenuFactory.MENU_SHORTCUT;  // META on Mac, CTRL+SHIFT on PC

    // use same encoding as parent document
View Full Code Here

TOP

Related Classes of javax.swing.JRootPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.