Re: [abc4j] Digest for abc4j@googlegroups.com - 1 Message in 1 Topic

10 views
Skip to first unread message

Sylvain Machefert

unread,
Nov 21, 2010, 1:30:23 AM11/21/10
to ab...@googlegroups.com
Hello
did you tried to put
    scoreUI.setTune(tune);
before x = ... and y = ... ?

you can also use scoreUI.getElementAt(Point)
I writed an example with that on the group, on a click event on the score, you can get the point (position of the click) then see if there is an element at this point.


2010/11/21 <abc4j+...@googlegroups.com>

Group: http://groups.google.com/group/abc4j/topics

    Divine <divin...@gmail.com> Nov 20 01:06PM -0800 ^
     
    Hi, I am new to abc4j,
    What I want to do with it is to render some notes using the library
    and then draw something extra.
    e.g. I want to circle a note that is wrongly played.
     
    I think I first need to get the positions of the notes rendered.
    I have read the article here: http://groups.google.com/group/abc4j/browse_thread/thread/2289cd2b603d4cd6
    But I do not fully understand it. May you give me a more complete
    example?
     
    I really appreciate your help.
     
    In the following code, I tried to get the (x,y) coordinates of a
    particular note so that I can do something on it.
    But it seems it is not the correct way of doing it.
     
    public static void main(String[] args) {
     
    Tune tune = new Tune();
    Tune.Music music = tune.getMusic();
    Note aNote = new Note(Note.F);
     
    music.addElement(aNote);
     
    JScoreComponent scoreUI =new JScoreComponent();
     
    double x =
    scoreUI.getRenditionElementFor(aNote).getBoundingBox().getX();
    double y =
    scoreUI.getRenditionElementFor(aNote).getBoundingBox().getY();
     
    scoreUI.setTune(tune);
    JFrame j = new JFrame();
    j.add(scoreUI);
    j.pack();
    j.setVisible(true);
    }

     

--
You received this message because you are subscribed to the Google Groups "abc4j" group.
To post to this group, send email to ab...@googlegroups.com.
To unsubscribe from this group, send email to abc4j+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/abc4j?hl=en.



--
Sylvain Machefert

Tous aux Balkans !
http://www.tousauxbalkans.net
Reply all
Reply to author
Forward
0 new messages