2015-09-12 34 views
1

我發展具有的Java Swing桌面應用程序,它應該能夠顯示在框架MusicXML文件中定義的可視內容(音符,譜號,措施)。我找到的所有.xml解析器都只允許我創建樹。我也無法使用JEditorPane顯示內容。MusicXML文件 - 視覺呈現和動態編輯

我能做到這一點,否則我將需要先轉換動態它爲其他格式,如.PDF?如果是這樣 - 我怎麼在java中做到這一點?

回答

3

使用JTextArea讓用戶編輯原始XML。加載在使用SwingWorker背景文件,如圖here,以減輕任何延遲的效果。

image

@Override 
protected Integer doInBackground() { 
    BufferedReader in = null; 
    try { 
     in = new BufferedReader(new FileReader("build.xml")); 
     String s; 
     try { 
      while ((s = in.readLine()) != null) { 
       publish(s); 
      } 
     } catch (IOException ex) { 
      ex.printStackTrace(System.err); 
     } 
    } catch (FileNotFoundException ex) { 
     ex.printStackTrace(System.err); 
    } finally { 
     try { 
      in.close(); 
     } catch (IOException ex) { 
      ex.printStackTrace(System.err); 
     } 
    } 
    return status; 
} 

通過視覺表示,我的意思是我需要一種方法來顯示this type of visual output

你可能看JMusicXML項目,其中有「一些Java awt/swing圖形的球員。」更多的資源可能會發現here

image