Examples of locationToIndex()


Examples of com.commander4j.gui.JList4j.locationToIndex()

      {
        JList4j list = (JList4j) event.getSource();

        // Get index of item clicked

        int index = list.locationToIndex(event.getPoint());
        JCheckListItem item = (JCheckListItem) list.getModel().getElementAt(index);

        // Toggle selected state

        item.setSelected(!item.isSelected());
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

  private void showPopupMenu(MouseEvent e) {
    if(e.getSource() instanceof JList) {
      JList list = (JList)e.getSource();

      Object listItem = list.getModel().getElementAt(list.locationToIndex(e.getPoint()));

      if(listItem instanceof SelectableItem) {
        final Object item = ((SelectableItem)listItem).getItem();

        if(item instanceof SoftwareUpdateItem) {
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

    if(flavors != null && flavors.length == 2 &&
        flavors[0].getHumanPresentableName().equals("Indices") &&
        flavors[1].getHumanPresentableName().equals("Source")) {
      try {
        JList target = (JList)((DropTarget)e.getSource()).getComponent();
        int x = target.locationToIndex(e.getLocation());
       
        Rectangle rect = target.getCellBounds(x,x);
        if(rect != null) {
          rect.setSize(rect.width,rect.height/2);
       
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

        final JList roleSetsList = new JList(myListModel);
        roleSetsList.setCellRenderer(myListModel.getCellRenderer());
        roleSetsList.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                int index = roleSetsList.locationToIndex(e.getPoint());
                myListModel.toggle(index);
            }
        });
        roleSetsList.setAlignmentX(0);
        label.setLabelFor(roleSetsList);
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

    list.setCellRenderer(new CheckListRenderer());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setBorder(new EmptyBorder(0, 4, 0, 0));
    list.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
        int index = list.locationToIndex(e.getPoint());
        CheckableItem item = (CheckableItem) list.getModel()
            .getElementAt(index);
        item.setSelected(!item.isSelected());
        Rectangle rect = list.getCellBounds(index, index);
        list.repaint(rect);
View Full Code Here

Examples of javax.swing.JList.locationToIndex()


  private void showJList(final JScrollPane view, final Point pt) {
    final JList list = (JList) view.getViewport().getView();
    final Point p = SwingUtilities.convertPoint(view, pt.x, pt.y, list);
    final int row = list.locationToIndex(p);
    if (row == -1) {
      hide();
      return;
    }
    final Rectangle bds = list.getCellBounds(row, row);
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

  public void mouseExited(MouseEvent e) {
  }

  public void mousePressed(MouseEvent e) {
    JList list = (JList) e.getComponent();
    int clickedIndex = list.locationToIndex(e.getPoint());
    int index = this.renderer.getIndex(clickedIndex, e);
    this.selectionModel.setSelectedIndex(index);
    list.setSelectedIndex(index / this.width);
    list.ensureIndexIsVisible(index / this.width);
    list.repaint();
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

    e.consume();   
  }

  public void mouseReleased(MouseEvent e) {
    JList list = (JList) e.getComponent();
    int clickedIndex = list.locationToIndex(e.getPoint());
    int index = this.renderer.getIndex(clickedIndex, e);
    this.selectionModel.setSelectedIndex(index);
    list.setSelectedIndex(index / this.width);
    list.ensureIndexIsVisible(index / this.width);
    list.repaint();
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

    }
    if (!(e.getComponent() instanceof JList)) {
      return;
    }
    JList list = (JList) e.getComponent();
    int position = list.locationToIndex(e.getPoint());
    if (position < 0) {
      return;
    }
    Object object = list.getModel().getElementAt(position);
    if (!(object instanceof Page)) {
View Full Code Here

Examples of javax.swing.JList.locationToIndex()

    // Retrieve information
    if (!(e.getComponent() instanceof JList)) {
      return;
    }
    JList tmpList = (JList) e.getComponent();
    int position = tmpList.locationToIndex(e.getPoint());
    if (position < 0) {
      return;
    }
    Object object = tmpList.getModel().getElementAt(position);
    if (!(object instanceof Page)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.