package { import org.aswing.BorderLayout; import org.aswing.JButton; import org.aswing.JPanel; import org.aswing.JToolBar; import org.aswing.event.AWEvent; public class ToolBar extends JPanel { private var bar:JToolBar; private var addButton:JButton; private var removeButton:JButton; private var editButton:JButton; public function ToolBar() { super(); setLayout(new BorderLayout()); bar=new JToolBar(JToolBar.HORIZONTAL, 2); append(bar, BorderLayout.CENTER); addButton = new JButton("添加日程"); removeButton = new JButton("删除日程"); editButton = new JButton("编辑日程"); bar.appendAll(addButton, removeButton, editButton); addButton.addEventListener(AWEvent.ACT,addTask); removeButton.addEventListener(AWEvent.ACT,removeTask); editButton.addEventListener(AWEvent.ACT,editTask); } private function addTask(e:AWEvent):void{ trace ("添加日程") } private function removeTask(e:AWEvent):void{ trace ("删除日程") } private function editTask(e:AWEvent):void{ trace ("编辑日程") } } }