java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.layout.Pane
javafx.scene.layout.VBox
no.ntnu.idatt1002.demo.view.components.Icon
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget

public class Icon extends javafx.scene.layout.VBox
Icon class for the Application.
  • Property Summary Link icon

    Properties inherited from class javafx.scene.layout.VBox Link icon

    alignment, fillWidth, spacing

    Properties inherited from class javafx.scene.layout.Region Link icon

    background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

    Properties inherited from class javafx.scene.Parent Link icon

    needsLayout

    Properties inherited from class javafx.scene.Node Link icon

    accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    private final String
     
    private final String
     
    private int
     
    private final double
     
    private final javafx.scene.shape.SVGPath
     
    private int
     
    private int
     

    Fields inherited from class javafx.scene.layout.Region Link icon

    USE_COMPUTED_SIZE, USE_PREF_SIZE

    Fields inherited from class javafx.scene.Node Link icon

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Icon(String iconName)
    Constructor for the Icon class.
    Icon(String iconName, int size)
    Constructor for the Icon class.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Get the name of the icon.
    int
    Get the size of the icon.
    private javafx.scene.shape.SVGPath
    getSvgCircle(String svgContent)
    Splits the provided line from the SVG file and returns the Circle that the SVG is describing.
    private String
    Splits the SVG content and returns the value of the attribute.
    private javafx.scene.shape.Rectangle
    getSvgRect(String svgContent)
    Splits the provided line from the SVG file and returns the Rectangle that the SVG is describing.
    int
    Get the x value of the icon.
    int
    Get the y value of the icon.
    private String
    Reads the SVG file and returns the content as a string.
    void
    scale(double scale)
    Scales the icon.
    setFillColor(javafx.scene.paint.Color color)
    Set the fill color of the icon.
    void
    setPosition(int x, int y)
    Set the position of the icon.
    void
    setSize(int size)
    Set the size of the icon.
    void
    setStrokeColor(javafx.scene.paint.Color color)
     
    void
    setX(int x)
    Set the x value of the icon.
    void
    setY(int y)
    Set the y value of the icon.
    private String
    splitSvgContent(String svgContent, String regex)
    Splits the SVG content and returns the value of the attribute.

    Methods inherited from class javafx.scene.layout.VBox Link icon

    alignmentProperty, clearConstraints, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, fillWidthProperty, getAlignment, getClassCssMetaData, getContentBias, getCssMetaData, getMargin, getSpacing, getVgrow, isFillWidth, layoutChildren, requestLayout, setAlignment, setFillWidth, setMargin, setSpacing, setVgrow, spacingProperty

    Methods inherited from class javafx.scene.layout.Pane Link icon

    getChildren

    Methods inherited from class javafx.scene.layout.Region Link icon

    backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

    Methods inherited from class javafx.scene.Parent Link icon

    getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestParentLayout, setNeedsLayout, updateBounds

    Methods inherited from class javafx.scene.Node Link icon

    accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable Link icon

    getStyleableNode
  • Field Details Link icon

    • filePath Link icon

      private final String filePath
      See Also:
    • svgPath Link icon

      private final javafx.scene.shape.SVGPath svgPath
    • DEFAULT_SIZE Link icon

      public static final int DEFAULT_SIZE
      See Also:
    • strokeWidth Link icon

      private final double strokeWidth
      See Also:
    • iconName Link icon

      private final String iconName
    • x Link icon

      private int x
    • y Link icon

      private int y
    • size Link icon

      private int size
  • Constructor Details Link icon

    • Icon Link icon

      public Icon(String iconName)
      Constructor for the Icon class.
      Parameters:
      iconName - Name of the icon
    • Icon Link icon

      public Icon(String iconName, int size)
      Constructor for the Icon class.
      Parameters:
      iconName - Name of the icon
      size - Size of the icon, width and height
  • Method Details Link icon

    • setFillColor Link icon

      public Icon setFillColor(javafx.scene.paint.Color color)
      Set the fill color of the icon.

      Fills the icon with the given color. Pass null to remove the fill.

      Parameters:
      color - The color to fill the icon with
    • readSvgFromFile Link icon

      private String readSvgFromFile(String filePath)
      Reads the SVG file and returns the content as a string.
      Parameters:
      filePath - Path to the SVG file
      Returns:
      Content of the SVG file as a string
    • getSvgPathString Link icon

      private String getSvgPathString(String svgContent)
      Splits the SVG content and returns the value of the attribute.
      Parameters:
      svgContent - Content of the SVG file
      Returns:
      Value of the attribute
    • getSvgRect Link icon

      private javafx.scene.shape.Rectangle getSvgRect(String svgContent)
      Splits the provided line from the SVG file and returns the Rectangle that the SVG is describing.
      Parameters:
      svgContent - Content of the SVG file
      Returns:
      The Rectangle described in the SVG file
    • getSvgCircle Link icon

      private javafx.scene.shape.SVGPath getSvgCircle(String svgContent)
      Splits the provided line from the SVG file and returns the Circle that the SVG is describing.
      Parameters:
      svgContent - Content of the SVG file
      Returns:
      The Circle described in the SVG file
    • setStrokeColor Link icon

      public void setStrokeColor(javafx.scene.paint.Color color)
    • splitSvgContent Link icon

      private String splitSvgContent(String svgContent, String regex)
      Splits the SVG content and returns the value of the attribute.
      Parameters:
      svgContent - Content of the SVG file
      regex - Regex to split the content
      Returns:
      Value of the attribute
    • setX Link icon

      public void setX(int x)
      Set the x value of the icon.
      Parameters:
      x - X position
    • setY Link icon

      public void setY(int y)
      Set the y value of the icon.
      Parameters:
      y - Y position
    • setPosition Link icon

      public void setPosition(int x, int y)
      Set the position of the icon.
      Parameters:
      x - X position
      y - Y position
    • setSize Link icon

      public void setSize(int size)
      Set the size of the icon.
      Parameters:
      size - Size of the icon
    • scale Link icon

      public void scale(double scale)
      Scales the icon.
      Parameters:
      scale - Scale of the icon
    • getX Link icon

      public int getX()
      Get the x value of the icon.
      Returns:
      x position
    • getY Link icon

      public int getY()
      Get the y value of the icon.
      Returns:
      y position
    • getSize Link icon

      public int getSize()
      Get the size of the icon.
      Returns:
      size of the icon
    • getIconName Link icon

      public String getIconName()
      Get the name of the icon.
      Returns:
      name of the icon