Package javafx.scene.control

Examples of javafx.scene.control.IndexRange


     */
    public void shift(final int shiftAmount) {
        if (centerIndex <= 0 && shiftAmount > 0) return;
        if (centerIndex >= items.size() - 1 && shiftAmount < 0) return;
        centerIndex -= shiftAmount;
        IndexRange newItemRange = null;
        if (files != null && centerIndex < (files.length - 1) && centerIndex > (items.size() - 3)) {
          final int startIndex = items.size();
          for (int i=startIndex; i<(startIndex + imagesPerLoad); i++) {
            if (i >= files.length) {
              break;
            }
            addItem(files[i], null, items.size() - 1);
          }
          if (startIndex < (items.size() - 1)) {
            newItemRange = new IndexRange(startIndex, items.size() - 1);
          }
        }
        update(newItemRange);
        selectedImageIndexProperty.set(centerIndex);
    }
View Full Code Here


        return virtualFlow.getCellIfVisible(area.getCurrentParagraph())
                .map(c -> c.getNode().getCaretBoundsOnScreen());
    }

    private Optional<Bounds> getSelectionBoundsOnScreen() {
        IndexRange selection = area.getSelection();
        if(selection.getLength() == 0) {
            return getCaretBoundsOnScreen();
        }

        Bounds[] bounds = virtualFlow.visibleCells()
                .map(c -> c.getNode().getSelectionBoundsOnScreen())
View Full Code Here

        }
        return true;
    }

    private void deleteBackward(KeyEvent ignore) {
        IndexRange selection = area.getSelection();
        if(selection.getLength() == 0) {
            area.deletePreviousChar();
        } else {
            area.replaceSelection("");
        }
    }
View Full Code Here

            area.replaceSelection("");
        }
    }

    private void deleteForward(KeyEvent ignore) {
        IndexRange selection = area.getSelection();
        if(selection.getLength() == 0) {
            area.deleteNextChar();
        } else {
            area.replaceSelection("");
        }
    }
View Full Code Here

            area.replaceSelection("");
        }
    }

    private void left(KeyEvent ignore) {
        IndexRange sel = area.getSelection();
        if(sel.getLength() == 0) {
            area.previousChar(SelectionPolicy.CLEAR);
        } else {
            area.moveTo(sel.getStart(), SelectionPolicy.CLEAR);
        }
    }
View Full Code Here

            area.moveTo(sel.getStart(), SelectionPolicy.CLEAR);
        }
    }

    private void right(KeyEvent ignore) {
        IndexRange sel = area.getSelection();
        if(sel.getLength() == 0) {
            area.nextChar(SelectionPolicy.CLEAR);
        } else {
            area.moveTo(sel.getEnd(), SelectionPolicy.CLEAR);
        }
    }
View Full Code Here

        }
    }

    private void firstLeftPress(HitInfo hit) {
        clearTargetCaretOffset();
        IndexRange selection = area.getSelection();
        if(selection.getLength() != 0 &&
                hit.getCharIndex() >= selection.getStart() &&
                hit.getCharIndex() < selection.getEnd()) {
            // press inside selection
            dragSelection = DragState.POTENTIAL_DRAG;
        } else {
            dragSelection = DragState.NO_DRAG;
            area.moveTo(hit.getInsertionIndex(), SelectionPolicy.CLEAR);
View Full Code Here

     */
    public IndexRange getStyleRangeAtPosition(int position) {
        Position pos = navigator.offsetToPosition(position, Backward);
        int start = position - pos.getMinor();
        int end = start + segments.get(pos.getMajor()).length();
        return new IndexRange(start, end);
    }
View Full Code Here

                break;
            case ADJUST:
                selectRange(getAnchor(), pos);
                break;
            case EXTEND:
                IndexRange sel = getSelection();
                int anchor;
                if(pos <= sel.getStart())
                    anchor = sel.getEnd();
                else if(pos >= sel.getEnd())
                    anchor = sel.getStart();
                else
                    anchor = getAnchor();
                selectRange(anchor, pos);
                break;
        }
View Full Code Here

    default void replaceSelection(StyledDocument<S> replacement) {
        replace(getSelection(), replacement);
    }

    default void moveSelectedText(int pos) {
        IndexRange sel = getSelection();

        if(pos >= sel.getStart() && pos <= sel.getEnd()) {
            // no move, just position the caret
            selectRange(pos, pos);
        } else {
            String text = getSelectedText();
            if(pos > sel.getEnd())
                pos -= sel.getLength();
            deleteText(sel);
            insertText(pos, text);
        }
    }
View Full Code Here

TOP

Related Classes of javafx.scene.control.IndexRange

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.