Rookie needs help with program!!

Hi everyone,
I am new to JAVA programming and am trying to figure out my first progam. Any suggestions? Here's what I have to come up with...
This program will test your ability to code a loop function and some work with the strings methods.
INPUT
A SENTENCE OF UNKNOWN LENGTH.
OUTPUT
THE NUMBER OF WORDS IN THE SENTENCE AND EACH WORD ON A SEPARATE LINE. Two spaces are not a word; "a" is a word.
HINT
Use a loop until the end of the sentence and count each word that is removed from the front of the sentence (one at a time). Each time the sentence should be shortened.
I know I need to use a string method...Here's what I have so far...
public class jmstr
public static void main (String[ ] args)
System.out.println ("Please enter a sentence starting with some spaces ");
inputline = SavitchIn.readLine ( ) ;
System.out.println (inputline);
I'm not really sure what to do next....?
Any help would be appreciated!
materman

http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html
look at the example on the page, then scroll down to the Methods section and click on
countTokens()

Similar Messages

  • Need help with program for Inner join

    Hello Experts,
    I need to create a list from table sbook containing booking number (sbook-bookid), customer number (sbook-customid), customer name (scustom-name) , customer class (sbook-class) and ticket price (sflight-price). I am new to ABAP and am very confused I tried reading up some examples and came up with the attached program
    Attached is my program for inner join
    Kindly Help
    Thanks Su

    Hi Su K
              You May use key fields , Foreign keys for joining , Here
    SELECT SBOOK~BOOKID SBOOK~CUSTOMID SBOOK~CLASS
      SCUSTOM~ID SCUSTOM~NAME  FROM SFILGHT
       INNER JOIN SBOOK ON   SBOOK~CARRID EQ SFILGHT~CARRID
                                              SBOOK~CONNID EQ SFILGHT~CONNID
                                              SBOOK~FLDATE EQ SFILGHT~FLDATE
      INNER JOIN SCUSTOM ON SCUSTOM~ID = SBOOK~ID

  • Need help with Program Please!

    // Name: John Weir 02/03/2006
    Please read the comments as they will explain what help I need.
    All help greatly appreciated! Am new to working with GUI.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class FeverDiagnosis extends JFrame
         // diagnoisis constants
         private final String MENIGITIS = "menigitis";
         private final String DIGESTIVE_TRACT_INFECTION = "digestive tract infection";
         private final String PNEUMONIA_OR_AIRWAYS_INFECTION  ="pneumonia or airways infection";
         private final String VIRAL_INFECTION = "viral infection";
         private final String THROAT_INFECTION = "throat infection";
         private final String KIDNEY_INFECTION = "kidney infection";
         private final String URINARY_INFECTION = "urinary tract infection";
         private final String SUNSTROKE_OR_HEAT_EXHAUSTION = "sunstroke or heat exhaustion";
         // symptom constants
         private final String FEVER = "fever";
         private final String COUGHING = "coughing";
         private final String HEADACHE = "headache";
         private final String BREATHING_WITH_DIFFICULTY = "shortness of breath, wheezing, or coughing up phlegm";
         private final String ACHING_BONES_JOINTS = "aching bones or joints";
         private final String RASH = "rash";
         private final String SORE_THROAT = "sore throat";
         private final String BACK_PAIN_AND_CHILLS_AND_FEVER = "back pain just above the waist with chills and fever";
         private final String URINARY_DIFFICULTY = "pain urinating or are urinating more often";
         private final String TOO_MUCH_SUN = "sun overexposure due to spending the day in the sun or in hot conditions";
         public final String VOMITING_OR_DIARRHEA = "vomitting spell or diarrhea";
         private final String MENIGITIS_POSSIBILITIES =
                          "pain when bending your head forward,\n"
                        + "    nausea or vomiting, eye ache from \n"
                        + "    bright lights, drowsiness or confusion";
         // GUI varibles
         private JTextArea textArea;
         private JFrame theFrame;
         private JLabel stuff2;
         private JButton b1;
         private JButton b2;
         // instance variable
         private String symptoms = "";
         private Scanner cin = new Scanner (System.in);
         char response;
         String input;
         public FeverDiagnosis()
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame theFrame = new JFrame("John Weir");
              theFrame.setSize(650, 400);
              Dimension frameSize = theFrame.getSize();
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              theFrame.setLocation((screenSize.width - frameSize.width)/2,(screenSize.height - frameSize.height)/2);
              theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container contentPane = theFrame.getContentPane();
              theFrame.getContentPane().setLayout(new FlowLayout());
              JLabel stuff2 = new JLabel("Test");
              textArea = new JTextArea(12,50);
              textArea.setEditable(true);
              textArea.setBackground(Color.black);
              textArea.setForeground(Color.green);
              textArea.setFont(new Font("Serif", Font.ITALIC, 16));
              textArea.setLineWrap(true);
              textArea.setWrapStyleWord(true);
              b1 = new JButton("Yes");
              b2 = new JButton("No");
              contentPane.add(stuff2);
              contentPane.add(new JScrollPane(textArea));
              contentPane.add(b1);
              b1.setEnabled(true);
              contentPane.add(b2);
              b2.setEnabled(true);
              ActionListener l = new ActionListener()
                public void actionPerformed(ActionEvent e)
                   if((e.getSource() == b1))
                   //   HELP NEEDED
                   //   NEED BUTTON TO PASS
                   //   STRING VALUE "Y" TO
                   //   METHOD: have(String s)
                   input.equals("y");
                   else
                   if((e.getSource() == b2))
              b1.addActionListener(l);
              b2.addActionListener(l);
              theFrame.setVisible(true);
              theRules();
    public void theRules()
         displayNote();
         if (! have(FEVER) )
              displayUnsure();
         else
         if(are(COUGHING))
              if( are(BREATHING_WITH_DIFFICULTY))
                   addSymptom( PNEUMONIA_OR_AIRWAYS_INFECTION );
                   displayDiagnosis(PNEUMONIA_OR_AIRWAYS_INFECTION);
              }else
              if(have(HEADACHE))
                   addSymptom( VIRAL_INFECTION );
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(have(ACHING_BONES_JOINTS))
                   addSymptom( VIRAL_INFECTION );
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(have(RASH))
                   displayUnsure();
              }else
              if(have(SORE_THROAT))
                   addSymptom( THROAT_INFECTION );
                   displayDiagnosis(THROAT_INFECTION);
              }else
              if(have(BACK_PAIN_AND_CHILLS_AND_FEVER))
                   addSymptom( KIDNEY_INFECTION );
                   displayDiagnosis(KIDNEY_INFECTION);
              }else
              if(have(URINARY_DIFFICULTY))
                   addSymptom( URINARY_INFECTION );
                   displayDiagnosis(URINARY_INFECTION);
              }else
              if(have(TOO_MUCH_SUN))
                   addSymptom( SUNSTROKE_OR_HEAT_EXHAUSTION );
                   displayDiagnosis(SUNSTROKE_OR_HEAT_EXHAUSTION);
              }else
                   displayUnsure();
              else
              if(have(HEADACHE))
                   addSymptom(VIRAL_INFECTION);
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(are(MENIGITIS_POSSIBILITIES))
                   addSymptom( MENIGITIS );
                   displayDiagnosis(MENIGITIS);
              }else
              if(are(VOMITING_OR_DIARRHEA))
                   addSymptom( DIGESTIVE_TRACT_INFECTION );
                   displayDiagnosis(DIGESTIVE_TRACT_INFECTION);
              }else
              displayUnsure();
         public void displayNote()
              textArea.append("\n\n"
                   + "Fever Diagnostic Tool\n"
                   + "---------------------\n\n"
                   + "Please note that this program performs no true diagnostic activity.\n"
                   + "No decisions should be made based upon the tool's analysis. If users\n"
                   + "have a fever, they should contact their doctor.\n\n");
         public boolean have(String s)
              // prompt and extract
              textArea.append("Do you have you " + s + " (y, n): " + "\n");
              // NEED BUTTON TO PASS STRING  FROM ActionPerformed
              // AND HAVE IT RETURNED AS A CHAR RESPONCE!
              input = cin.nextLine();
              response = (char) Character.toLowerCase(input.charAt(0));
              while ( (response != 'y') && (response != 'n') )
                   textArea.append("Are you " + s + " (y, n): " + "\n");
                   input = cin.nextLine();
                   response = (char) Character.toLowerCase(input.charAt(0));
              textArea.append("");
              return response == 'y';
         private boolean are(String s)
              textArea.append("Are you " + s + " (y, n): " + "\n");
              input = cin.nextLine();
              char response = (char) Character.toLowerCase(input.charAt(0));
              while ( (response != 'y') && (response != 'n') )
                   textArea.append("Are you " + s + " (y, n): " + "\n");
                   input = cin.nextLine();
                   response = (char) Character.toLowerCase(input.charAt(0));
              textArea.append("");
              return response == 'y';
         public void addSymptom(String s)
              symptoms += "*   " + s + "\n";
         public void displayDiagnosis(String diagnosis)
              textArea.setText("");
              textArea.append("\nSymptoms:\n" + symptoms + "\n" + "Diagnosis"
                   + "\n   Possibilities include " + diagnosis  + "\n");
              textArea.append("\n");
              //System.exit(0);
         public void displayUnsure()
              textArea.append("\nInsufficient information to make a diagnosis" + "\n");
              textArea.append("\n");
              //System.exit(0);
         public static void main(String[] args)
              new FeverDiagnosis();
    }

    If you're looking to use a JTextArea as a console you can use these two classes
    you are free to use and modify these classes but please do not change the package or take credit for it as your own work.
    TextAreaReader.java
    =================
    * Created on Jul 7, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.awt.TextArea;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.TextEvent;
    import java.awt.event.TextListener;
    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.Reader;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    public class TextAreaReader extends Reader implements KeyListener {
         JTextArea mJArea;
         TextArea mAWTArea;
         Object mKeyLock = new Object();
         Object mLineLock = new Object();
         String mLastLine;
         int mLastKeyCode = 1;
         public TextAreaReader(JTextArea area) {
              super();
              mJArea = area;
              mJArea.addKeyListener(this);
         public TextAreaReader(TextArea area) {
              super();
              mAWTArea = area;
              mAWTArea.addKeyListener(this);
         public void keyPressed(KeyEvent ke) {
              mLastKeyCode = ke.getKeyCode();
              synchronized(mKeyLock) {
                   mKeyLock.notifyAll();
              if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
                   if (mJArea != null) {
                        String txt = mJArea.getText();
                        int idx = txt.lastIndexOf('\n', mJArea.getCaretPosition() - 1);
                        mLastLine = txt.substring(idx != -1 ? idx : 0, mJArea.getCaretPosition());//txt.length());
                        synchronized(mLineLock) {
                             mLineLock.notifyAll();
                   else {
                        String txt = mAWTArea.getText();
                        int idx = txt.lastIndexOf('\n', mAWTArea.getCaretPosition() - 1);
                        mLastLine = txt.substring(idx != -1 ? idx : 0, mAWTArea.getCaretPosition());//txt.length());
                        synchronized(mLineLock) {
                             mLineLock.notifyAll();
         public void keyReleased(KeyEvent ke) {
         public void keyTyped(KeyEvent ke) {
         public int read(char[] arg0, int arg1, int arg2) throws IOException {
              throw new IOException("Not supported");
         public String readLine() {
              synchronized(mLineLock) {
                   try {
                        mLineLock.wait();
                   catch (InterruptedException ex) {
              return mLastLine;
         public int read() {
              synchronized(mKeyLock) {
                   try {
                        mKeyLock.wait();
                   catch (InterruptedException ex) {
              return mLastKeyCode;
         public void close() throws IOException {
              // TODO Auto-generated method stub
         public static void main(String args[]) {
              JFrame f = new JFrame("TextAreaInput Test");
              JTextArea area = new JTextArea();
              final TextAreaReader tar = new TextAreaReader(area);
              f.add(area);
              Runnable r1 = new Runnable() {
                   public void run() {
                        while (true) {
                             int code = tar.read();
                             System.out.println("read: " + code);
              Runnable r2 = new Runnable() {
                   public void run() {
                        while (true) {
                             String line = tar.readLine();
                             System.out.println("read line: " + line);
              Thread t1 = new Thread(r1);
              Thread t2 = new Thread(r2);
              t1.start();
              t2.start();
              f.setBounds(100, 100, 200, 200);
              f.setVisible(true);
         public InputStream toInputStream() {
              return new MyInputStream();
         private class MyInputStream extends InputStream {
              public int read() {
                   return TextAreaReader.this.read();
    ==================
    TextAreaOutputStream
    ==================
    * Created on Mar 13, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.swing.JTextArea;
    import javax.swing.text.JTextComponent;
    public class TextAreaOutputStream extends OutputStream {
         public static final int DEFAULT_BUFFER_SIZE = 1;
         JTextArea mText;
         byte mBuf[];
         int mLocation;
         public TextAreaOutputStream(JTextArea component) {
              this(component, DEFAULT_BUFFER_SIZE);
         public TextAreaOutputStream(JTextArea component, int bufferSize) {
              mText = component;
              if (bufferSize < 1) bufferSize = 1;
              mBuf = new byte[bufferSize];
              mLocation = 0;
         @Override
         public void write(int arg0) throws IOException {
              //System.err.println("arg = "  + (char) arg0);
              mBuf[mLocation++] = (byte)arg0;
              if (mLocation == mBuf.length) {
                   flush();
         public void flush() {
              mText.append(new String(mBuf, 0, mLocation));
              mLocation = 0;
              try {
                   Thread.sleep(1);
              catch (Exception ex) {}
    }

  • I need help with programs from my MacBookAir.

    Hello. I've intalled programs on my MacbookAit that I don't need anymore and I have no idea how to remove them from my laptop. I've been a PC user and I knew there how to remove them but here I just don't know. I know that dragging them to the trash won't work. I want to remove them and free the space that is taking. I hope you guys can help me with this. Thank you Very Much!!!

    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, Easy Find, instead.  Download Easy Find at VersionTracker or MacUpdate.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
    AppZapper 2.0.1
    AppDelete 3.2.6
    Automaton 1.50
    Hazel
    AppCleaner 2.1.0
    CleanApp
    iTrash 1.8.2
    Amnesia
    Uninstaller 1.15.1
    Spring Cleaning 11.0.1
    Look for them at VersionTracker or MacUpdate.
    For more information visit The XLab FAQs and read the FAQ on removing software.

  • Need help with Programming.

    Input:
    Write a Java inventory application program that will accept the following input values from the user:
    a.     An inventory item number consisting of two upper-case letters followed by three numbers (eg. AB123)
    b.     An inventory item description.
    c.     An inventory unit price (2 decimals).
    d.     An item quantity-on-hand (no decimals).
    Use the TextIO.class to accept the values from the user.
    Processing:
    The input must be validated as follows:
    Item number - must be not more than 6 characters in length. Then, of those six characters, the first two must be letters only, followed by a dash (-) and then three numbers. Eg. AB-456.
    Inventory item description � must contain a value and be less than or equal to 20 characters in length.
    Unit price � between 0 and 5,000.00 inclusive.
    Quantity-on-hand � between 0 and 500 inclusive.
    The letters of the item number must be converted to upper-case for display purposes.
    Count the number of inventory transactions entered.
    Accumulate the calculated inventory cost of each item.
    Your program will contain six error messages as follows:
    **ERROR01** - Item number must be five characters
    **ERROR02** - Item number must start with 2 letters
    **ERROR03** - Item number must be numeric in last 3 positions
    **ERROR04** - Item description is required and must be max 20 chars
    **ERROR05** - Unit price must be between 0 and 5,000.00
    **ERROR06** - Quantity on hand must be between 0 and 500
    Note: there is no �persistent� storage of the data in this program. In other words, once the new data has been entered, the program �forgets� the old data. We will learn how to keep the data in memory in a later assignment.
    Output:
    After each transaction is entered, display the results to the user (as in the previous assignment). Prompt the user for additional inventory transactions after the information is displayed.
    If there are no more transactions to enter, display the number of inventory transactions entered during the session as well as the total cost of the inventory items processed. Your output must match that shown in the example screen shots shown on the next page.
    Please E-mail me back the answer.

    I would suggest,
    - Make a serious attempt yourself. We may be will to help you learn but we are not going to help someone cheat in your assignments.
    - After making a serious attempt ask a specific question on "New To Java" as this forum is for beginners. Be ready to provide the code as an example of your problem. Make sure the code at least compiles or you will not be taken seriously. (Unless this is your problem)

  • Beginner needs help with programming assignment

    So I have been working on it and it is reading everything and posting everything to the output file, but it looks like this
    MonthlyRainfall(cm)
    Average: 3.66
    January 7.29, above averageApril3.55, below averageNovember0.15, below average
    When instead it should look like this. Don't know what I need to do to get it to work like this. If I have to much regarding the IF Else statements or I just don't have it laid out right. Any help is appreciated. Thanks.
    Monthly Rainfall (cm)
    Average: 3.66
    January 7.29, above average
    April 3.55, below average
    November 0.15, below average
    Here is the code I have so far:
    package assign4;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.PrintWriter;
    import java.util.Scanner;
    import javax.swing.JOptionPane;
    public class Rainfall2 {/** main method
    * This is where the program starts.
    * @param args
    public static void main(String[] args) throws FileNotFoundException {
    * Title: Assignment 4
    * Description: CS 161 Assignment #4
    * date: October 27th 2008
    final String fileName = "src/assign4/rain2.txt";
    Scanner myFile = new Scanner( new FileReader( fileName ) );
    PrintWriter outFile = new
    PrintWriter ("src/assign4/rainfalloutput.out");
    //declares variables
    String title;
    String subtitle;
    String units;
    String date;
    int month1, month2, month3;
    double rain1, rain2, rain3;
    double average;
    * Read 6 lines from the input file
    title = myFile.next();
    subtitle = myFile.next();
    units = myFile.next();
    month1 = myFile.nextInt();
    rain1 = myFile.nextDouble();
    month2 = myFile.nextInt();
    rain2 = myFile.nextDouble();
    month3 = myFile.nextInt();
    rain3 = myFile.nextDouble();
    myFile.close(); //close the input file
    average = (rain1 + rain2 + rain3) / 3.0; //computes the average rainfall from data points
    outFile.println( title + subtitle + units);
    outFile.printf ("Average: %5.2f %n", average);
    if (month1 == 1)
    outFile.print ("January ");
    else if (month1 == 2)
    outFile.print ("February");
    else if (month1 == 3)
    outFile.print ("March");
    else if (month1 == 4)
    outFile.print ("April");
    else if (month1 == 5)
    outFile.print ("May");
    else if (month1 == 6)
    outFile.print ("June");
    else if (month1 == 7)
    outFile.print ("July");
    else if (month1 == 8)
    outFile.print ("August");
    else if (month1 == 9)
    outFile.print ("September ");
    else if (month1 == 10)
    outFile.print ("October");
    else if (month1 == 11)
    outFile.print ("November");
    else if (month1 == 12)
    outFile.print ("December");
    if (rain1 > average)
    outFile.print ( rain1 + ", above average");
    else
    if (rain1 == average)
    outFile.print ( rain1 + ", average");
    else
    if (rain1 < average)
    outFile.print ( rain1 + ", below average");
    if (month2 == 1)
    outFile.printf ("January");
    else if (month2 == 2)
    outFile.printf ("February");
    else if (month2 == 3)
    outFile.printf ("March");
    else if (month2 == 4)
    outFile.printf ("April");
    else if (month2 == 5)
    outFile.printf ("May");
    else if (month2 == 6)
    outFile.printf ("June");
    else if (month2 == 7)
    outFile.printf ("July");
    else if (month2 == 8)
    outFile.printf ("August");
    else if (month2 == 9)
    outFile.printf ("September");
    else if (month2 == 10)
    outFile.printf ("October");
    else if (month2 == 11)
    outFile.printf ("November");
    else if (month2 == 12)
    outFile.printf ("December");
    if (rain2 > average)
    outFile.printf ( rain2 + ", above average");
    else
    if (rain2 == average)
    outFile.printf ( rain2 + ", average");
    else
    if (rain2 < average)
    outFile.printf ( rain2 + ", below average");
    if (month3 == 1)
    outFile.printf ("January");
    else if (month3 == 2)
    outFile.printf ("February");
    else if (month3 == 3)
    outFile.printf ("March");
    else if (month3 == 4)
    outFile.printf ("April");
    else if (month3 == 5)
    outFile.printf ("May");
    else if (month3 == 6)
    outFile.printf ("June");
    else if (month3 == 7)
    outFile.printf ("July");
    else if (month3 == 8)
    outFile.printf ("August");
    else if (month3 == 9)
    outFile.printf ("September");
    else if (month3 == 10)
    outFile.printf ("October");
    else if (month3 == 11)
    outFile.printf ("November");
    else if (month3 == 12)
    outFile.printf ("December");
    if (rain3 > average)
    outFile.printf ( rain3 + ", above average");
    else
    if (rain3 == average)
    outFile.printf ( rain3 + ", average");
    else
    if (rain3 < average)
    outFile.printf ( rain3 + ", below average");
    outFile.close();
    }

    The printf method does not inlcude a LF/CR. You will have to add it yourself.
    In future when you post code, highlight it and click the CODE button to retain formatting.

  • Novice (Ok Rookie) need help with error message

    Hello all, I hope that you can help. I am getting this error
    message when trying to submit registration information to the
    database that I have created.
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] You cannot add or
    change a record because a related record is required in table
    'UserTypes'.
    The error occurred in
    C:\CFusionMX7\wwwroot\Development\signup.cfm: line 67
    65 : <cfelse>
    66 : NULL
    67 : </cfif>
    68 : , 0
    69 : , 1
    SQL INSERT INTO C:\CFusionMX7\wwwroot\database\wwf2.Users
    (UserName, Password, FirstName, LastName, EmailAddress, Address,
    City, "State", ZipCode, "Admin", Allowed, UserTypeId) VALUES (
    (param 1) , (param 2) , (param 3) , (param 4) , (param 5) , (param
    6) , (param 7) , (param 8) , (param 9) , 0 , 1 , 3 )
    DATASOURCE WWF2
    VENDORERRORCODE -1613
    SQLSTATE 23000
    Here is the code for that page
    Any help would be much appreciated. Thank you all so much.
    Damien

    quote:
    Originally posted by:
    DRufus
    When I created the form, I used dreamweavers record insertion
    wizard. could this be the issue. I'm sorry if I am not
    understanding your solution.
    Usage of <cfselect> is explained in the cfml reference
    manual. If you don't have one, the internet does. The quickest way
    to find it is to google the name of the tag, complete with angle
    brackets.
    I can't comment on dreamweaver's wizards because I never use
    them.

  • Flash rookie needs help with error messages when making simple calculator in AS3.

    I am trying to make a simple calculator I have been following this guide:
    http://www.youtube.com/watch?v=5k3h37YKZJI
    this is my code.
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:String;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.txt;
        PCnum = num2.txt;
        Total = parseInt(Hnum) * calc;
        Total.toString();
        Total_txt.text = String(Total);
    I am getting these 3 errors:
    Scene 1, Layer 'Actions', Frame 1, Line 14
    1067: Implicit coercion of a value of type flash.text:TextField to an unrelated type String.
    Scene 1, Layer 'Actions', Frame 1, Line 15
    1067: Implicit coercion of a value of type flash.text:TextField to an unrelated type String.
    Scene 1, Layer 'Actions', Frame 1, Line 16
    1067: Implicit coercion of a value of type Number to an unrelated type String.
    I have two input text boxs named num1 and num2 and then one dynamic text box named Total_txt.
    This should be so simple I really don't know what im doing wrong?
    Any help would be really appreciated.
    MrB

    If you look at the tutorial I think you will see that you are using "txt"  where "text" is required.  "text" is a property of a textfield, identifying the text that the textfield holds.  I don't know if you are doing something where the num1 object contains another object named txt, but I think my first sentence catches the problem.

  • Need Help with PROGRAM!

    ok. so i've started a project which is based upon the ArrayList class. The first part asks me to generate 30 random numbers between 1-100 and storing these numbers in an ArrayList. I've successfully completed this part by the use of the Wrapper Class Integer.. blah blah blah.
    Now, the second part asks me to find the minimum value stored in this ArrayList without sorting it. I've been having major problems solving this part. I've tried the compareTo method, lots of for loops, linear searches, storing a bunch of private data.... but i can't seem to get the minimum value.
    HELP!
    import java.util.*;
    public class RandomThirty
         private static int a;
         private static Integer b;
         private static int c;
         private static int x;
         private static int y;
         public static void getRandom(ArrayList theList)
              Random r = new Random();
              for(int i = 0; i < 30; i++)
                   a = r.nextInt(100) + 1;
                   b = new Integer(a);
                   theList.add(b);
              System.out.println(theList);
         public static void findMin(ArrayList list)
              for(int i = 1; i < list.size(); i++)
                   x = ((Integer)list.get(i)).intValue();
                   y =     ((Integer)list.get(i-1)).intValue();
                   if((x-y)  < 0)
                        c = -1;
                   else if((x-y)  > 0)
                        c = 1;
                   else
                        c = 0;
         public static void main(String args[])
              ArrayList a = new ArrayList();
              getRandom(a);
              System.out.println();
              findMin(a);
    }

    heres what u wanna do, i had this same problem once
    int minval = 999;
    int minval;
    for(int v=0;v<=29;v++)
    if(whateveryounamedyourarraylist.get(v)<minval)
    minval=whateveryounamedyourarraylist.get(v);
    System.out.println(minval);think thats right hope it helpsIt's safer to do this:
    ArrayList list = new ArrayList();
    int min = (Integer) list.get(0);
    for (int i = 1; i < list.size(); i++) {
        if ((Integer) list.get(i) < min) {
            min = (Integer) list.get(i);
    }and w/ new syntax:
    ArrayList<Integer> list = new ArrayList<Integer>();
    int min = list.get(0);
    for (Integer i : list) {
        if (i < min) {
            min = i;
    }If you ever run across a case where all the values are greater than 999
    (yes i know this won't happen in this case but if you change the random number range,
    this won't always work), then min will be 999 which wouldn't even be a value in the List.

  • Rookie needs help with SQL query

    I have a table with fields:
    Date
    Hour
    Person
    Volume
    Which records the number of calls each person takes each hour of their shift. How can I query the DB to return the average number of DAILY (not hourly) calls each person takes

    select Date, Person, avg(sum_volume) from (
    select Date, Person, sum(volume) sum_volume
    from table
    group by Date, Person
    The innner query rolls up by day, then you can average that value

  • Need help with my addressbook program

    hi,
    i need help with my program here. this one should works as:
    - saves user input into a txt file
    - displays name of the saved person on the jlist whenever i run the program
    - displays info about the person when clicked via textboxes given by reading the txt file where the user inputs are
    - should scroll when the list exceeds the listbox
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.JList;
    import java.awt.event.ActionListener;
    import java.io.*;
    import javax.swing.event.*;
    import java.io.FilterInputStream;
    public class AddressList extends JPanel implements ActionListener
         JTextField txt1 = new JTextField();
         JTextField txt2 = new JTextField();
         JTextField txt3 = new JTextField();
         DefaultListModel mdl = new DefaultListModel();
         JList list = new JList();
         JScrollPane listScroller = new JScrollPane(list);
         ListSelectionModel listSelectionModel;
         File fob = new File("Address3.txt");
         String name;
         char[] chars;     
         public void ListDisplay()
              try
                   RandomAccessFile rand = new RandomAccessFile(fob,"rw");
                   BufferedReader br = new BufferedReader(new FileReader("Address3.txt"));
                   if(fob.exists())
                         while((name = rand.readLine()) != null)
                              chars = name.toCharArray();
                              if(chars[0] == '*')
                                   mdl.addElement(name);
                                   list.setModel(mdl);
                              if(chars[0] == '#')
                                   continue;
                    else
                        System.out.println("No such file..");
              catch(IOException a)
                         System.out.println(a.getMessage());
         public AddressList()
              this.setLayout(null);
              listSelectionModel = list.getSelectionModel();
            listSelectionModel.addListSelectionListener(new ListInfo());
              list.setBounds(10,40,330,270);
              listScroller.setBounds(320,40,20,100);
              add(list);
              add(listScroller);
              JLabel lbl4 = new JLabel("Name: ");
              lbl4.setBounds(400,10,80,30);
              add(lbl4);
              JLabel lbl5 = new JLabel("Cellphone #: ");
              lbl5.setBounds(400,50,80,30);
              add(lbl5);
              JLabel lbl6 = new JLabel("Address: ");
              lbl6.setBounds(400,90,80,30);
              add(lbl6);
              JLabel lbl7 = new JLabel("List ");
              lbl7.setBounds(10,10,100,30);
              add(lbl7);
              txt1.setBounds(480,10,200,30);
              add(txt1);
              txt2.setBounds(480,50,200,30);
              add(txt2);
              txt3.setBounds(480,90,200,30);
              add(txt3);
              JButton btn1 = new JButton("Add");
              btn1.setBounds(480,130,100,30);
              btn1.addActionListener(this);
              btn1.setActionCommand("Add");
              add(btn1);
              JButton btn2 = new JButton("Save");
              btn2.setBounds(480,170,100,30);
              btn2.addActionListener(this);
              btn2.setActionCommand("Save");
              add(btn2);
              JButton btn3 = new JButton("Cancel");
              btn3.setBounds(480,210,100,30);
              btn3.addActionListener(this);
              btn3.setActionCommand("Cancel");
              add(btn3);
              JButton btn4 = new JButton("Close");
              btn4.setBounds(480,250,100,30);
              btn4.addActionListener(this);
              btn4.setActionCommand("Close");
              add(btn4);
         public static void main(String[]args)
              JFrame frm = new JFrame("Address List");
              AddressList panel = new AddressList();
              frm.getContentPane().add(panel,"Center");
              frm.setSize(700,350);
              frm.setVisible(true);
              panel.ListDisplay();
         public void actionPerformed(ActionEvent e)
              String cmd;
              cmd = e.getActionCommand();
              if(cmd.equals("Add"))
                   txt1.setText("");
                   txt2.setText("");
                   txt3.setText("");
              else if(cmd.equals("Save"))
                   mdl.addElement(txt1.getText());
                   list.setModel(mdl);
                   try
                   RandomAccessFile rand = new RandomAccessFile(fob,"rw");
                   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                   LineNumberReader line = new LineNumberReader(br);
                    if(fob.exists())
                              rand.seek(fob.length());
                              rand.writeBytes("* " + txt1.getText());
                              rand.writeBytes("\r\n" + "# " + txt2.getText());
                              rand.writeBytes("\r\n" + "# " + txt3.getText() + "\r\n");
                    else
                         System.out.println("No such file..");
                        txt1.setText("");
                        txt2.setText("");
                        txt3.setText("");
                    catch(IOException a)
                         System.out.println(a.getMessage());
              else if(cmd.equals("Cancel"))
                   txt1.setText("");
                   txt2.setText("");
                   txt3.setText("");
              else if(cmd.equals("Close"))
                   System.exit(0);
    class ListInfo implements ListSelectionListener
         public void valueChanged(ListSelectionEvent e)
              ListSelectionModel lsm = (ListSelectionModel)e.getSource();
              int minIndex = lsm.getMinSelectionIndex();
            int maxIndex = lsm.getMaxSelectionIndex();
              try //*this one should display the info of the person whenever i click the person's name at the list box via textbox.. but i cant seem to get it right since it always display the info of the first person inputed.. i tried to get the program to display them whenever it reads lines with * on them....
                   File fob = new File("Address3.txt");
                   RandomAccessFile rand = new RandomAccessFile(fob,"rw");
                   BufferedReader br = new BufferedReader(new FileReader("Address3.txt"));
                   LineNumberReader line = new LineNumberReader(br);
                   if(fob.exists())
                              for(int i = minIndex; i<=maxIndex; i++)
                                   if(lsm.isSelectedIndex(i))
                                        while((name = rand.readLine()) != null)
                                             chars = name.toCharArray();
                                             if(chars[0] == '#')
                                                  continue;
                                             if(chars[0] == '*')
                                                  txt1.setText(rand.readLine());
                                                 txt2.setText(rand.readLine());
                                                 txt3.setText(rand.readLine());
                    else
                              System.out.println("No such file..");
              catch(IOException a)
                         System.out.println(a.getMessage());
    }the only problem now is about how it should display the right info about the person whenever i click its name on the list.. something about file reading or something, i just cant figure it out.
    and also about how to make it scroll once it exceeds the list.. i cant make it work, maybe something about wrong declaration..
    thanks in advance..
    Edited by: syder on Mar 14, 2008 2:26 AM

    Like said before, do one thing at a time. At startup, something like:
    //put all the content in a list
    ArrayList<String> lines = new ArrayList<String>();
    while(String line=rand.readLine()!=null) {
        lines.add(line);
    }If you follow the good advice to create a class to encapsulate the entries, you could populate a list of such entries like this:
    static final int ENTRY_SIZE = 3;//you have 3 fields now, better to have a constant if that changes
    ArrayList<Entry> entries = new ArrayList<Entry>();
    for(int i=0; i<lines.size(); i+=ENTRY_SIZE) {
        Entry entry = new Entry(lines.get(i), lines.get(i+1), lines.get(i+2);
        entries.add(newEntry);
    }You could also do both of the above in one run, but I think you will understand better what's happening if you do one thing at a time.
    If you don't want to put the entries in an encapsulating class, you can still access this without looping:
    int listStartIdx = <desired_entry_index>*ENTRY_SIZE;
    String att1 = lines.get(listStartIdx).substring(1);
    String att2 = lines.get(listStartIdx+1).substring(1);
    String att3 = lines.get(listStartIdx+2).substring(1);

  • Need help with a rudimentary program

    I'm sort of new at this so i need help with a few things... I'm making a program to compile wages and i need answers with three things: a.) what are the error messages im getting meaning? b.) How can i calculate the state tax as 2% of my gross pay with the first $200 excluded and c.) how can i calculate the local tax as a flat $10 with $2 deducted for each dependant. any help is appreciated
    Here is what i have so far:
    public class WagesAsign1
              public static void main(String[] args)
                   int depend=4;
                   double hrsWork=40;
                   double payRate=15;
                   double grossPay;
                   grossPay=payRate*hrsWork;
                   double statePaid;
                   double stateTax=2.0;
                   statePaid=grossPay*(stateTax/100);
                   double localPaid;
                   double localTax=10.0;
                   localPaid=grossPay*(localTax/100);
                   double fedPaid;
                   double fedTax=10.0;
                   double taxIncome;
                   fedPaid=taxIncome*(fedTax/100);
                   taxIncome=grossPay-(statePaid+localPaid);
                   double takeHome;
                   System.out.println("Assignment 1 Matt Foraker\n");
                   System.out.println("Hours worked="+hrsWork+" Pay rate $"+payRate+" per/hour dependants: "+depend);
                   System.out.println("Gross Pay $"+grossPay+"\nState tax paid $"+statePaid+"\nLocal tax paid $"+localPaid+"\nFederal tax paid $"+fedPaid);
                   System.out.println("You take home a total of $"+takeHome);
    and these are the error messages so far:
    WagesAsign1.java:23: variable taxIncome might not have been initialized
                   fedPaid=taxIncome*(fedTax/100);
    ^
    WagesAsign1.java:29: variable takeHome might not have been initialized
                   System.out.println("You take home a total of $"+takeHome);
    ^

    edit: figured it out... please delete post
    Message was edited by:
    afroryan58

  • Need Help With D&D Program

    Hi, I'm not sure if I'm allowed to post questions on this forum but I can't find anywhere to talk to helpful people about programming.
    I'm making a dnd interface for JComponents. So far I've made a simple program that has a Component that can be lifted from a container and braught to the glass pane then later moved to anywhere on the screen and dropped into the container below it. Here's where my problems come:
    1) Rite now my 'Movable Component' is a JPanel which is just colored in. I want to either take a Graphic2d from a JComponent/Component and draw it on the JPanel or change the JPanel to the component I want to paint and disable the component.
    The problem with getting the Graphics2d is that if the component isn't on the screen it doesn't make a graphic object. I tried messing with the ui delicate and overriding parental methods for paintComponent, repaint, and that repaintChildren(forget name) but I haven't had luck getting a good graphics object. I was thinking of, at the beginning of running the program, putting 1 of each component onto the screen for a second then removing it but I'd rather not. I'd also like to change the graphics dynamicly if someone stretches the component there dropping and what not.
    The problem with disabling is that it changes some of the visual features of Components. I want to be able to update the Component myself to change how it looks and I don't want disabling to gray out components.
    I mainly just dont want the components to do any of there normal fuctions. This is for a page builder, by the way.
    Another problem I'm having is that mouseMotionListener is allowing me to select 2 components that are on top of one another when there edges are near each other. I don't know if theres a fix to this other than changing the Java Class.
    My next problem is a drop layout manager, but I'm doing pretty good with that rite now. It'll problem just move components out of the way of the falling component.
    One last thing I need help with is that I don't want the object that's being carried to go across the menu bar and certain areas. When I'm having the object being carried I have it braught up to the glass pane which allows it to move anywhere. Does anyone have any idea how I could prevent the component from being over the menu bars and other objects? I might have to make 1 panel is the movable area that can then be broken down into the 'component bank', 'building page' and whatever else I'm gonna need.
    This is all just test code to get together for when I make the real program but I need to make sure it'll be possible without a lot of hacking of code.
    Sorry for the length. Thanks for any help you can give.

    The trick to making viewable components that have no behaviour, is to render them onto an image of some sort (eg a BufferedImage). You can then display the Image on a JLabel that can be dragged around the desktop.
    Here is a piece of code that does the component rendering for you. This particular example uses a fixed component size, but you can modify that as you choose of course...public class JComponentImage
         private static GraphicsConfiguration gConfig;
         private static Dimension compSize = new Dimension(80, 22);
         private static Image image = null;
         public static Image getImage(Class objectClass)
              if (gConfig == null)
                   GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
                   GraphicsDevice gDevice = gEnv.getDefaultScreenDevice();
                   gConfig = gDevice.getDefaultConfiguration();
              image = gConfig.createCompatibleImage(compSize.width, compSize.height);
              JComponent jc = (JComponent) ObjectFactory.instantiate(objectClass);
              jc.setSize(compSize);
              Graphics g = image.getGraphics();
              g.setColor(Color.LIGHT_GRAY);
              g.fillRect(0, 0, compSize.width, compSize.height);
              g.setColor(Color.BLACK);
              jc.paint(g);
              return image;
    }And here is the class that makes the dragable JLabel using the class above...public class Dragable extends JLabel
         private static DragSource dragSource = DragSource.getDefaultDragSource();
         private static DragGestureListener dgl = new DragMoveGestureListener();
         private static TransferHandler th = new ObjectTransferHandler();
         private Class compClass;
         private Image image;
         Dragable(Class compClass)
              this.compClass = compClass;
              image = JComponentImage.getImage(compClass);
              setIcon(new ImageIcon(image));
              setTransferHandler(th);
              dragSource.createDefaultDragGestureRecognizer(this,
                                                          DnDConstants.ACTION_COPY,
                                                          dgl);
         public Class getCompClass()
              return compClass;
    }Oh and here is ObjectFactory which simply instantiates Objects of a given class and sets their text to their classname (very crudely)...public class ObjectFactory
         public static Object instantiate(Class objectClass)
              Object o = null;
              try
                   o = objectClass.newInstance();
              catch (Exception e)
                   System.out.println("ObjectFactory#instantiate: " + e);
              String name = objectClass.getName();
              int lastDot = name.lastIndexOf('.');
              name = name.substring(lastDot + 1);
              if (o instanceof JLabel)
                   ((JLabel)o).setText(name);
              if (o instanceof JButton)
                   ((JButton)o).setText(name);
              if (o instanceof JTextComponent)
                   ((JTextComponent)o).setText(name);
              return o;
    }Two more classes required by this codepublic class ObjectTransferHandler extends TransferHandler {
         private static DataFlavor df;
          * Constructor for ObjectTransferHandler.
         public ObjectTransferHandler() {
              super();
              try {
                   df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
              } catch (ClassNotFoundException e) {
                   Debug.trace(e.toString());
         public Transferable createTransferable(JComponent jC) {
              Transferable t = null;
              try {
                   t = new ObjectTransferable(((Dragable) jC).getCompClass());
              } catch (Exception e) {
                   Debug.trace(e.toString());
              return t;
         public int getSourceActions(JComponent c) {
              return DnDConstants.ACTION_MOVE;
         public boolean canImport(JComponent comp, DataFlavor[] flavors) {
              if (!(comp instanceof Dragable) && flavors[0].equals(df))
                   return true;
              return false;
         public boolean importData(JComponent comp, Transferable t) {
              JComponent c = null;
              try {
                   c = (JComponent) t.getTransferData(df);
              } catch (Exception e) {
                   Debug.trace(e.toString());
              comp.add(c);
              comp.validate();
              return true;
    public class ObjectTransferable implements Transferable {
         private static DataFlavor df = null;
         private Class objectClass;
         ObjectTransferable(Class objectClass) {
              try {
                   df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
              } catch (ClassNotFoundException e) {
                   System.out.println("ObjectTransferable: " + e);
              this.objectClass = objectClass;
          * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
         public DataFlavor[] getTransferDataFlavors() {
              return new DataFlavor[] { df };
          * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(DataFlavor)
         public boolean isDataFlavorSupported(DataFlavor testDF) {
              return testDF.equals(df);
          * @see java.awt.datatransfer.Transferable#getTransferData(DataFlavor)
         public Object getTransferData(DataFlavor arg0)
              throws UnsupportedFlavorException, IOException {
              return ObjectFactory.instantiate(objectClass);
    }And of course the test class:public class DragAndDropTest extends JFrame
         JPanel leftPanel = new JPanel();
         JPanel rightPanel = new JPanel();
         Container contentPane = getContentPane();
         Dragable dragableJLabel;
         Dragable dragableJButton;
         Dragable dragableJTextField;
         Dragable dragableJTextArea;
          * Constructor DragAndDropTest.
          * @param title
         public DragAndDropTest(String title)
              super(title);
              dragableJLabel = new Dragable(JLabel.class);
              dragableJButton = new Dragable(JButton.class);
              dragableJTextField = new Dragable(JTextField.class);
              dragableJTextArea = new Dragable(JTextArea.class);
              leftPanel.setBorder(new EtchedBorder());
              BoxLayout boxLay = new BoxLayout(leftPanel, BoxLayout.Y_AXIS);
              leftPanel.setLayout(boxLay);
              leftPanel.add(dragableJLabel);
              leftPanel.add(dragableJButton);
              leftPanel.add(dragableJTextField);
              leftPanel.add(dragableJTextArea);
              rightPanel.setPreferredSize(new Dimension(500,500));
              rightPanel.setBorder(new EtchedBorder());
              rightPanel.setTransferHandler(new ObjectTransferHandler());
              contentPane.setLayout(new BorderLayout());
              contentPane.add(leftPanel, "West");
              contentPane.add(rightPanel, "Center");
         public static void main(String[] args)
              JFrame frame = new DragAndDropTest("Drag and Drop Test");
              frame.pack();
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setVisible(true);
    }I wrote this code some time ago, so it won't be perfect but hopefully will give you some good ideas.
    Regards,
    Tim

  • Need help with a simple program (should be simple anyway)

    I'm (starting to begin) writing a nice simple program that should be easy however I'm stuck on how to make the "New" button in the file menu clear all the fields. Any help? I'll attach the code below.
    ====================================================
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Message extends JFrame implements ActionListener {
         public void actionPerformed(ActionEvent evt) {
         text1.setText(" ");
         text2.setText("RE: ");
         text3.setText(" ");
         public Message() {
         super("Write a Message - by Kieran Hannigan");
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         setSize(370,270);
         FlowLayout flo = new FlowLayout(FlowLayout.RIGHT);
         setLayout(flo);
         //Make the bar
         JMenuBar bar = new JMenuBar();
         //Make "File" on Menu
         JMenu File = new JMenu("File");
         JMenuItem f1 = new JMenuItem("New");f1.addActionListener(this);
         JMenuItem f2 = new JMenuItem("Open");
         JMenuItem f3 = new JMenuItem("Save");
         JMenuItem f4 = new JMenuItem("Save As");
         JMenuItem f5 = new JMenuItem("Exit");
         File.add(f1);
         File.add(f2);
         File.add(f3);
         File.add(f4);
         File.add(f5);
         bar.add(File);
         //Make "Edit" on menu
         JMenu Edit = new JMenu("Edit");
         JMenuItem e1 = new JMenuItem("Cut");
         JMenuItem e2 = new JMenuItem("Paste");
         JMenuItem e3 = new JMenuItem("Copy");
         JMenuItem e4 = new JMenuItem("Repeat");
         JMenuItem e5 = new JMenuItem("Undo");
         Edit.add(e5);
         Edit.add(e4);
         Edit.add(e1);
         Edit.add(e3);
         Edit.add(e2);
         bar.add(Edit);
         //Make "View" on menu
         JMenu View = new JMenu("View");
         JMenuItem v1 = new JMenuItem("Bold");
         JMenuItem v2 = new JMenuItem("Italic");
         JMenuItem v3 = new JMenuItem("Normal");
         JMenuItem v4 = new JMenuItem("Bold-Italic");
         View.add(v1);
         View.add(v2);
         View.add(v3);
         View.addSeparator();
         View.add(v4);
         bar.add(View);
         //Make "Help" on menu
         JMenu Help = new JMenu("Help");
         JMenuItem h1 = new JMenuItem("Help Online");
         JMenuItem h2 = new JMenuItem("E-mail Programmer");
         Help.add(h1);
         Help.add(h2);
         bar.add(Help);
         setJMenuBar(bar);
         //Make Contents of window.
         //Make "Subject" text field
         JPanel row2 = new JPanel();
         JLabel sublabel = new JLabel("Subject:");
         row2.add(sublabel);
         JTextField text2 = new JTextField("RE:",24);
         row2.add(text2);
         //Make "To" text field
         JPanel row1 = new JPanel();
         JLabel tolabel = new JLabel("To:");
         row1.add(tolabel);
         JTextField text1 = new JTextField(24);
         row1.add(text1);
         //Make "Message" text area
         JPanel row3 = new JPanel();
         JLabel Meslabel = new JLabel("Message:");
         row3.add(Meslabel);
         JTextArea text3 = new JTextArea(6,22);
         messagearea.setLineWrap(true);
         messagearea.setWrapStyleWord(true);
         JScrollPane scroll = new JScrollPane(text3,
                                  JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                  JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         //SpaceLine
         JPanel spaceline = new JPanel();
         JLabel spacer = new JLabel(" ");
         spaceline.add(spacer);
         row3.add(scroll);
         add(row1);
         add(row2);
         add(spaceline);
         add(spaceline);
         add(row3);
         setVisible(true);
         public static void main(String[] arguments) {
         Message Message = new Message();
    }

    persiandude wrote:
    Topic: Need help with if, else, and which statements and loops.
    How would I display 60 < temp. <= 85 in java
    System.out.println("60 < temp. <= 85 in java");
    another question is how do I ask a question like want to try again (y/n) after a output and asking that everytime I type in yes after a output and terminate when saying No.Sun's [basic Java tutorial|http://java.sun.com/docs/books/tutorial/]
    Sun's [New To Java Center|http://java.sun.com/learning/new2java/index.html].Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    [http://javaalmanac.com|http://javaalmanac.com]. A couple dozen code examples that supplement [The Java Developers Almanac|http://www.amazon.com/exec/obidos/tg/detail/-/0201752808?v=glance].
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's [Thinking in Java|http://mindview.net/Books/DownloadSites] (Available online.)
    Joshua Bloch's [Effective Java|http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=pd_bbs_1?ie=UTF8&s=books&qid=1214349768&sr=8-1]
    Bert Bates and Kathy Sierra's [Head First Java|http://www.amazon.com/exec/obidos/tg/detail/-/0596004656?v=glance].
    James Gosling's [The Java Programming Language|http://www.bookpool.com/sm/0321349806].

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

Maybe you are looking for

  • ITunes skips ahead skip ahead when continuing playback after pausing

    Just recently (after an iTunes upgrade? -- I'm running iTunes 11.1.3 with OS X 10.9), I noticed that when I pause a playback in iTunes and then hit play to resume, the playback "skips a beat" - it doesn't pick up where it left off, but rather a fract

  • Query Regarding Change Request management !!

    Hey friends, I want to know one thing about CHARM? Lets assume that we implement CHARM in satellite system landscape. After the implementing Charm Can we still create Transport request without using CHARM ?? I mean if  a user logged into satellite sy

  • Has 5x7" printing gone in 2.1.4 and Snow Leopard?

    I might be going crazy but I printed something on 5"x7" paper last week, and now, after upgrading to Snow Leopard and 2.1.4 the 5"x7" paper size seems to have disappeared from the print dialogue box. I haven't reinstalled my printer driver (HP C8180)

  • Problem with email regular expression

    I found the following regular expression from this website : http://www.regular-expressions.info/email.html \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\bor ^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$I am using the following website to check its success, as

  • Merge CHM, ToCs and CBT

    Hi, After some sweat I have a working implementation of a merged CHM project (RoboHelp 7) making use of Conditional Build Tags (CBTs) where the user can enter via any slave and still have access to the total ToC, and full search facilities. We will b