public void run() {
    Panel panel = new Panel();
    panel.add(
        new Node() {

          @Override
          public void draw(GFX g) {
            doDraw(g, this);
          }

          @Override
          public Bounds getVisualBounds() {
            return new Bounds(0, 0, 300, 300);
          }

          @Override
          public Bounds getInputBounds() {
            return getVisualBounds();
          }
        });

    font = Font.name("League Gothic").size(120).resolve();
    font2 = Font.name("League Gothic").size(60).resolve();
    try {
      image = Image.create(ImageIO.read(Presentation.class.getResource("Test01.png")));
    } catch (IOException e) {
      e.printStackTrace(); // To change body of catch statement use File | Settings | File
      // Templates.
    }

    Stage stage = Stage.createStage();
    stage.setContent(panel);
    stage.setWidth(1024);
    stage.setHeight(768);
  }
Example #2
0
 @Override
 public void doPrefLayout() {
   setWidth(image.getWidth());
   setHeight(image.getHeight());
 }
Example #3
0
 public ImageBox setImage(URL resource) throws IOException {
   image = Image.getImageFromCache(resource);
   return this;
 }