Package javax.swing

Examples of javax.swing.JComponent$AccessibleJComponent$AccessibleContainerHandler


      // Only display read/write properties.
      if (getter == null || setter == null) {
  continue;
      }
 
      JComponent view = null;

      try {
  Object args[] = { };
  Object value = getter.invoke(m_Target, args);
  m_Values[i] = value;
View Full Code Here


      int index = ((Integer) tr.getTransferData(flavors[1])).intValue();
      Action separator = DefaultToolBarModel.getInstance().getSeparatorAction();
      Action glue = DefaultToolBarModel.getInstance().getGlueAction();
      Action space = DefaultToolBarModel.getInstance().getSpaceAction();

      JComponent target = (JComponent) ((DropTarget) e.getSource())
          .getComponent();

      if (target.equals(mButtonPanel)) {
        if (index == -1 && !separator.getValue(Action.NAME).equals(name)
            && !glue.getValue(Action.NAME).equals(name)
            && !space.getValue(Action.NAME).equals(name)) {
          for (Action a : mCurrentActions) {
            if (a.getValue(Action.NAME).equals(name)) {
              mCurrentActions.removeElement(a);
              mAvailableActions.addElement(a);
              break;
            }
          }
        } else if (index != -1) {
          Action a = mCurrentActions.elementAt(index);
          mCurrentActions.removeElementAt(index);
          if (!separator.getValue(Action.NAME).equals(name)
              && !glue.getValue(Action.NAME).equals(name)
              && !space.getValue(Action.NAME).equals(name)
              ) {
            mAvailableActions.addElement(a);
          }
        }
        saveSettings();
      } else if (target.equals(MainFrame.getInstance().getToolbar())
          || ((DropTarget) e.getSource()).getComponent().equals(
              MainFrame.getInstance().getToolBarPanel())) {

        Point location = e.getLocation();

        if (mWest) {
          location.setLocation(10, location.y);
        } else {
          location.setLocation(location.x, MainFrame.getInstance().getToolbar()
              .getHeight() / 2);
        }

        JComponent c = (JComponent) MainFrame.getInstance().getToolbar()
            .getComponentAt(location);

        if ((c == null || c instanceof JToolBar) && MainFrame.getInstance().getToolbar().getComponentCount() > 0) {
          c = (JComponent) MainFrame.getInstance().getToolbar().getComponent(
              MainFrame.getInstance().getToolbar().getComponentCount() - 1);

          if (c != null) {
            location.setLocation(c.getLocation().x + c.getWidth() - 1, c
                .getLocation().y
                + c.getHeight() - 1);
          }
        }

        int n = 0;

        if (c != null) {
          Point p = SwingUtilities.convertPoint(MainFrame.getInstance().getToolBarPanel(), location, c);

          n = MainFrame.getInstance().getToolbar().getComponentIndex(c);

          if (!((mWest && (p.y < c.getHeight() / 2)) || (!mWest && (p.x < c
              .getWidth() / 2)))) {
            n++;
          }
        }
View Full Code Here

    Action separator = DefaultToolBarModel.getInstance().getSeparatorAction();
    Action glue = DefaultToolBarModel.getInstance().getGlueAction();
    Action space = DefaultToolBarModel.getInstance().getSpaceAction();
    Action[] actions = DefaultToolBarModel.getInstance().getAvailableActions();

    JComponent c = (JComponent) e.getComponent();

    for (Action action : actions) {
      String text;
      if (c instanceof JToolBar.Separator) {
        text = (String) separator.getValue(Action.NAME);
      } else if(c instanceof JPanel) {
        text = (String) glue.getValue(Action.NAME);
      } else {
        if (((AbstractButton) c).getText() == null) {
          text = "notext";
        } else if (!((AbstractButton) c).getText().startsWith("<html>")) {
          text = ((AbstractButton) c).getText();
        } else {
          text = ((AbstractButton) c).getText().substring(37,
              ((AbstractButton) c).getText().length() - 13);
        }
      }
      if (action.getValue(Action.NAME).equals(text)
          || separator.getValue(Action.NAME).equals(text)
          || glue.getValue(Action.NAME).equals(text)
          || space.getValue(Action.NAME).equals(text)
          || text.equals("notext")) {
        c.setBackground(Color.WHITE);

        e.startDrag(null, new TransferAction(text, MainFrame.getInstance()
            .getToolbar().getComponentIndex(e.getComponent())));
        break;
      }
View Full Code Here

  public void dragOver(DropTargetDragEvent e) {
    /*
     * Paint the cue line to show the user where the ActionButton will be placed
     * in the ToolBar.
     */
    JComponent target = (JComponent) ((DropTarget) e.getSource())
        .getComponent();

    if (!target.equals(mButtonPanel)) {
      Point location = e.getLocation();

      if (mWest) {
        location.setLocation(10,
            location.y);
      } else {
        location.setLocation(location.x, MainFrame.getInstance().getToolbar()
            .getHeight() / 2);
      }

      JComponent c = (JComponent) MainFrame.getInstance().getToolbar()
          .getComponentAt(location);

      if ((c == null || c instanceof JToolBar) && MainFrame.getInstance().getToolbar().getComponentCount()>0) {
        c = (JComponent) MainFrame.getInstance().getToolbar().getComponent(
            MainFrame.getInstance().getToolbar().getComponentCount() - 1);

        if (c != null) {
          location.setLocation(c.getLocation().x + c.getWidth() - 1, c
              .getLocation().y
              + c.getHeight() - 1);
        }
      }

      if (c != null) {
        JPanel toolBarPanel = MainFrame.getInstance().getToolBarPanel();

        Point p = SwingUtilities.convertPoint(toolBarPanel, location, c);

        Rectangle oldCueLineBounds = mCueLine.getBounds();

        if (mWest) {
          mCueLine.setRect(1,
              (p.y < c.getHeight() / 2) ? (location.y - p.y) : (location.y
                  + c.getHeight() - p.y), toolBarPanel.getWidth() - 1, 2);
        } else {
          mCueLine.setRect((p.x < c.getWidth() / 2) ? (location.x - p.x )
              : (location.x + c.getWidth() - p.x ), 1, 2,
              toolBarPanel.getHeight() - 1);
        }

        if (!oldCueLineBounds.equals(mCueLine.getBounds())) {
          Graphics2D g2d = (Graphics2D) toolBarPanel.getGraphics();
View Full Code Here

    JPanel filter = new JPanel(new FormLayout("fill:pref:grow",
        "pref, 3dlu, pref, 3dlu"));

    CellConstraints cc = new CellConstraints();

    JComponent filterSeparator = DefaultComponentFactory.getInstance()
        .createSeparator(
            mLocalizer.msg("channelFilter", "Channel Filter") + ":");
    filterSeparator.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));

    filter.add(filterSeparator, cc.xy(1, 1));

    JPanel filterPanel = new JPanel(new FormLayout(
        "pref, 3dlu, pref:grow, fill:60dlu, 3dlu, pref, 3dlu, pref:grow, pref",
View Full Code Here

  private void searchForToAddingPrograms() {
    // show the now/soon running programs
    try {
      Channel[] channels = getTrayChannels();

      JComponent subMenu;

      // Put the programs in a sub menu?
      if (Settings.propTrayNowProgramsInSubMenu.getBoolean() && Settings.propTrayNowProgramsEnabled.getBoolean()) {
        subMenu = new ScrollableMenu(mLocalizer.msg("menu.programsNow", "Now running programs"));
      } else {
View Full Code Here

  /**
   * Add the time info menu.
   */
  private void addTimeInfoMenu() {
    JComponent time;

    if (Settings.propTrayOnTimeProgramsInSubMenu.getBoolean()) {
      time = new JMenu(mLocalizer.msg("menu.programsAtTime", "Programs at time"));
      mTrayMenu.add(time);
    } else {
      time = mTrayMenu;
    }

    int[] tempTimes = Settings.propTimeButtons.getIntArray();

    ArrayList<Integer> today = new ArrayList<Integer>();
    ArrayList<Integer> tomorrow = new ArrayList<Integer>();

    for (int tempTime : tempTimes) {
      if (tempTime < IOUtilities.getMinutesAfterMidnight()) {
        tomorrow.add(tempTime);
      } else {
        today.add(tempTime);
      }
    }

    int[] times;

    if (tomorrow.isEmpty() || today.isEmpty()) {
      times = tempTimes;
    } else {
      times = new int[tempTimes.length + 1];

      int j = 0;

      for (int i = 0; i < today.size(); i++) {
        times[j] = today.get(i).intValue();
        j++;
      }

      times[j] = -1;
      j++;

      for (int i = 0; i < tomorrow.size(); i++) {
        times[j] = tomorrow.get(i).intValue();
        j++;
      }
    }

    for (int value : times) {
      if (value == -1) {
        if (time instanceof JMenu) {
          ((JMenu) time).addSeparator();
        } else {
          ((JPopupMenu) time).addSeparator();
        }
      } else {
        final int fvalue = value;

        final JMenu menu = new ScrollableMenu(IOUtilities.timeToString(value) + " "
            + (mTime24 ? mLocalizer.msg("menu.time", "") : ""));

        if (value < IOUtilities.getMinutesAfterMidnight()) {
          menu.setText(menu.getText() + " " + mLocalizer.msg("menu.tomorrow", ""));
        }

        menu.addMenuListener(new MenuListener() {
          public void menuSelected(MenuEvent e) {
            createTimeProgramMenu(menu, fvalue);
          }

          public void menuCanceled(MenuEvent e) {
          }

          public void menuDeselected(MenuEvent e) {
          }
        });
        time.add(menu);
      }
    }
  }
View Full Code Here

  /**
   * Changes the input map of furniture library view to ensure accelerators work even with no menu.
   */
  private void installAccelerators(JFrame furnitureFrame,
                                   final EditorController furnitureLibraryController) {
    JComponent furnitureLibraryView = (JComponent)furnitureLibraryController.getView();
    InputMap inputMap = furnitureLibraryView.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = furnitureLibraryView.getActionMap();
    for (Object key : actionMap.allKeys()) {
      if (key instanceof EditorView.ActionType) {
        inputMap.put((KeyStroke)actionMap.get(key).getValue(Action.ACCELERATOR_KEY), key);
      }
    }
View Full Code Here

                    EditorController controller) {
    this.preferences = preferences;
    createActions(controller, preferences);
   
    // Layout components
    JComponent furnitureLibraryView = (JComponent)controller.getFurnitureLibraryController().getView();
    JScrollPane furnitureLibraryScrollPane = new JScrollPane(furnitureLibraryView);
    JViewport viewport = furnitureLibraryScrollPane.getViewport();
    viewport.setTransferHandler(furnitureLibraryView.getTransferHandler());   
    JPopupMenu furnitureLibraryPopupMenu = createFurnitureLibraryPopupMenu(preferences, controller);
    furnitureLibraryView.setComponentPopupMenu(furnitureLibraryPopupMenu);
    viewport.setComponentPopupMenu(furnitureLibraryPopupMenu);
    getContentPane().add(furnitureLibraryScrollPane);
    getContentPane().add(createToolBar(preferences, controller), BorderLayout.NORTH);
   
    // Map Enter accelerator of furniture library to furniture modification action
    furnitureLibraryView.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), ActionType.MODIFY_FURNITURE);
    furnitureLibraryView.getActionMap().put(ActionType.MODIFY_FURNITURE, getActionMap().get(ActionType.MODIFY_FURNITURE));
    controller.getFurnitureLibraryController().addSelectionListener(new SelectionListener() {
        public void selectionChanged(SelectionEvent ev) {
          getActionMap().get(ActionType.DELETE).setEnabled(!ev.getSelectedItems().isEmpty());
          getActionMap().get(ActionType.MODIFY_FURNITURE).setEnabled(!ev.getSelectedItems().isEmpty());
        }
View Full Code Here

    toolBar.addSeparator();
    toolBar.add(new ResourceAction.ToolBarAction(actionMap.get(ActionType.IMPORT_FURNITURE)));
    toolBar.add(new ResourceAction.ToolBarAction(actionMap.get(ActionType.MODIFY_FURNITURE)));
    toolBar.add(new ResourceAction.ToolBarAction(actionMap.get(ActionType.DELETE)));
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    JComponent furnitureLanguageView = (JComponent)controller.getFurnitureLanguageController().getView();
    furnitureLanguageView.setMaximumSize(furnitureLanguageView.getPreferredSize());
    toolBar.add(furnitureLanguageView);
    toolBar.addSeparator();
    toolBar.add(new ResourceAction.ToolBarAction(actionMap.get(EditorView.ActionType.ABOUT)));
    return toolBar;
  }
View Full Code Here

TOP

Related Classes of javax.swing.JComponent$AccessibleJComponent$AccessibleContainerHandler

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.