Posted in Java, JavaFX

Font Picker


Font picker javafx custom control. You can access code here github

font-picker

Advertisements
Posted in JavaFX

OfficeSilver skin for JavaFX


Another skin for javaFX this time it is OfficeSilver skin. You can see this skin in action on youtube. Here are some of the screen shots
1
2
3
4
5
6
In next blog post i will provide you download link for this skin plus detail states with pictures of all controls stay tuned.

Posted in JavaFX

MistSilver skin for JavaFX


New skin for JavaFX inspired from one of substance look and feel for Swing. Color scheme which i used from substance skin is SubstanceMistSilver. You can watch it on youtube. Here are some of the screen shots
1
234
5
I haven’t tested this skin on javaFX 8 it might not work correctly because of many significant changes coming in javaFX 8. Anyhow join me on github you can download skin from there.

Posted in JavaFX

Dark scrollbar skin for javafx


New scrollbar skin for javaFX
scrollbar
 
Here is css code for this skin

/****************************************************************

  ScrollBar Skin  

****************************************************************/
.scroll-bar{
 -fx-background-color: rgb(96,96,96);
 -fx-background-radius: 2em;
}
.scroll-bar:horizontal .track,
.scroll-bar:vertical .track {
 -fx-background-color: transparent;
 -fx-border-color:transparent;
 -fx-background-radius: 2em;
}
.scroll-bar:vertical .track-background,
.scroll-bar:horizontal .track-background {
 -fx-background-color: transparent;
 -fx-background-insets: 0;
 -fx-background-radius: 2em;
}
.scroll-bar:horizontal .thumb {
 -fx-background-color: rgb(211,211,211);
 -fx-background-insets: 4 0 4 0;
 -fx-background-radius: 2em;
}
.scroll-bar:vertical .thumb {
 -fx-background-color: rgb(211,211,211);
 -fx-background-insets: 0 4 0 4;
 -fx-background-radius: 2em;
}
.scroll-bar:horizontal .thumb:hover,
.scroll-bar:vertical .thumb:hover {
 -fx-background-color: rgb(231,231,231);
}
.scroll-bar:horizontal .thumb:pressed,
.scroll-bar:vertical .thumb:pressed {
 -fx-background-color: rgb(255,255,255);
}
.scroll-bar:vertical .increment-button, .scroll-bar:vertical .decrement-button {
 -fx-background-color:transparent;
 -fx-background-radius: 2em;
 -fx-padding: 5;
}
.scroll-bar:horizontal .increment-button, .scroll-bar:horizontal .decrement-button {
 -fx-background-color:transparent;
 -fx-background-radius: 2em;
 -fx-padding: 5;
}
.scroll-bar:horizontal .increment-arrow {
 -fx-shape: "M 0 0 L 4 8 L 8 0 Z";
 -fx-background-color: rgb(211,211,211);
 -fx-padding: 0.25em;
 -fx-rotate: -90;
}
.scroll-bar:vertical .increment-arrow {
 -fx-background-color: rgb(211,211,211);
 -fx-shape: "M 0 0 L 4 8 L 8 0 Z";
 -fx-padding: 0.25em;
 -fx-rotate: 0;
}
.scroll-bar:horizontal .decrement-arrow {
 -fx-background-color: rgb(211,211,211);
 -fx-shape: "M 0 0 L 4 8 L 8 0 Z";
 -fx-padding: 0.25em;
 -fx-rotate: 90;
}
.scroll-bar:vertical .decrement-arrow {
 -fx-background-color: rgb(211,211,211);
 -fx-shape: "M 0 0 L 4 8 L 8 0 Z";
 -fx-padding: 0.25em;
 -fx-rotate: -180;
}
.scroll-bar:vertical:focused,
.scroll-bar:horizontal:focused {
 -fx-background-color: transparent,rgb(96,96,96),rgb(96,96,96);
}
Posted in JavaFX

Location Crosshair


Location Crosshair is used in charts to show the current location of mouse in chart with moving lines. Here is screenshot of javafx program
crosshair
Source code of this program

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Line;
import javafx.stage.Stage;

public class LocationCrosshair extends Application {

public static void main(String[] args) {
 launch(args);
 }

 @Override
 public void start(Stage stage) {
 AnchorPane root = new AnchorPane();

 Pane crosshairArea = new Pane();
 crosshairArea.setPrefWidth(300);
 crosshairArea.setPrefHeight(300);
 crosshairArea.setTranslateX(20);
 crosshairArea.setTranslateY(20);
 crosshairArea.setStyle("-fx-border-color:black");
 crosshairArea.setCursor(Cursor.NONE);

 final Label label = new Label("");
 crosshairArea.getChildren().add(label);

 final Line horizontalLine = new Line(0,0,crosshairArea.getPrefWidth(),0);
 final Line verticalLine = new Line(0,0,0,crosshairArea.getPrefHeight());

 crosshairArea.getChildren().add(horizontalLine);
 crosshairArea.getChildren().add(verticalLine);

 crosshairArea.setOnMouseMoved(new EventHandler() {
 @Override
 public void handle(MouseEvent event) {
 label.setVisible(true);
 label.setText(" Location: "+event.getX()+", "+event.getY());

 horizontalLine.setStartY(event.getY());
 horizontalLine.setEndY(event.getY());

 verticalLine.setStartX(event.getX());
 verticalLine.setEndX(event.getX());

 }
 });
 crosshairArea.setOnMouseExited(new EventHandler() {
 @Override
 public void handle(MouseEvent event) {
 label.setVisible(false);
 }
 });
 root.getChildren().add(crosshairArea);

 Scene scene = new Scene(root);
 stage.setScene(scene);
 stage.setTitle("Location Crosshair");
 stage.setWidth(500);
 stage.setHeight(470);
 stage.show();
 }
}