Accessing processing data types from class of java package

I have learnt processing from The Coding Train. Recently I was working on some GUI functionality (i.e. Button, Slider, etc.) and thought to create a library. I know there are GUI library already exist, but I am doing for learning.
So I started to create a library in Eclipse by following The Coding Train’s video about same. I want to use processing data type color which is not part of java. I don’t know how to access such data types from core.jar. I have a confession, I don’t know much about java so if I’m asking something wrong, I am sorry.
Thank you.

Processing’s color datatype is merely an alias to Java’s int primitive datatype. :wink:

Processing’s hash # symbol like in #D000A0 is the same as Java’s 0xff: 0xffD000A0. :art:

I want a class variable for color of button, so what data type I need to define.

Just have an int field inside that class:

public class MyColor {
  public int c;

  public MyColor(final int cc) {
    c = cc;
  }
}

For a finer-grain control you can use Java’s bundled class Color:
docs.Oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Color.html

1 Like