/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaapplication10; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.ListView; import javafx.scene.paint.Color; import javafx.scene.shape.Line; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; /** * * @author akirov */ public class JavaApplication10 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { ListView lv = new ListView(); lv.setMinSize(150, 150); lv.setMaxSize(150, 150); lv.getItems().add(createCustomContent(200, 200)); Scene scene = new Scene(lv, 200, 200); stage.setScene(scene); stage.show(); } public static Group createCustomContent(int height, int width) { Group res = new Group(); Rectangle r = new Rectangle(); r.setStroke(Color.BLACK); r.setStyle("-fx-border-color: GREEN;"); res.getChildren().add(r); for (int i = 10; i < height; i += 10) { Line line1 = new Line(0, i, i - 5, i); Line line2 = new Line(i, 0, i, i - 5); Line line3 = new Line(i - 5, i, i - 5, height); Line line4 = new Line(i, i - 5, width, i - 5); line1.setStroke(Color.RED); line2.setStroke(Color.YELLOW); line3.setStroke(Color.BLUE); line4.setStroke(Color.MAGENTA); res.getChildren().addAll(line1, line2, line3, line4); } Rectangle rec = new Rectangle(0, 0, width, height); rec.setFill(Color.TRANSPARENT); rec.setStroke(Color.RED); res.getChildren().add(rec); return res; } }