本文整理汇总了Java中eu.hansolo.medusa.GaugeDesign.GaugeBackground类的典型用法代码示例。如果您正苦于以下问题:Java GaugeBackground类的具体用法?Java GaugeBackground怎么用?Java GaugeBackground使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GaugeBackground类属于eu.hansolo.medusa.GaugeDesign包,在下文中一共展示了GaugeBackground类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FGauge
import eu.hansolo.medusa.GaugeDesign.GaugeBackground; //导入依赖的package包/类
public FGauge(final Gauge GAUGE, final GaugeDesign DESIGN, final GaugeBackground BACKGROUND) {
getStylesheets().add(getClass().getResource("framed-gauge.css").toExternalForm());
getStyleClass().setAll("framed-gauge");
gauge = GAUGE;
gaugeDesign = DESIGN;
gaugeBackground = BACKGROUND;
Skin skin = gauge.getSkin();
if (null != skin && gauge.getSkin().getClass() != GaugeSkin.class) {
throw new RuntimeException("Please change Skin to GaugeSkin.");
}
init();
initGraphics();
registerListeners();
}
示例2: testGauge
import eu.hansolo.medusa.GaugeDesign.GaugeBackground; //导入依赖的package包/类
@Test
public void testGauge() throws InterruptedException {
GridPane pane = new GridPane();
Gauge gauge = GaugeBuilder.create().minValue(0).maxValue(100)
.tickLabelDecimals(0).decimals(1).autoScale(true).animated(true)
// .backgroundPaint(Color.TRANSPARENT)
// .borderPaint(Color.LIGHTGRAY)
// .knobColor(Color.rgb(0, 90, 120))
.shadowsEnabled(true)
// .tickLabelColor(Color.rgb(0, 175, 248))
// .ledColor(Color.rgb(0, 175, 248))
.ledVisible(true).ledBlinking(true).sectionsVisible(true)
.sections(new Section(75, 100, Color.rgb(139, 195, 102, 0.5)))
.areasVisible(true)
.areas(new Section(0.00, 25, Color.rgb(234, 83, 79, 0.5)))
.majorTickMarkColor(Color.MAGENTA)
// .minorTickMarkColor(Color.rgb(0, 175, 248))
.majorTickMarkType(TickMarkType.TRAPEZOID)
.mediumTickMarkType(TickMarkType.DOT)
.minorTickMarkType(TickMarkType.LINE)
.tickLabelOrientation(TickLabelOrientation.ORTHOGONAL)
.tickMarkSections(new Section(0.25, 0.5, Color.rgb(241, 161, 71)))
.tickMarkSectionsVisible(true)
.markers(new Marker(0.5, "", Color.CYAN, MarkerType.TRIANGLE))
.markersVisible(true)
// .majorTickMarksVisible(true)
// .minorTickMarksVisible(true)
.tickLabelLocation(TickLabelLocation.INSIDE)
// .tickLabelsVisible(true)
.tickLabelSections(new Section(0.1, 0.3, Color.rgb(0, 175, 248)))
// .tickLabelSectionsVisible(true)
.title("SOC")
// .titleColor(Color.rgb(223, 223, 223))
.unit("%").lcdDesign(LcdDesign.SECTIONS).lcdVisible(true)
.lcdFont(LcdFont.STANDARD)
// .unitColor(Color.rgb(223, 223, 223))
// .valueColor(Color.rgb(223, 223, 223))
.needleSize(NeedleSize.THICK).build();
FGauge framedGauge = new FGauge(gauge, GaugeDesign.ENZO,
GaugeBackground.DARK_GRAY);
pane.add(framedGauge, 0, 0);
DoubleProperty dproperty = new SimpleDoubleProperty(85.0);
SampleApp sampleApp = new SampleApp("Gauge", pane, 67, 2, 2);
sampleApp.show();
sampleApp.waitOpen();
Stage stage = sampleApp.getStage();
framedGauge.prefWidthProperty().bind(stage.widthProperty());
framedGauge.prefHeightProperty().bind(stage.heightProperty());
gauge.valueProperty().bind(dproperty);
while (stage.isShowing()) {
Thread.sleep(15);
Platform.runLater(() -> dproperty.setValue(dproperty.getValue() - 0.1));
if (dproperty.getValue() < 45)
sampleApp.close();
}
}
示例3: DashBoardPane
import eu.hansolo.medusa.GaugeDesign.GaugeBackground; //导入依赖的package包/类
/**
* create a DashBoardPane
*
* @param maxValue
*/
public DashBoardPane(Vehicle vehicle) {
// LcdFont lcdFont=LcdFont.STANDARD;
// LcdDesign lcdDesign=LcdDesign.SECTIONS;
if (vehicle != null) {
rpmGauge = GaugeBuilder.create().minValue(0)
// FIXME use value from Vehicle definition
.maxValue(vehicle.getMaxRPM()).tickLabelDecimals(0).decimals(0)
.autoScale(true).animated(true).shadowsEnabled(true)
.sectionsVisible(true)
// FIXME use value form Vehicle definition
.sections(new Section(vehicle.getMaxRPM() * 80 / 100,
vehicle.getMaxRPM(), Color.rgb(195, 139, 102, 0.5)))
.majorTickMarkColor(Color.rgb(241, 161, 71))
// .minorTickMarkColor(Color.rgb(0, 175, 248))
.majorTickMarkType(TickMarkType.TRAPEZOID)
.mediumTickMarkType(TickMarkType.DOT)
.minorTickMarkType(TickMarkType.LINE)
.tickLabelLocation(TickLabelLocation.INSIDE)
.title(I18n.get(I18n.REV_COUNT)).unit(I18n.get(I18n.RPM))
.lcdDesign(LcdGauge.lcdDesign).lcdVisible(true)
.lcdFont(LcdGauge.lcdFont).needleSize(NeedleSize.THICK).build();
rpmSpeedGauge = GaugeBuilder.create().minValue(0)
.maxValue(vehicle.getMaxSpeed()).tickLabelDecimals(0).decimals(1)
.autoScale(true).animated(true).shadowsEnabled(true)
.sectionsVisible(true)
.sections(new Section(vehicle.getMaxSpeed() / 1.4,
vehicle.getMaxSpeed(), Color.rgb(195, 139, 102, 0.5)))
.majorTickMarkColor(Color.rgb(241, 161, 71))
// .minorTickMarkColor(Color.rgb(0, 175, 248))
.majorTickMarkType(TickMarkType.TRAPEZOID)
.mediumTickMarkType(TickMarkType.DOT)
.minorTickMarkType(TickMarkType.LINE)
.tickLabelLocation(TickLabelLocation.INSIDE)
.title(I18n.get(I18n.RPM_SPEED)).unit("km/h")
.lcdDesign(LcdGauge.lcdDesign).lcdVisible(true)
.lcdFont(LcdGauge.lcdFont).needleSize(NeedleSize.THICK).build();
rpmMax = new ResetableGauge(I18n.get(I18n.RPM_MAX), I18n.get(I18n.RPM));
rpmAvg = new ResetableGauge(I18n.get(I18n.RPM_AVG), I18n.get(I18n.RPM));
// FIXME translate km/h? or allow miles/hour?
rpmSpeedMax = new ResetableGauge(I18n.get(I18n.RPM_SPEED_MAX),
I18n.get(I18n.KMH));
rpmSpeedAvg = new ResetableGauge(I18n.get(I18n.RPM_SPEED_AVG),
I18n.get(I18n.KMH));
framedRPMGauge = new FGauge(rpmGauge, GaugeDesign.ENZO,
GaugeBackground.DARK_GRAY);
this.add(framedRPMGauge, 0, 0);
GridPane rpmPane = new GridPane();
rpmPane.add(rpmMax, 0, 0);
rpmPane.add(rpmAvg, 1, 0);
rpmPane.setAlignment(Pos.CENTER);
this.add(rpmPane, 0, 1);
framedRPMSpeedGauge = new FGauge(rpmSpeedGauge, GaugeDesign.ENZO,
GaugeBackground.DARK_GRAY);
this.add(framedRPMSpeedGauge, 1, 0);
GridPane rpmSpeedPane = new GridPane();
rpmSpeedPane.add(rpmSpeedMax, 0, 0);
rpmSpeedPane.add(rpmSpeedAvg, 1, 0);
rpmSpeedPane.setAlignment(Pos.CENTER);
this.add(rpmSpeedPane, 1, 1);
// 75= 80 - 5% (5% for extra gap)
fixRowSizes(6, 87, 13);
fixColumnSizes(4, 50, 50);
} else {
LOGGER.log(Level.WARNING,"Vehicle is null for DashBaordPane");
}
}
示例4: gaugeBackground
import eu.hansolo.medusa.GaugeDesign.GaugeBackground; //导入依赖的package包/类
public final B gaugeBackground(final GaugeBackground BACKGROUND) {
properties.put("gaugeBackground", new SimpleObjectProperty<>(BACKGROUND));
return (B)this;
}
示例5: setGaugeBackground
import eu.hansolo.medusa.GaugeDesign.GaugeBackground; //导入依赖的package包/类
public void setGaugeBackground(final GaugeBackground BACKGROUND) {
gaugeBackground = BACKGROUND;
redraw();
}
示例6: getGaugeBackground
import eu.hansolo.medusa.GaugeDesign.GaugeBackground; //导入依赖的package包/类
public GaugeBackground getGaugeBackground() { return gaugeBackground; }