Canvas always small in Java application

edited February 2016 in Questions about Code

Hi there,

I run a java application by Processing 3.0.1. It works well, but the canvas is ALWAYS small, about 100x100, no matter what the width and height are set in size();

Here is a sample:

package test;

import processing.core.PApplet;

public class SimpleProject extends PApplet {
    public void setting() {
        size(1024, 1024, P2D); // fullScreen() doesn't work either.
        smooth();
    }

    public void setup() {
        fill(255, 0, 0);
        rect(5, 5, 50, 50);
    }

    public static void main(String[] args) {
        PApplet.main(new String[] { "test.SimpleProject" });  // --present doesn't work either.

    }
}

System environment: Ubuntu 14.04 Eclipse Mars.1 Release (4.5.1) Processing 3.0.1 JavaSE-1.8

How could I make canvas as big as I set in size()?

Thank you!

Answers

  • edited February 2016 Answer ✓

    There's no setting() callback in Processing! I believe you're looking for settings() instead? ;)
    https://Processing.org/reference/settings_.html

    We can also annotate such inherited methods w/ @Override in order to avoid these types of mistake:

    @ Override void settings() {
      //size(displayWidth, displayHeight, FX2D);
      fullScreen(P2D, SPAN);
      smooth(4);
    }
    
Sign In or Register to comment.