Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1.  
  2. public class MyTunes
  3. extends JFrame
  4. {
  5.  
  6. private static String filepath;
  7. MP3Collection a = new MP3Collection(filepath);
  8. // construct the panel and components for this frame
  9. MyTunes( String title )
  10. {
  11. // set the frame title
  12. super (title);
  13.  
  14. // create column names
  15. String columns[] = { "Author","Title","Album","Year" };
  16.  
  17. // get the rows array with JTable cell values;
  18. // the values in each row must correspond to the column labels
  19. Object[][] rows = a.getTableData();
  20.  
  21. // create a TableModel with the rectangular data and column labels
  22. model = new DefaultTableModel( rows, columns ) {
  23. @Override
  24. public boolean isCellEditable(int row, int column) {
  25. return false;
  26. }
  27. };
  28.  
  29.  
  30. JButton playButton = new JButton("Play");
  31. playButton.addActionListener(new playButtonListener());
  32. filterPanel.add(playButton);
  33.  
  34. // display the frame and start processing events
  35. setVisible(true);
  36. }
  37.  
  38. private class playButtonListener
  39. implements ActionListener
  40. {
  41. public void actionPerformed( ActionEvent e )
  42. {
  43. a.stopPlay();
  44. a.startPlay(table.getSelectedRow());
  45. }
  46. }
  47.  
  48. public static void main( String [] args )
  49. {
  50. SwingUtilities.invokeLater( new Runnable() {
  51. @Override
  52. public void run() {
  53. MyTunes.filepath = "F:\\Empty\\+44\\a";
  54.  
  55. MyTunes dowGUI = new MyTunes( "MyTunes" );
  56. dowGUI.setVisible(true);
  57. }
  58. } );
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement