Results 1 to 2 of 2
  1. #1
    dumas64 is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default Need help with java methods

    package matchBeans;
    import java.util.*;
    import java.sql.*;

    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;

    public class Results
    public static Scanner input;
    private static Object scanner;

    public static void main(String[] args)
    input = new Scanner(;



    public static void displayMenu(Scanner input)

    int intOption = 0;

    System.out.println("\n\tPLEASE SELECT OPTION:");

    System.out.println("\n\t1.Enter Match Details");
    System.out.println("\t2.Display Match Results");
    System.out.println("\t3.Display Seson Results To Date");
    System.out.println("\t4.Calculate Cost Of Match Ticket/Type");
    System.out.println("\t5.Quit Program");

    if(intOption < 1 || intOption > 5)
    System.out.println("\nEnter An Option:");
    intOption = input.nextInt();

    catch(InputMismatchException e)
    System.out.println("Wrong Data type Entered.");

    case 1: entryMatchResults(input); break;
    case 2: displayMatchresult(input); break;
    case 3: displaySeasonResults(input); break;
    case 4: calculationMatchCost(input); break;
    case 5: Quit(input); break;
    default: System.out.println("No such option!"); break;

    //================================================== ==========================================
    public static void entryMatchResults(Scanner input)
    //want a method to insert new record in five fields namely
    //"integer,string,string,string, integer, integer" type of entries.
    //================================================== ===========================================
    public static void displayMatchresult(Scanner input)
    //wanted a method to select from a data base one item occupying five fields
    //"integer,string,string,string, integer, integer" type of entries.
    //================================================== ============================================
    public static void calculationMatchCost(Scanner input)
    // method to pick a price from data base by means of passing one variable e.g MatchID
    //and multiple it with a given quantity as input of choice
    //================================================== ===========================================
    public static void displaySeasonResults(Scanner input)
    Connection connection;
    Statement statement;
    ResultSet results;
    JFrame frame;
    JTable table;
    JScrollPane scroller;
    final String[] HEADING =
    {"matchID.","opponents","homrOraway","clubScore"," opponentsScore"};
    Vector<String> heads;
    Vector<Object> row;
    Vector<Vector<Object>> rows;

    connection = DriverManager.getConnection("jdbc:odbc:ClubData"," ","");
    statement = connection.createStatement();

    results = statement.executeQuery("SELECT * FROM Results");

    heads = new Vector<String>();
    for (int i=0; i<HEADING.length; i++)

    rows = new Vector<Vector<Object>>();

    try {
    while (
    row = new Vector<Object>();

    } catch (SQLException e) {

    frame = new JFrame();
    table = new JTable(rows,heads);
    scroller = new JScrollPane(table);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    catch(ClassNotFoundException cnfEx)
    System.out.println("* Unable to load driver! * ");
    } catch (SQLException e) {


    public static void Quit(Scanner input)
    System.out.println("\nYou have selected option 5 to terminate the program.");
    System.out.println("\nProgram terminated.");

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    I see code in your post, but what is your specific question? It seems to be missing.

    Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?

    To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [cod&#101;] above your pasted code and the tag [/cod&#101;] below your pasted code like so:

    Java Code:
      // your code goes here
      // notice how the top and bottom tags are different
    Much luck

Similar Threads

  1. Replies: 8
    Last Post: 04-17-2012, 12:00 AM
  2. JSP functions and Java Bean methods
    By lisa.lipsky in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 07-07-2009, 08:29 AM
  3. Call java Methods from Python Script
    By hofsoc in forum New To Java
    Replies: 1
    Last Post: 02-18-2009, 05:47 PM
  4. Ask for help on Java access to protected methods
    By fangzhong in forum Advanced Java
    Replies: 3
    Last Post: 02-17-2009, 02:50 PM
  5. Methods of the java.util.Vector
    By ajeeb in forum New To Java
    Replies: 3
    Last Post: 12-26-2008, 04:01 AM

Posting Permissions

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