+ Reply to Thread
Results 1 to 2 of 2

Thread: Incompatible types foung error messege

  1. #1
    Newbie Manfrizy is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    6

    Post Incompatible types foung error messege

    HI poeple,any one with an idea on how to solve the incompatible error.Its driving me crazy
    here is my code:

    Code:
    package my AuodioRecords
    
    import java.awt.event.WindowAdapter;
     import java.awt.event.WindowEvent;
     import java.awt.BorderLayout;
     import java.awt.Component;
     import java.awt.FlowLayout;
     import javax.swing.event.TableModelEvent;
     import javax.swing.event.TableModelListener;
     import javax.swing.table.DefaultTableCellRenderer;
     import javax.swing.table.TableColumn;
     import javax.swing.JButton;
     import javax.swing.JFrame;
     import javax.swing.JLabel;
     import javax.swing.JPanel;
     import javax.swing.JScrollPane;
     import javax.swing.JTable;
     import javax.swing.JTextField;
     import javax.swing.UIManager;
    import javax.swing.table.TableModel;
    
    public class AudioRecord extends javax.swing.JFrame {
        public static final String[] columnNames = {
            "Title","Artist","Album",""
        };
        protected JTable table;
        protected JScrollPane scroller;
        protected AudioRecord tableModel;
    
        /** Creates new form AudioRecord */
        public AudioRecord() {
            initComponent();
        }
        public void initComponent() {
             tableModel =new InteractiveTableModel(columnNames);
             tableModel.addTableModelListener(new AudioRecord.InteractiveTableModelListener());
             table = new JTable();
             table.setModel((TableModel) tableModel);
             table.setSurrendersFocusOnKeystroke(true);
             if (!tableModel.hasEmptyRow()) {
                 tableModel.addEmptyRow();
             }
             scroller = new javax.swing.JScrollPane(table);
             table.setPreferredScrollableViewportSize(new java.awt.Dimension(500, 300));
             TableColumn hidden = table.getColumnModel().getColumn(InteractiveTableModel.HIDDEN_INDEX);
             hidden.setMinWidth(2);
             hidden.setPreferredWidth(2);
             hidden.setMaxWidth(2);
             hidden.setCellRenderer(new InteractiveRenderer(InteractiveTableModel.HIDDEN_INDEX));
    
             setLayout(new BorderLayout());
             add(scroller, BorderLayout.CENTER);
         }
    
         public void highlightLastRow(int row) {
             int lastrow = tableModel.getRowCount();
             if (row == lastrow - 1) {
                 table.setRowSelectionInterval(lastrow - 1, lastrow - 1);
             } else {
                 table.setRowSelectionInterval(row + 1, row + 1);
             }
    
             table.setColumnSelectionInterval(0, 0);
         }
    
        Object getAlbum() {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        Object getArtist() {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        void setAlbum(String string) {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        void setArtist(String string) {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        private void addEmptyRow() {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        private void addTableModelListener(InteractiveTableModelListener audioRecord) {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        private int getRowCount() {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
        private boolean hasEmptyRow() {
            throw new UnsupportedOperationException("Not yet implemented");
        }
    
         class InteractiveRenderer extends DefaultTableCellRenderer {
             protected int interactiveColumn;
    
             public InteractiveRenderer(int interactiveColumn) {
                 this.interactiveColumn = interactiveColumn;
             }
    
             public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row,
                int column)
             {
                 Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                 if (column == interactiveColumn && hasFocus) {
                     if ((AudioRecord.this.tableModel.getRowCount() - 1) == row &&
                        !AudioRecord.this.tableModel.hasEmptyRow())
                     {
                         AudioRecord.this.tableModel.addEmptyRow();
                     }
    
                     highlightLastRow(row);
                 }
    
                 return c;
             }
         }
    public class InteractiveTableModelListener implements TableModelListener {
             public void tableChanged(TableModelEvent evt) {
                 if (evt.getType() == TableModelEvent.UPDATE) {
                     int column = evt.getColumn();
                     int row = evt.getFirstRow();
                     System.out.println("row: " + row + " column: " + column);
                     table.setColumnSelectionInterval(column + 1, column + 1);
                     table.setRowSelectionInterval(row, row);
                 }
             }
         }
    
         public static void main(String[] args) {
             try {
                 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                 JFrame frame = new JFrame("Interactive Form");
                 frame.addWindowListener(new WindowAdapter() {
                     public void windowClosing(WindowEvent evt) {
                         System.exit(0);
                     }
                 });
                 frame.getContentPane().add(new AudioRecord());
                 frame.pack();
                 frame.setVisible(true);
             } catch (Exception e) {
               e.printStackTrace();
                //System.out.println(e);
             }
         }
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
    
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 1012, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 761, Short.MAX_VALUE)
            );
    
            pack();
        }// </editor-fold>                        
    
    }
    your help will be highly appreciciated!

  2. #2
    Super Moderator WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther has much to be proud of WingedPanther's Avatar
    Join Date
    Jul 2006
    Age
    36
    Posts
    11,680
    Blog Entries
    57

    Re: Incompatible types foung error messege

    It would be helpful if you indicated which line had the error.
    CodeCall Blog | CodeCall Wiki | Shareware
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 1
    Last Post: 04-07-2008, 03:15 PM
  2. Object Orient Types?
    By jclarke in forum C# Programming
    Replies: 7
    Last Post: 02-08-2008, 09:48 PM
  3. Java:Tutorial - Data Types
    By John in forum Java Tutorials
    Replies: 6
    Last Post: 07-02-2007, 09:16 PM
  4. Abstract data types in C++
    By priorityone in forum C and C++
    Replies: 1
    Last Post: 01-08-2007, 11:43 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts