# Processing 3 Object Class not Being Displayed

**URL:** <https://discourse.processing.org/t/processing-3-object-class-not-being-displayed/33508>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 14, 2021, 6:01pm UTC](https://discourse.processing.org/t/processing-3-object-class-not-being-displayed/33508 "2021-11-14T18:01:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebest\_design](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@sebest\_design](https://discourse.processing.org/u/sebest_design)\
**Post date:** [November 14, 2021, 6:01pm UTC](https://discourse.processing.org/t/processing-3-object-class-not-being-displayed/33508/1 "2021-11-14T18:01:19Z")

</div>

Hi. I am a total noob to object classes. I do not know what I am doing wrong. Here’s an image of the prototype:

 ![prototype object class](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/3dd5eaf0cfea2508d9e8b75b56b81035255d34a8.jpeg)  
I am trying to create an object class for the encircled cards.  
I have saved the class on a separate page.  
I don’t know which piece of code is causing the problem in this case. The main page or the class page.  
Here’s the main code where I call the function:

```auto
void setup() { 
  size(1200, 750); 
  background(bg);
  montserratExtraBold = createFont("montserratExtraBold.ttf", headingSize);
  montserratRegular = createFont("montserratRegular.ttf", callToActionSize);
  
  y1 = new Timeline_Years();
  y1.display();
}

```

Here’s the code for the class

```auto
 //constructor
  Timeline_Years(){
    //text
    yearOriginX = 132;
    yearOriginY = 171;    
    year = "1900";
    yearColor = #FEFEFE;
    //background   
    boxOriginX = 163;
    boxOriginY = 124;
    boxColor = #ffffff;
    boxWidth = 74;
    boxHeight = 45;
  }
  
  //functions
  void display(){
    //bg
    fill(boxColor);
    rect(boxOriginX, boxOriginY, boxWidth, boxHeight);
    
    //text
    int yearSize;
    yearSize = 20;
    PFont montserratBold;
    montserratBold = createFont("montserratBold.ttf", yearSize);
    fill(yearColor);
    textFont(montserratBold);
    text(year, yearOriginX, yearOriginY);    
  }
}

```

Here’s a link to the zipped version of the file in case that helps:

> **[v8.zip](https://drive.google.com/file/d/1pWZffwznf9N0ZixureCD8lEWf6zrhDAB/view?usp=sharing)**
>
> Google Drive file.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 14, 2021, 8:22pm UTC](https://discourse.processing.org/t/processing-3-object-class-not-being-displayed/33508/2 "2021-11-14T20:22:51Z")

</div>

You don’t describe what you see (falsely) and what you want to see happening instead

Your screen shot is good but does it show your current false version or what you want to see instead?

When your class represents ONE time card you should define in setup () an Array of that class

And year should be different for each object in the Array

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 14, 2021, 9:49pm UTC](https://discourse.processing.org/t/processing-3-object-class-not-being-displayed/33508/3 "2021-11-14T21:49:55Z")

</div>

> [@sebest\_design](#):
>
> ` y1.display();`

This should be in draw()

Doesn’t the rectangle appear or the text in it or both??

Don’t repeat the textfont stuff in display() you defined in setup globally, so don’t repeat this variable in the class
