publicclassMainInterfaceextendsJFrameimplementsActionListener{//AddSongas=newAddSong();publicvoidinit(){//new组件Listlist=newList();JScrollPanejpan=newJScrollPane();JButt...
public class MainInterface extends JFrame implements ActionListener{
// AddSong as=new AddSong();
public void init(){
//new 组件
List list=new List();
JScrollPane jpan=new JScrollPane();
JButton add=new JButton("歌曲添加");
add.setIcon(new ImageIcon(getClass().getResource("Xbutton35.jpg")));
JButton modify=new JButton("歌曲修改");
modify.setIcon(new ImageIcon(getClass().getResource("Xbutton11.jpg")));
JButton delet=new JButton("歌曲删除");
delet.setIcon(new ImageIcon(getClass().getResource("Xbutton17.jpg")));
JButton select=new JButton("歌曲查询");
select.setIcon(new ImageIcon(getClass().getResource("Xbutton1.jpg")));
JButton songlist=new JButton("歌曲清单");
songlist.setIcon(new ImageIcon(getClass().getResource("Xbutton38.jpg")));
JButton quit=new JButton("系统退出");
quit.setIcon(new ImageIcon(getClass().getResource("Xbutton32.jpg")));
//布局
Container container=this.getContentPane();
BorderLayout bd=new BorderLayout();
JPanel jp1=new JPanel();
//左侧布局
GridLayout grid=new GridLayout(0,1);
jp1.setLayout(grid);
container.add(jp1,bd.WEST);
jp1.add(add);
jp1.add(modify);
jp1.add(delet);
jp1.add(select);
jp1.add(songlist);
jp1.add(quit);
//中心布局
container.add(list,bd.CENTER);
jpan=new JScrollPane(list);
jpan.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(134,134,134))," 热门歌曲排行 : "));
this.add(new JScrollPane(jpan));
this.setVisible(true);
//加监听
add.addActionListener(this);
add.setActionCommand("歌曲添加");
modify.addActionListener(this);
modify.setActionCommand("歌曲修改");
delet.addActionListener(this);
delet.setActionCommand("歌曲删除");
select.addActionListener(this);
select.setActionCommand("歌曲查询");
songlist.addActionListener(this);
songlist.setActionCommand("歌曲列表");
quit.addActionListener(this);
quit.setActionCommand("系统退出");
//设置属性
this.setTitle("songManagerSystem");
this.setLocation(200, 300);
this.setSize(900,500);
this.setVisible(true);
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("歌曲添加")){
new AddSong();
this.setVisible(false);
}
if(e.getActionCommand().equals("歌曲修改")){
}
if(e.getActionCommand().equals("歌曲删除")){
}
if(e.getActionCommand().equals("歌曲查询")){
}
if(e.getActionCommand().equals("歌曲列表")){
new SeeAll();
this.setVisible(false);
}
if(e.getActionCommand().equals("系统退出")){
System.exit(0);
}
}
}
上面是我写的没写完 写不下去了
跪求大哥大姐们帮忙啊
就添加的程序我写完了
希望大哥大姐们能帮我把删除和热门歌曲排行榜写出来
如果写得好的我一定给加分
是Txt文件保存的
就是不会写DeletSong()和 HotSong();啊
展开