2 Replies - 324 Views - Last Post: 21 July 2012 - 12:47 PM Rate Topic: -----

#1 wildpeach75  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 21-July 12

Error messages that keep occurring?

Posted 21 July 2012 - 12:36 PM

/*
 *This program so going to allow you to enter the 
 * name, charity and the amount of donation that are being given.
 */
package fundraiserprogram;

import java.awt.Component;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

/**
 *
 * @author Jolinna Horner
 */
public class FundraiserProgram {

    private static Object conn;
    private static Object result;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //class Charity  
        // object to be written to screen; Name,CharityName,Amount = new Name, 
        System.out.printf("Name", "CharityName", "Amount");
        class Object {
            // Put the table in a scroll pane.              

        }
    }
    
            class ScrollableJTable{
        public Object[][] data;

        public ScrollableJTable(Object[][] data) {
            this.data = data;
        }       
                                 
            public ScrollableJTable()
            {
                JFrame frame = new JFrame("Creating a Scrollable JTable!");
                        JPanel panel = JPanel();
                        String rowdata[][] ={{"Jean", "CharityName", "75"},
            {"Tim", "CharityName", "50"},
            {"Matt", "CharityName", "100"},
            {"Rose", "CharityName", "10"},
            {"Geri", "CharityName", "15"},
            {"Shawn", "CharityName", "20"},
            {"Renee", "CharityName", "5"},
            {"Joe", "CharityName", "7"}};

                        String col[] = {"Name of Donor","Name of Charity", "Amount of Donation"};
            data = data;
                    final java.lang.Object[][] data1 = data;
                        JTable table = new JTable(data1, col);
                        JScrollPane pane = new JScrollPane(table);
                        panel.add(pane);
                        
                         }
                private JPanel JPanel() {
                    throw new UnsupportedOperationException("Not yet implemented");
                }
            }
        }
 
            class FundraiserProgram(){
            // Put the table in a scroll pane.
                
         String[] colNames = {"Name", "Charity", "Amount"};
// declare contents of enum
        String[][] rowData = {{}};

// declare contents of enum
        JTable myTable = new JTable(rowData, colNames);
        Component JTable = null;
        JScrollPane scrollPane = new JScrollPane(JTable);
            }



Quote

ERROR MESSAGE

init:
deps-clean:
Updating property file: C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build\built-clean.properties
Deleting directory C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build
clean:
init:
deps-jar:
Created dir: C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build
Updating property file: C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build\built-jar.properties
Created dir: C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build\classes
Created dir: C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build\empty
Created dir: C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build\generated-sources\ap-source-output
Compiling 8 source files to C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\build\classes
C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\src\fundraiserprogram\FundraiserProgram.java:69: error: '{' expected
            class FundraiserProgram(){
1 error
C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\nbproject\build-impl.xml:605: The following error occurred while executing this line:
C:\Users\Peachy\Documents\NetBeansProjects\FundraiserProgram\nbproject\build-impl.xml:246: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)


Is This A Good Question/Topic? 0
  • +

Replies To: Error messages that keep occurring?

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1362
  • Posts: 3,002
  • Joined: 30-January 11

Re: Error messages that keep occurring?

Posted 21 July 2012 - 12:39 PM

Line 69
class FundraiserProgram(){


You shouldn't have any parenthesis in class declarations.
Was This Post Helpful? 0
  • +
  • -

#3 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Error messages that keep occurring?

Posted 21 July 2012 - 12:47 PM

In spite of the many lines of code, this is all your program currently does:
    public static void main(String[] args)
    {
        //class Charity  
        // object to be written to screen; Name,CharityName,Amount = new Name, 
        System.out.printf("Name", "CharityName", "Amount");
        class Object
        {
            // Put the table in a scroll pane.              

        }
    }

And it does so without error in my environment, though the contents of the printf statement could use some work. Since your thread title suggests you're seeing the error frequently, it may be something wrong with your NetBeans setup or development environment, but I don't know.

In the above, you have a nested class called "Object." Since that is the parent name of all Java classes, I suggest it's a lousy name, and you should use something else.

Edit: Oh ya. I just commented out the second occurrence of class FundraiserProgram that Ryano mentioned, because it didn't make sense.

This post has been edited by GregBrannon: 21 July 2012 - 12:49 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1