Skip to content
Snippets Groups Projects
Commit e6fa90b4 authored by dlw-9ak-u1's avatar dlw-9ak-u1
Browse files

Add new file

parent 2392c16b
No related branches found
No related tags found
No related merge requests found
import java.io.FileNotFoundException;
import javafx.geometry.Pos;
import javafx.scene.effect.GaussianBlur;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
public class MenuItem extends HBox {
private static final Font FONT = Font.font("", FontWeight.BOLD, 18);
private Cursor cr1 = new Cursor(),cr2 = new Cursor();;
private Text text;
private Runnable function;
public MenuItem(String name) throws FileNotFoundException {
super(10);
setAlignment(Pos.CENTER);
text = new Text(name);
text.setFont(FONT);
text.setEffect(new GaussianBlur(2));
getChildren().addAll(cr1, text, cr2);
setActive(false);
}
public void setActive(boolean b) {
cr1.setVisible(b);
cr2.setVisible(b);
text.setFill(b ? Color.WHITE : Color.GREEN);
}
public void setOnActivate(Runnable r) {
function = r;
}
public void activate() {
if (function != null)
function.run();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment