本文整理汇总了Java中eu.hansolo.medusa.GaugeBuilder类的典型用法代码示例。如果您正苦于以下问题:Java GaugeBuilder类的具体用法?Java GaugeBuilder怎么用?Java GaugeBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GaugeBuilder类属于eu.hansolo.medusa包,在下文中一共展示了GaugeBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: QualityGauge
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
public QualityGauge() {
aspectRatio = PREFERRED_HEIGHT / PREFERRED_WIDTH;
backgroundPaint = Color.TRANSPARENT;
borderPaint = Color.TRANSPARENT;
borderWidth = 0d;
model = GaugeBuilder.create()
.minValue(0)
.maxValue(10)
.startAngle(0)
.angleRange(180)
.sectionsVisible(true)
.sections(NORMAL_ORDER)
.build();
reverseOrder = new BooleanPropertyBase(false) {
@Override protected void invalidated() { model.setSections(get() ? REVERSE_ORDER : NORMAL_ORDER); }
@Override public Object getBean() { return QualityGauge.this; }
@Override public String getName() { return "reverseOrder"; }
};
setAlignment(Pos.TOP_CENTER);
init();
initGraphics();
registerListeners();
}
示例2: init
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
@Override public void init() {
gauge = GaugeBuilder.create()
.prefSize(250, 250)
.minValue(0)
.maxValue(100)
.animated(false)
.title("Title")
.unit("\u00B0C")
.subTitle("SubTitle")
.interactive(true)
.onButtonPressed(o -> System.out.println("Button pressed"))
.title("Title")
.sections(new Section(0, 33, Color.RED),
new Section(33, 66, Color.YELLOW),
new Section(66, 100, Color.LIME))
.sectionsVisible(true)
.build();
gauge.setSkin(new InteractiveGaugeSkin(gauge));
}
示例3: createBar
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
private Gauge createBar() {
Gauge gauge = GaugeBuilder.create()
.backgroundPaint(Gauge.DARK_COLOR)
.barBackgroundColor(Color.DARKRED)
.barColor(Color.RED)
.minValue(0)
.maxValue(100)
.sectionsVisible(true)
.sections(new Section(0, 70, Color.LIME),
new Section(70,85, Color.YELLOW),
new Section(85, 100, Color.RED))
.build();
gauge.setSkin(new CustomGaugeSkin(gauge));
return gauge;
}
示例4: QualityGauge
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
public QualityGauge() {
aspectRatio = PREFERRED_HEIGHT / PREFERRED_WIDTH;
backgroundPaint = Color.TRANSPARENT;
borderPaint = Color.TRANSPARENT;
borderWidth = 0d;
model = GaugeBuilder.create()
.minValue(0)
.maxValue(10)
.startAngle(0)
.angleRange(180)
.sectionsVisible(true)
.sections(NORMAL_ORDER)
.build();
reverseOrder = new BooleanPropertyBase(false) {
@Override protected void invalidated() { model.setSections(get() ? REVERSE_ORDER : NORMAL_ORDER); }
@Override public Object getBean() { return QualityGauge.this; }
@Override public String getName() { return "reverseOrder"; }
};
init();
initGraphics();
registerListeners();
}
示例5: createJFXNode
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
protected Gauge createJFXNode ( Gauge.SkinType skin ) throws Exception {
return GaugeBuilder.create()
.skinType(skin)
.prefHeight(model_widget.propHeight().getValue())
.prefWidth(model_widget.propWidth().getValue())
//--------------------------------------------------------
// Previous properties must be set first.
//--------------------------------------------------------
.animated(false)
.checkAreasForValue(false)
.checkSectionsForValue(false)
.checkThreshold(false)
.highlightAreas(false)
.innerShadowEnabled(false)
.interactive(false)
.ledVisible(false)
.returnToZero(false)
.sectionIconsVisible(false)
.sectionTextVisible(false)
.build();
}
示例6: newGauge
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
/**
* Generates a new Medusa Gauge for showing a clustering accuracy metric
*
* @param title Title of gauge
* @return Gauge
*/
private Gauge newGauge(String title) {
return GaugeBuilder.create()
.skinType(SkinType.HORIZONTAL)
.minValue(0.0)
.maxValue(1.0)
.tickLabelDecimals(1)
.title(title)
.decimals(3)
.animated(true)
.animationDuration(1500)
.build();
}
示例7: createGaugeLocalized
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
/**
*
* @param title
* @param unit
* @return
*/
public static Gauge createGaugeLocalized(String title, String unit,
boolean resetAble) {
Gauge gauge = null;
if (resetAble)
gauge = new ResetableGauge(title, unit);
else
gauge = GaugeBuilder.create().skinType(SkinType.LCD)
.oldValueVisible(false).maxMeasuredValueVisible(false)
.minMeasuredValueVisible(false).decimals(0).tickLabelDecimals(0)
.title(title).unit(unit).lcdDesign(lcdDesign).lcdFont(lcdFont)
.build();
return gauge;
}
示例8: ChargePane
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
/**
* charging info
*/
public ChargePane() {
Gauge socGauge = GaugeBuilder.create().skinType(SkinType.BATTERY).title("SOC")
.titleColor(Color.WHITE).animated(true).gradientBarEnabled(true)
.minValue(0)
.maxValue(100)
.tickLabelDecimals(1)
.decimals(1)
//.title(I18n.get(I18n.SOC))
.titleColor(Color.WHITE)
.gradientBarStops(new Stop(0.0, Color.RED),
new Stop(0.25, Color.ORANGE), new Stop(0.50, Color.YELLOW),
new Stop(0.75, Color.YELLOWGREEN), new Stop(1.0, Color.LIME))
.build();
super.addGauge("SOC",socGauge,0,0);
super.addGauge("Range",I18n.RR,I18n.KM,1,0).setDecimals(1);
super.addGauge("BatteryCapacity", I18n.BATTERY_CAPACITY,I18n.AH, 2,0).setDecimals(1);
super.addGauge("ACPower",I18n.AC_POWER,I18n.K_WATT,0,1).setDecimals(1);
super.addGauge("ACVolts",I18n.AC_VOLTS,I18n.VOLTS,1,1);
super.addGauge("ACAmps",I18n.AC_AMPS,I18n.AMPS,2,1).setDecimals(1);;
super.addGauge("DCPower",I18n.DC_POWER,I18n.K_WATT,0,2).setDecimals(1);
super.addGauge("DCVolts",I18n.DC_VOLTS,I18n.VOLTS,1,2);
super.addGauge("DCAmps",I18n.DC_AMPS,I18n.AMPS,2,2).setDecimals(1);;
this.fixColumnSizes(4, 33,33,33);
this.fixRowSizes(4, 33,33,33);
}
示例9: testGauge
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的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();
}
}
示例10: SimpleSectionGauge
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
public SimpleSectionGauge(final String TITLE, final String UNIT,
final double MIN_VALUE, final double MAX_VALUE,
final Color BAR_COLOR, final Color BAR_BACKGROUND_COLOR,
final boolean SECTIONS_VISIBLE, final Section... SECTIONS) {
backgroundPaint = Color.TRANSPARENT;
borderPaint = Color.TRANSPARENT;
borderWidth = 0d;
model = GaugeBuilder.create()
.minValue(MIN_VALUE)
.maxValue(MAX_VALUE)
.title(TITLE)
.unit(UNIT)
.barBackgroundColor(BAR_BACKGROUND_COLOR)
.barColor(BAR_COLOR)
.animated(true)
.startAngle(150)
.angleRange(300)
.sectionsVisible(SECTIONS_VISIBLE)
.build();
if (null != SECTIONS) {
model.setSections(SECTIONS);
sections = model.getSections();
} else {
sections = new ArrayList<>();
}
sectionsVisible = model.getSectionsVisible();
formatString = new StringBuilder("%.").append(Integer.toString(model.getDecimals())).append("f").toString();
init();
initGraphics();
registerListeners();
}
示例11: init
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
@Override public void init() {
fuelIcon = new Region();
fuelIcon.getStyleClass().setAll("fuel-icon");
gauge = GaugeBuilder.create()
.skinType(SkinType.HORIZONTAL)
.prefSize(500, 250)
.knobColor(Color.rgb(0, 0, 0))
.foregroundBaseColor(Color.rgb(249, 249, 249))
.animated(true)
.shadowsEnabled(true)
.valueVisible(false)
//.title("FUEL")
.needleColor(Color.rgb(255, 10, 1))
.needleShape(NeedleShape.ROUND)
.needleSize(NeedleSize.THICK)
.minorTickMarksVisible(false)
.mediumTickMarksVisible(false)
//.majorTickMarkType(TickMarkType.TRIANGLE)
.sectionsVisible(true)
.sections(new Section(0, 0.2, Color.rgb(255, 10, 1)))
.minValue(0)
.maxValue(1)
.angleRange(90)
.customTickLabelsEnabled(true)
.customTickLabels("E", "", "", "", "", "1/2", "", "", "", "", "F")
.build();
pane = new StackPane(fuelIcon, gauge);
pane.setPadding(new Insets(10));
LinearGradient gradient = new LinearGradient(0, 0, 0, pane.getLayoutBounds().getHeight(),
false, CycleMethod.NO_CYCLE,
new Stop(0.0, Color.rgb(38, 38, 38)),
new Stop(1.0, Color.rgb(15, 15, 15)));
pane.setBackground(new Background(new BackgroundFill(gradient, CornerRadii.EMPTY, Insets.EMPTY)));
}
示例12: init
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
@Override public void init() {
GaugeBuilder builder = GaugeBuilder.create()
.skinType(SkinType.SLIM)
.barBackgroundColor(MaterialDesign.GREY_800.get())
.animated(true)
.animationDuration(1000);
steps = builder.decimals(0).maxValue(10000).unit("STEPS").build();
distance = builder.decimals(2).maxValue(10).unit("KM").build();
actvCalories = builder.decimals(0).maxValue(2200).unit("KCAL").build();
foodCalories = builder.decimals(0).maxValue(2200).unit("KCAL").build();
weight = builder.decimals(1).maxValue(85).unit("KG").build();
bodyFat = builder.decimals(1).maxValue(20).unit("%").build();
VBox stepsBox = getVBox("STEPS", MaterialDesign.CYAN_300.get(), steps);
VBox distanceBox = getVBox("DISTANCE", MaterialDesign.ORANGE_300.get(), distance);
VBox actvCaloriesBox = getVBox("ACTIVE CALORIES", MaterialDesign.RED_300.get(), actvCalories);
VBox foodCaloriesBox = getVBox("FOOD", MaterialDesign.GREEN_300.get(), foodCalories);
VBox weightBox = getVBox("WEIGHT", MaterialDesign.DEEP_PURPLE_300.get(), weight);
VBox bodyFatBox = getVBox("BODY FAT", MaterialDesign.PURPLE_300.get(), bodyFat);
pane = new GridPane();
pane.setPadding(new Insets(20));
pane.setHgap(10);
pane.setVgap(15);
pane.setBackground(new Background(new BackgroundFill(MaterialDesign.GREY_900.get(), CornerRadii.EMPTY, Insets.EMPTY)));
pane.add(stepsBox, 0, 0);
pane.add(distanceBox, 1, 0);
pane.add(actvCaloriesBox, 0, 2);
pane.add(foodCaloriesBox, 1, 2);
pane.add(weightBox, 0, 4);
pane.add(bodyFatBox, 1, 4);
}
示例13: getBulletChart
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
private Gauge getBulletChart(final String TITLE, final String UNIT,
final double MAX_VALUE, final double THRESHOLD,
final Section... SECTIONS) {
return GaugeBuilder.create()
.skinType(SkinType.BULLET_CHART)
.animated(true)
.thresholdColor(GRAY)
.title(TITLE)
.unit(UNIT)
.maxValue(MAX_VALUE)
.threshold(THRESHOLD)
.sectionsVisible(true)
.sections(SECTIONS)
.build();
}
示例14: init
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
@Override public void init() {
GaugeBuilder builder = GaugeBuilder.create()
.skinType(SkinType.INDICATOR)
.prefWidth(150)
.animated(true)
.decimals(0)
.sectionsVisible(true)
.sections(new Section(0, 33, Color.rgb(34, 180, 11)),
new Section(33, 66, Color.rgb(255, 146, 0)),
new Section(66, 100, Color.rgb(255, 0, 39)));
ragweed = builder.build();
birch = builder.build();
grass = builder.build();
olive = builder.build();
combined = builder.build();
HBox ragweedBox = getHBox("RAGWEED", ragweed);
HBox birchBox = getHBox("BIRCH", birch);
HBox grassBox = getHBox("GRASS", grass);
HBox oliveBox = getHBox("OLIVE", olive);
HBox combinedBox = getHBox("COMBINED", combined);
pane = new VBox(ragweedBox, new Separator(Orientation.HORIZONTAL),
birchBox, new Separator(Orientation.HORIZONTAL),
grassBox, new Separator(Orientation.HORIZONTAL),
oliveBox, new Separator(Orientation.HORIZONTAL),
combinedBox);
pane.setPadding(new Insets(20, 20, 0, 20));
pane.setSpacing(10);
pane.setBackground(new Background(new BackgroundFill(Color.rgb(242, 242, 242), CornerRadii.EMPTY, Insets.EMPTY)));
}
示例15: createGauge
import eu.hansolo.medusa.GaugeBuilder; //导入依赖的package包/类
private Gauge createGauge(final double TARGET, final Color COLOR) {
return GaugeBuilder.create()
.animated(true)
.animationDuration(1000)
.minValue(0)
.maxValue(TARGET)
.gradientBarEnabled(true)
.gradientBarStops(new Stop(0.0, COLOR),
new Stop(0.01, COLOR),
new Stop(0.75, COLOR.deriveColor(-10, 1, 1, 1)),
new Stop(1.0, COLOR.deriveColor(-20, 1, 1, 1)))
.barColor(COLOR)
.build();
}