LedBarGraph not scaling in container

Create issue
Issue #9 resolved
Patrick Kutch created an issue

Not sure how to phrase it, but when I put these in a grid pane ugly things happen. Here is a modified version of your demo code that clearly shows the problem.

/ * Copyright (c) 2013 by Gerrit Grunwald * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */

package eu.hansolo.enzo.ledbargraph;

import eu.hansolo.enzo.led.Led; import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.collections.ObservableList; import javafx.geometry.Orientation; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage;

import java.util.Random; import static javafx.application.Application.launch; import javafx.scene.layout.GridPane;

/* * Created by * User: hansolo * Date: 19.11.12 * Time: 04:02 / public class MyDemo extends Application { private static int noOfNodes = 0; private static final Random RND = new Random(); private LedBargraph control,control1,control2; private long lastTimerCall; private AnimationTimer timer;

@Override public void init() {
    control = LedBargraphBuilder.create()

    control1 = new LedBargraph();

    lastTimerCall = System.nanoTime();
    timer = new AnimationTimer() {
        @Override public void handle(final long NOW) {
            if (NOW > lastTimerCall + 100_000_000l) {
                lastTimerCall = NOW;

@Override public void start(Stage stage) {
    GridPane  pane = new GridPane();

// StackPane pane = new StackPane();

// pane.getChildren().setAll(control); pane.add(control,0,0); pane.add(control1,1,1);

    Scene scene = new Scene(pane, 400, 400, Color.rgb(0, 0, 0, 0.8));

    stage.setTitle("Led Bargraph demo0000");


    System.out.println(noOfNodes + " Nodes in SceneGraph");

@Override public void stop() {


public static void main(String[] args) {

// ******************** Misc **********************************************
private static void calcNoOfNodes(Node node) {
    if (node instanceof Parent) {
        if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
            ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
            noOfNodes += tempChildren.size();
            for (Node n : tempChildren) {


Comments (2)

  1. Gerrit Grunwald repo owner

    The problem seems to be fixed (not sure what ugly things really means). Please put a more detailled problem description in next time, otherwise I have to guess what you mean.

  2. Log in to comment