Using ShadeDescriptor

tllcoolj

Member
Joined
Jun 13, 2019
Posts
11
Likes
3
I want to shade between 2 lines (Inputs.TOP_GUIDE and Inputs.TOP_GUIDE2) using the Constructor -

public ShadeDescriptor(String name, String [][] linePairs, Color color, boolean enabled, boolean supportsDisable)
How do I specify the parameter "String [][] linePairs"?

As you can tell, I am not a Java programmer as this may be a simple problem for an experienced Java coder.
A sample using this Constructor would be much appreciated. Thanks in advance for any suggestions you may provide.
 
  • Like
Reactions: lvm

Spin

Well-known member
Joined
May 22, 2019
Posts
474
Likes
189
Hi @tllcoolj.

I would advise you to look at the code of other Studies that use it. No need to reinvent hot water.

"MA Cross" is included in the SDK package. It's a simple Study that uses ShadeDescriptor.

You will have no trouble figuring it out :)
 

tllcoolj

Member
Joined
Jun 13, 2019
Posts
11
Likes
3
Thanks for the suggestion. However, I am trying to shade between 2 horizontal lines (ex. line1 and line 2) which is different than the example you referenced. These lines are "Inputs.TOP_GUIDE and Inputs.TOP_GUIDE2" whose Constructor is: public ShadeDescriptor(String name, String [][] linePairs, Color color, boolean enabled, boolean supportsDisable) as described in the SDK API for shading between 2 lines. I have coded it like this:

mfiShade.addRow(new ShadeDescriptor(Inputs.FILL2, get("Top Fill2"), new String[][] {{Inputs.TOP_GUIDE2},{Inputs.TOP_GUIDE}},
defaults.getFillColor(), true, true));

However, I get this error :-
error: no suitable constructor found for ShadeDescriptor(String,String,String[][],Color,boolean,boolean)
[javac] mfiShade.addRow(new ShadeDescriptor(Inputs.FILL2, get("Top Fill2"), new String[][] {{Inputs.TOP_GUIDE2},{Inputs.TOP_GUIDE}},defaults.getFillColor(), true, true));
 

igor.s

Well-known member
Joined
May 22, 2019
Posts
278
Likes
150
if you are looking to shade between plain vanilla horizontal lines you may use a Box. It has a fill method.
just a thought.

cheers.
 

tllcoolj

Member
Joined
Jun 13, 2019
Posts
11
Likes
3
Thanks for the suggestion. Attached is a pic of what I am really trying to do... shade between the orange guide and the next guide above.
 

Attachments

  • Screenshot 2022-02-04 131234.png
    Screenshot 2022-02-04 131234.png
    64.1 KB · Views: 36

lvm

New member
Joined
Nov 3, 2023
Posts
2
Likes
0
I want to shade between 2 lines (Inputs.TOP_GUIDE and Inputs.TOP_GUIDE2) using the Constructor -

public ShadeDescriptor(String name, String [][] linePairs, Color color, boolean enabled, boolean supportsDisable)
How do I specify the parameter "String [][] linePairs"?

As you can tell, I am not a Java programmer as this may be a simple problem for an experienced Java coder.
A sample using this Constructor would be much appreciated. Thanks in advance for any suggestions you may provide.
Did you find a solution to shade between 2 guide or found a alternative ?
 
Top