Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyTunes
- extends JFrame
- {
- private static String filepath;
- MP3Collection a = new MP3Collection(filepath);
- // construct the panel and components for this frame
- MyTunes( String title )
- {
- // set the frame title
- super (title);
- // create column names
- String columns[] = { "Author","Title","Album","Year" };
- // get the rows array with JTable cell values;
- // the values in each row must correspond to the column labels
- Object[][] rows = a.getTableData();
- // create a TableModel with the rectangular data and column labels
- model = new DefaultTableModel( rows, columns ) {
- @Override
- public boolean isCellEditable(int row, int column) {
- return false;
- }
- };
- JButton playButton = new JButton("Play");
- playButton.addActionListener(new playButtonListener());
- filterPanel.add(playButton);
- // display the frame and start processing events
- setVisible(true);
- }
- private class playButtonListener
- implements ActionListener
- {
- public void actionPerformed( ActionEvent e )
- {
- a.stopPlay();
- a.startPlay(table.getSelectedRow());
- }
- }
- public static void main( String [] args )
- {
- SwingUtilities.invokeLater( new Runnable() {
- @Override
- public void run() {
- MyTunes.filepath = "F:\\Empty\\+44\\a";
- MyTunes dowGUI = new MyTunes( "MyTunes" );
- dowGUI.setVisible(true);
- }
- } );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement