我不知道你的目的是什么,大体是这么回事儿,
但是鼠标只要越过琴弦就会触发midi 不理想。
如果要是敏感了,拨完 1 弦再拨 6 弦,更头痛。
百度Hi群:1010489 【 Java/J2EE技术交流】
QQ : 444 852 718 【布尔】
交个朋友交流一下。
/*** 歌曲类
*/
public class Music {
public Music() {
super()
}
public Music(String song) {
super()
System.out.println("《"+song+"》")
System.out.println(".....多来米发所拉稀....")
}
}
/**
* 乐器接口,凡实现该接口的都游演奏的功能
*/
public interface Instrument {
public Music musical(String song)
}
/**
* 管弦类乐器
*/
public class Orchestral implements Instrument {
public Music musical(String song) {
System.out.println("下面用管弦类乐器演奏 "+song)
return new Music(song)
}
}
/**
* d奏类乐器
*/
public class Spiccato implements Instrument {
public Music musical(String song) {
System.out.println("下面用d奏类乐器d奏 "+song)
return new Music(song)
}
}
/**
* 其他类型乐器
*/
public class Other implements Instrument {
String instrument
public Other() {
super()
}
public Other(String instrument) {
this.instrument = instrument
}
public Music musical(String song) {
System.out.println("用 "+instrument+" 演奏的 "+song)
return new Music(song)
}
public static void main(String[] args) {
Other other = new Other("古筝")
other.musical("高山流水")
}
}
/**
* 笛子
*/
public class Fife extends Orchestral {
public Fife(String song) {
super.musical(song)
System.out.println("这是用横笛吹奏的 "+song)
}
}
/**
* 萨克斯
*/
public class Sax extends Orchestral {
public Sax(String song) {
super.musical(song)
System.out.println("这是用萨克斯演奏的 "+song)
}
}
/**
* 吉他
*/
public class Guitar extends Spiccato {
public Guitar(String song) {
super.musical(song)
System.out.println("这是吉他d奏的")
}
}
/**
* 钢琴
*/
public class Piano extends Spiccato {
public Piano() {
super()
}
public Piano(String song) {
super.musical(song)
System.out.println("这是在用钢琴d奏 "+song)
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)