猿问

同一程序,在eclipse中可以运行,cmd命令行运行却编译不过

报错部分代码如下:

public class BeatBox {

JPanel mainPanel;

ArrayList<JCheckBox> checkboxList;

Sequencer sequencer;

Sequence sequence;

Track track;

JFrame theFrame;

String[] instrumentNames = {"Bass Drum", "Closed Hi-Hat", "Open Hi-Hat", "Acoustic Snare",

"Crash Cymbal", "Hand Clap", "High Tom", "Hi Bongo", "Maracas", "Whistle",

"Low Conga", "Cowbell", "Vibraslap", "Low-mid Tom", "High Agogo", "Open Hi Conga"};

//实际的乐器关键字,例如说35是Bass Drum,42是Closed Hi-Hat

int[] instruments = {35, 42, 46, 38, 49, 39, 50, 60, 70, 72, 64, 56, 58, 47, 67, 63};

public static void main(String[] args) {

new BeatBox().buildGUI();

}

public void buildGUI() {

theFrame = new JFrame("Cyber BeatBox");

theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

BorderLayout layout = new BorderLayout();   //创建布局对象?

JPanel background = new JPanel(layout);

//设定面板上摆设组件时的空白边缘

background.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

checkboxList = new ArrayList<JCheckBox>();

Box buttonBox = new Box(BoxLayout.Y_AXIS);

JButton start = new JButton("Start");

start.addActionListener(new MyStartListener());

buttonBox.add(start);

JButton stop = new JButton("Stop");

stop.addActionListener(new MyStopListener());

buttonBox.add(stop);

JButton upTempo = new JButton("Tempo Up");

upTempo.addActionListener(new MyUpTempoListener());

buttonBox.add(upTempo);


嘟嘟的啦
浏览 2059回答 2
2回答

JustWannaHugU

八成是构造方法的事情你这代码贴的,一个字 眼花缭乱

ziom

IDE里运行的好好的,为什么要自找麻烦去命令行运行。。。
随时随地看视频慕课网APP

相关分类

Java
我要回答