Java Code Examples for javafx.geometry.Pos#BOTTOM_RIGHT
The following examples show how to use
javafx.geometry.Pos#BOTTOM_RIGHT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DisplayPositionSelector.java From Quelea with GNU General Public License v3.0 | 6 votes |
public static Pos getPosFromIndex(int index) { switch (index) { case -1: return Pos.CENTER; case 0: return Pos.TOP_LEFT; case 1: return Pos.TOP_CENTER; case 2: return Pos.TOP_RIGHT; case 3: return Pos.CENTER_LEFT; case 4: return Pos.CENTER; case 5: return Pos.CENTER_RIGHT; case 6: return Pos.BOTTOM_LEFT; case 7: return Pos.BOTTOM_CENTER; case 8: return Pos.BOTTOM_RIGHT; default: return Pos.CENTER; } }
Example 2
Source File: QuarterSkin.java From Medusa with Apache License 2.0 | 6 votes |
private void drawGradientBar() { Pos knobPosition = gauge.getKnobPosition(); TickLabelLocation tickLabelLocation = gauge.getTickLabelLocation(); double scaledSize = size * 1.9; double xy = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.105 * scaledSize : 0.03875 * scaledSize; double wh = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledSize * 0.79 : scaledSize * 0.925; double offsetX = Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_LEFT == knobPosition ? -scaledSize * 0.475 : 0; double offsetY = Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.475 : 0; double offset = 90 - startAngle; ScaleDirection scaleDirection = gauge.getScaleDirection(); List<Stop> stops = gauge.getGradientBarStops(); Map<Double, Color> stopAngleMap = new HashMap<>(stops.size()); for (Stop stop : stops) { stopAngleMap.put(stop.getOffset() * ANGLE_RANGE, stop.getColor()); } double offsetFactor = ScaleDirection.CLOCKWISE == scaleDirection ? (Pos.TOP_LEFT == knobPosition || Pos.BOTTOM_RIGHT == knobPosition ? startAngle : 180 - startAngle) : (startAngle + 180); AngleConicalGradient gradient = new AngleConicalGradient(scaledSize * 0.5, scaledSize * 0.5, offsetFactor, stopAngleMap, gauge.getScaleDirection()); double barStartAngle = ScaleDirection.CLOCKWISE == scaleDirection ? -minValue * angleStep : minValue * angleStep; double barAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? gauge.getRange() * angleStep : -gauge.getRange() * angleStep; tickMarkCtx.save(); tickMarkCtx.setStroke(gradient.getImagePattern(new Rectangle(xy - 0.026 * scaledSize + offsetX, xy - 0.026 * scaledSize + offsetY, wh + 0.052 * scaledSize, wh + 0.052 * scaledSize))); tickMarkCtx.setLineWidth(scaledSize * 0.052); tickMarkCtx.setLineCap(StrokeLineCap.BUTT); tickMarkCtx.strokeArc(xy + offsetX, xy + offsetY, wh, wh, -(offset + barStartAngle), -barAngleExtend, ArcType.OPEN); tickMarkCtx.restore(); }
Example 3
Source File: DotHTMLLabelJavaFxNode.java From gef with Eclipse Public License 2.0 | 5 votes |
private Pos posForTd(String hAlign, String vAlign) { switch (hAlign != null ? hAlign.toLowerCase() : "") { //$NON-NLS-1$ case "left": //$NON-NLS-1$ switch (vAlign != null ? vAlign.toLowerCase() : "") { //$NON-NLS-1$ case "top": //$NON-NLS-1$ return Pos.TOP_LEFT; case "bottom": //$NON-NLS-1$ return Pos.BOTTOM_LEFT; case "middle": //$NON-NLS-1$ default: return Pos.CENTER_LEFT; } case "right": //$NON-NLS-1$ switch (vAlign != null ? vAlign.toLowerCase() : "") { //$NON-NLS-1$ case "top": //$NON-NLS-1$ return Pos.TOP_RIGHT; case "bottom": //$NON-NLS-1$ return Pos.BOTTOM_RIGHT; case "middle": //$NON-NLS-1$ default: return Pos.CENTER_RIGHT; } case "center": //$NON-NLS-1$ case "text": //$NON-NLS-1$ default: switch (vAlign != null ? vAlign.toLowerCase() : "") { //$NON-NLS-1$ case "top": //$NON-NLS-1$ return Pos.TOP_CENTER; case "bottom": //$NON-NLS-1$ return Pos.BOTTOM_CENTER; case "middle": //$NON-NLS-1$ default: return Pos.CENTER; } } }
Example 4
Source File: QuarterSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void drawAreasAndSections(final GraphicsContext CTX) { if (areas.isEmpty() && sections.isEmpty()) return; double value = gauge.getCurrentValue(); Pos knobPosition = gauge.getKnobPosition(); double scaledSize = size * 1.9; double offset = 90 - startAngle; double offsetX; double offsetY; double xy; double wh; int listSize; // Draw Areas if (areasVisible && !areas.isEmpty()) { xy = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.078 * scaledSize : 0.0125 * scaledSize; wh = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledSize * 0.846 : scaledSize * 0.97; offsetX = Pos.BOTTOM_RIGHT == knobPosition || Pos.TOP_RIGHT == knobPosition ? 0 : -scaledSize * 0.475; offsetY = Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.475 : 0; listSize = areas.size(); for (int i = 0 ; i < listSize ; i++) { Section area = areas.get(i); double areaStartAngle; if (Double.compare(area.getStart(), maxValue) <= 0 && Double.compare(area.getStop(), minValue) >= 0) { if (area.getStart() < minValue && area.getStop() < maxValue) { areaStartAngle = 0; } else { areaStartAngle = ScaleDirection.CLOCKWISE == scaleDirection ? (area.getStart() - minValue) * angleStep : -(area.getStart() - minValue) * angleStep; } double areaAngleExtend; if (area.getStop() > maxValue) { areaAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (maxValue - area.getStart()) * angleStep : -(maxValue - area.getStart()) * angleStep; } else if (Double.compare(area.getStart(), minValue) < 0) { areaAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (area.getStop() - minValue) * angleStep : -(area.getStop() - minValue) * angleStep; } else { areaAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (area.getStop() - area.getStart()) * angleStep : -(area.getStop() - area.getStart()) * angleStep; } CTX.save(); if (highlightAreas) { CTX.setFill(area.contains(value) ? area.getHighlightColor() : area.getColor()); } else { CTX.setFill(area.getColor()); } CTX.fillArc(xy + offsetX, xy + offsetY, wh, wh, -(offset + areaStartAngle), - areaAngleExtend, ArcType.ROUND); CTX.restore(); } } } // Draw Sections if (sectionsVisible && !sections.isEmpty()) { xy = TickLabelLocation.OUTSIDE == tickLabelLocation ? 0.11675 * scaledSize : 0.03265 * scaledSize; wh = TickLabelLocation.OUTSIDE == tickLabelLocation ? scaledSize * 0.7745 : scaledSize * 0.935; offsetX = TickLabelLocation.OUTSIDE == tickLabelLocation ? ( Pos.BOTTOM_RIGHT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.0045 : -scaledSize * 0.4770 ) : ( Pos.BOTTOM_RIGHT == knobPosition || Pos.TOP_RIGHT == knobPosition ? 0 : -scaledSize * 0.4738 ); offsetY = TickLabelLocation.OUTSIDE == tickLabelLocation ? ( Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.4770 : -scaledSize * 0.0045 ) : ( Pos.TOP_LEFT == knobPosition || Pos.TOP_RIGHT == knobPosition ? -scaledSize * 0.4738 : 0 ); listSize = sections.size(); CTX.setLineWidth(scaledSize * 0.04); CTX.setLineCap(StrokeLineCap.BUTT); for (int i = 0; i < listSize; i++) { Section section = sections.get(i); double sectionStartAngle; if (Double.compare(section.getStart(), maxValue) <= 0 && Double.compare(section.getStop(), minValue) >= 0) { if (Double.compare(section.getStart(), minValue) < 0 && Double.compare(section.getStop(), maxValue) < 0) { sectionStartAngle = 0; } else { sectionStartAngle = ScaleDirection.CLOCKWISE == scaleDirection ? (section.getStart() - minValue) * angleStep : -(section.getStart() - minValue) * angleStep; } double sectionAngleExtend; if (Double.compare(section.getStop(), maxValue) > 0) { sectionAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (maxValue - section.getStart()) * angleStep : -(maxValue - section.getStart()) * angleStep; } else if (Double.compare(section.getStart(), minValue) < 0) { sectionAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (section.getStop() - minValue) * angleStep : -(section.getStop() - minValue) * angleStep; } else { sectionAngleExtend = ScaleDirection.CLOCKWISE == scaleDirection ? (section.getStop() - section.getStart()) * angleStep : -(section.getStop() - section.getStart()) * angleStep; } CTX.save(); if (highlightSections) { CTX.setStroke(section.contains(value) ? section.getHighlightColor() : section.getColor()); } else { CTX.setStroke(section.getColor()); } CTX.strokeArc(xy + offsetX, xy + offsetY, wh, wh, -(offset + sectionStartAngle), -sectionAngleExtend, ArcType.OPEN); CTX.restore(); } } } }