Adding low and high notes with the Jscore component

61 views
Skip to first unread message

Juan Rozon

unread,
Aug 4, 2011, 5:33:56 PM8/4/11
to ab...@googlegroups.com
I was just wondering how you add these notes with the Jscore component:

In abc it would be like this: C, D, E, F, G, A, B, and c' d' e' f' g' a' b'

How would I add these notes with Jscore? I only see how to add these: C D E F G A B c d e f g a b

iubito

unread,
Aug 5, 2011, 2:21:16 AM8/5/11
to abc4j
Hi!

If you use the abc.notation.Note
new Note(Note.C)
you have a constructor with octave transposition,
set it to -1 and you have the C,
set it to 1 and you have C' (or c)
set it to 2 and you have C'' (or c')

Juan Rozon

unread,
Aug 5, 2011, 10:24:27 AM8/5/11
to ab...@googlegroups.com
That works great, thanks a lot. 

I have another question now. when I add the really low and high notes, they get kinda cut off like in the picture. i tried to change the height with setSize() and a dimension element, that can change the width fine but not the height. i cant seem to find a way to change the height properly.
Untitled.png

jjjg...@gmail.com

unread,
Feb 1, 2013, 9:55:36 AM2/1/13
to ab...@googlegroups.com
I have the same question, how can I change the size to see really low and high notes? Did you find a solution?

iubito

unread,
Feb 5, 2013, 3:49:09 PM2/5/13
to ab...@googlegroups.com, jjjg...@gmail.com
Hi, sorry for my late answer. I'm very busy, preparing a big trip for this summer : www.thesuntrip.com

First : the JScoreComponent size.
I placed my JScoreComponent in a JPanel
JScoreComponent scoreUI = new JScoreComponent();
scoreUI.setPreferredSize(new Dimension(myPanel.getWidth(), 200));
scoreUI.setVisible(true);
scoreUI.setBackground(Color.WHITE);
scoreUI.setForeground(Color.BLACK);
scoreUI.setTune(myAbcTune);
scoreUI.setVisible(true);

the scoreUI.setTune changes the size of scoreUI
m_dimension.setSize(m_jTune.getWidth(), m_jTune.getHeight());
setPreferredSize(m_dimension);
setSize(m_dimension);

I recommand then to add the scoreUI in a JScrollPane instead of a simple JPanel.


Second : change margins. This is not automatic (yet)
ScoreTemplate template = scoreUI.getTemplate();
then you can play with template.setAttribute(key, value);
in your case :
ScoreAttribute.STAFF_LINES_SPACING : 
Space between two staves, expressed in px or SizeUnit.STAFF_HEIGHT.
Default value: 1 * staff height
e.g.: setAttributeSize(ScoreAttribute.STAFF_LINES_SPACING, 1.5, SizeUnit.STAFF_HEIGHT);

ScoreAttribute.FIRST_STAFF_TOP_MARGIN
Top margin for first staff, just below the headers, expressed in px or SizeUnit.STAFF_HEIGHT.
Default value: 0.75 * staff height

...of course all that using the last SVN, not the v0.5 downloadable jar file.

Hope this helps,

jjjg...@gmail.com

unread,
Feb 6, 2013, 9:58:10 AM2/6/13
to ab...@googlegroups.com, jjjg...@gmail.com
Thank you iubito! Enjoy your travel!!
Reply all
Reply to author
Forward
0 new messages