Help on this code

Hello All,
I have a problem of running a JSP which in turn opens differnt JSPs based on the Social Sec#.
The process is very simple. The Main JSP is accepting Login and Passwd. These values are passed to a Servlet and it returns a JSP name and it needs to be open.
Attached herewith is the code and your help will be highly appreciated.
Note: UserStatus is the servlet.
Main JSP Code:-
<%@
page
contentType="text/html"
%>
<br>
<HTML>
<HEAD>
<script language = "JavaScript">
<!--
     function validate(){
var frm = document.mainlogin;
          if (frm.login.value == ""){
               alert("Enter your login ID!!")
               frm.login.focus()
return false
          else if (frm.password.value == ""){
               alert("Enter your password")
               frm.password.focus()
               return false
          else if(frm.login.value != frm.password.value){
alert("Invalid UserID/Password, Try Again!!")
               frm.password.focus()
          return false
</script>
<TITLE>Tower Square Reports Login</TITLE>
<META VALUE="Jill" CONTENT="AUTHOR">
</HEAD>
<BODY bgcolor="#ffffff">
<hr/>
<p/>
<form name="mainlogin" action=<jsp:forward page="/WEB-INF/classes/UserStatus" />onsubmit="return validate()">
<CENTER>
<TABLE align="center" height="252" bgcolor="#000000" cellpadding="1" cellspacing="0" border="0" width="402">
<TR>
<TD valign="middle" bgcolor="#000000" align="center">
<TABLE height="250" cellpadding="0" cellspacing="0" border="0" width="400">
<TR>
<TD bgcolor="#7B889F" height="50" width="400" colspan="6">
     </TD>
</TR>
<TR>
<TD height="65" bgcolor="#D3D8DE" align="center" width="65" rowspan="6"><IMG ALT="tower2.gif" SRC="tower2.gif"></TD>
</TR>
<TR>
<TD width="100" bgcolor="#FFFFFF" height="15" align="right" >
<font face="Arial" size="2"><b>Login</b><font color="#FF0000">*</font>
</TD><TD width="11" bgcolor="#FFFFFF" height="15"><INPUT SIZE="10" NAME="login" TYPE="text" maxlength="11"></TD>
</TR>
<TR>
<TD width="100" bgcolor="#FFFFFF" height="15" align="right">
     <font face="Arial" size="2"><b>Password</b><font color="#FF0000">*</font>
</TD><TD width="11" bgcolor="#FFFFFF" height="15"><INPUT SIZE="10" NAME="password" TYPE="password" maxlength="11"></TD>
<TR>
<TD height="50" bgcolor="#7B889F" width="85"></TD><TD width="100" height="50" bgcolor="#7B889F"></TD><TD width="190" height="50" bgcolor="#7B889F"><INPUT value="Login" TYPE="submit"><INPUT value="Reset" TYPE="reset"></TD><TD height="50" bgcolor="#7B889F" width="25">
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
</BODY>
</HTML>

Hi,
Thanks for the tip. The web.xml, I found it in //WEB-INF and I think I need to change it because my main JSP calling program name is mainlogin.jsp.
whereas in the web.xml it looks as,
- <web-app>
<display-name>Default User Application</display-name>
<description>Default application for getting started</description>
- <session-config>
<session-timeout>30</session-timeout>
</session-config>
- <mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
- <mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
- <welcome-file-list>
<welcome-file>MainScreen.jsp</welcome-file>
<welcome-file>MainScreen.html</welcome-file>
</welcome-file-list>
</web-app>
So, I am going to change this to mainlogin.jsp and mainlogin.html...
oh...boy-o-boy!!!!

Similar Messages

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • Noob needs help with this code...

    Hi,
    I found this code in a nice tutorial and I wanna make slight
    adjustments to the code.
    Unfortunately my Action Script skills are very limited... ;)
    This is the code for a 'sliding menue', depending on which
    button u pressed it will 'slide' to the appropriate picture.
    Here's the code:
    var currentPosition:Number = large_pics.pic1._x;
    var startFlag:Boolean = false;
    menuSlide = function (input:MovieClip) {
    if (startFlag == false) {
    startFlag = true;
    var finalDestination:Number = input._x;
    var distanceMoved:Number = 0;
    var distanceToMove:Number =
    Math.abs(finalDestination-currentPosition);
    var finalSpeed:Number = .2;
    var currentSpeed:Number = 0;
    var dir:Number = 1;
    if (currentPosition<=finalDestination) {
    dir = -1;
    } else if (currentPosition>finalDestination) {
    dir = 1;
    this.onEnterFrame = function() {
    currentSpeed =
    Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
    distanceMoved += currentSpeed;
    large_pics._x += dir*currentSpeed;
    if (Math.abs(distanceMoved-distanceToMove)<=1) {
    large_pics._x =
    mask_pics._x-currentPosition+dir*distanceToMove;
    currentPosition = input._x;
    startFlag = false;
    delete this.onEnterFrame;
    b1.onRelease = function() {
    menuSlide(large_pics.pic1);
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    b3.onRelease = function() {
    menuSlide(large_pics.pic3);
    b4.onRelease = function() {
    menuSlide(large_pics.pic4);
    I need to adjust five things in this code...
    (1) I want this menue to slide vertically not horizontally.
    I changed the 'x' values in the code to 'y' which I thought
    would make it move vertically, but it doesn't work...
    (2) Is it possible that, whatever the distance is, the
    "sliding" time is always 2.2 sec ?
    (3) I need to implement code that after the final position is
    reached, the timeline jumps to a certain movieclip to a certain
    label - depending on what button was pressed of course...
    I tried to implement this code for button number two...
    b2.onRelease = function() {
    menuSlide(large_pics.pic2);
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    --> sliding still works but it doesn't jump to the
    appropriate label...
    (4) I wanna add 'Next' & 'Previous' buttons to the slide
    show - what would be the code in this case scenario ?
    My first thought was something like that Flash checks which
    'pic' movieclip it is showing right now (pic1, pic2, pic3 etc.) and
    depending on what button u pressed u go to the y value of movieclip
    'picX + 1' (Next button) or 'picX - 1' (Previous button)...
    Is that possible ?
    (5) After implementing the Next & Previous buttons I need
    to make sure that when it reached the last pic movieclip it will
    not go further on the y value - because there is no more pic
    movieclip.
    Options are to either slide back to movieclip 'pic1' or
    simply do nothing any more on the next button...
    I know this is probably Kindergarten for you, but I have only
    slight ideas how to do this and no code knowledge to back it up...
    haha
    Thanx a lot for your help in advance !
    Always a pleasure to learn from u guys... ;)
    Mike

    Hi,
    I made some progress with the code thanx to the help of
    Simon, but there are still 2 things that need to be addressed...
    (1) I want the sliding time always to be 2.2 sec...
    here's my approach to it - just a theory but it might work:
    we need a speed that changes dynamically depending on the
    distance we have to travel...
    I don't know if that applies for Action Scrip but I recall
    from 6th grade, that...
    speed = distance / time
    --> we got the time (which is always 2.2 sec)
    --> we got the disctance
    (currentposition-finaldestination)
    --> this should automatically change the speed to the
    appropriate value
    Unfortunately I have no clue how the action script would look
    like (like I said my action script skills are very limited)...
    (2) Also, one other thing I need that is not implemented yet,
    is that when the final destination is reached it jumps to a certain
    label inside a certain movieclip - every time different for each
    button pressed - something like:
    if (currentPosition = finalDestination) {
    this.large_pics.pic2.gotoAndPlay("s1");
    that statement just doesn't work when I put it right under
    the function for each button...
    Thanx again for taking the time !!!
    Mike

  • Can anyone help with this code

    i am trying to create a html5 video gallery for my website  I was wondering if anyone can help me with this code :  Am i missing something got this from the adobe widget browser i can get the button fuctions but i can not seem to get the video to play or work.. 

    This is the full page i am still working on it but the video code which i posted earlier is not working...    
    123456789101112131415
    Home
    Biography
    To Be Lead
    Gallery
    Videos
    Memorial Page
    Wallpaper
    Blog
    Forum
    Contact
    Randy Savage Bio
    Randy's Facts 101
    His Early Career
    Randy's Career in the WWF
    Randy's Career in WCW
    The Mega Powers  
    Mega powers Bio Mega Powers Facts 101 
    PM to fans and Elizabeth
    Randy's Radio interview
    His Death
    Elizabeth Hulette 
    Elizabeth Bio Elizabeth Facts 101 Her Career in the WWF Her Career in WCW Later Life Farewell to a Princess Elizabeth's Radio Interview Elizabeth Death 
    Sherri Martel
    Gorgeous George
    Team Madness
    Early Years
    ICW Gallery
    WWF Gallery
    WCW Gallery
    NWO Gallery
    Memorial Page for Randy
    Memorial Page for Elizabeth
                          Video of the Month    
    Site Disclaimer
    Macho-madness is in no way in contact with World Wrestling Entertainment. All photos are copyright to World Wrestling Entertainment or their respective owners and is being used under the fair copyright of Law 107.
    ©macho-madness.net All right's Reserved.  
            Affiliates
    Want to be an affiliate, elite, or partner site? Email: [email protected] with the list of things below.
    Place in the subject of email: “Randy Savage Online Affiliation”.
    Name: 
    Email: 
    Site Name: 
    Site URL: 
    When Will The Site Be Added?:
                        To see A List Click Here...
    ©macho-madness.net All right's Reserved.  
    Offical Links

  • Please help in this code..

    Hi,
    I am developing one small program. Which has one inner class in parent class. I am using object [] array of that inner class. like thisPreferredRoomsItem maxPercentagePrefRooms[] = new PreferredRoomsItem[solutionOfTimeTable.MAX_ACTIVITIES];  
            for (int j = 0; j < solutionOfTimeTable.nInternalActivities; j++) {           
                maxPercentagePrefRooms[j].percentage=-1.0;
                maxPercentagePrefRooms[j].prefferedRooms.clear(); // test it.                                  
                double maxPercentage = -1;
                double minNRooms = INF;        
                for(PreferredRoomsItem it:activitiesPreferredRoomsList){ // check this code. this is incorrect/.
                if(maxPercentage<it.percentage || (maxPercentage==it.percentage && minNRooms>it.prefferedRooms.size())){           
                    maxPercentage = it.percentage;              
                    minNRooms = it.prefferedRooms.size();
                    maxPercentagePrefRooms[j] = it;
                } In inner class PreferredRoomsItem it has two member variables. And then I am using iteration with for loop. When I am using this line-->maxPercentagePrefRooms[j]. it gives me nullpointerexception. Please help.
    It is urgent.
    Thanks in advance.

    You still need to instantiate the Object in each array index.
    for (int j = 0; j < solutionOfTimeTable.nInternalActivities; j++) {           
                 maxPercentagePrefRooms[j] = new PreferredRoomsItem();
                //...

  • Need help getting this code to work

    I am trying to get this code to work using "if else statment" but it will only do the first part and not do the second part in the else statement. Can anyone help me out? Here is the code:
    var R1 = this.getField("Registration Fees1");
    var R2 = this.getField("Registration Fees2");
    var R3 = this.getField("Registration Fees3");
    var R4 = this.getField("Registration Fees4");
    var R0 = 0
    if (R0 == 0)
      event.value = Math.floor(R1.value);
    else
      event.value = Math.floor(R2.value + R3.value + R4.value);
    I did notice that if I fiddled around this this part:
    if (R0 == 0)
    sometimes I can get the second part to work but not the first. I need it to do either or and this is getting frustrating.
    I might also not even need "var R0 = 0". I put that there for the condition part. If that is what is causing the problem, I can take it out. But then what would the condition be? For this form, the default is 0 and then the calculation follows by user clicking on different prices. The first part is if they want to pay for the full conference and the second part is if they want to pay for either Monday, Tuesday or Wednesday or 2 of the 3 days. Is it possible to get this to work with both parts together? I am still stuck on getting just one or the other working. Any help would be greatly appreciated. Thanks in advance.

    I have posted this on another message board and a user by the name of gkaiseril offered this solution but it hasn't worked either.
    // all four days
    var R1 = this.getField("Registration Fees1").value;
    // Monday
    var R2 = this.getField("Registration Fees2").value;
    // Tuesday
    var R3 = this.getField("Registration Fees3").value;
    // Wednesday
    var R4 = this.getField("Registration Fees4").value;
    var Fee = 0
    event.value = ''; // default value
    if (R1 != 'Off') {
      Fee = Number(R1) + Fee;
    } else {
      if(R2 != 'Off') {
         Fee = Number(Fee) + R2;
      if(R3 != 'Off') {
         Fee += Number(R3);
      if(R4 != 'Off') {
         Fee = Number(R4) + Fee;
    event.value = Fee;

  • Help edit this code

    Hi I got this code of the net which displays a calendar and when a date
    is selected from the calendar it is displayed in the textfield.
    At the moment if nothing is selected from the calendar it displays the first of the month in the textField.
    I want the calendar to work in such a way that if nothing is selected from the calendar then no changes are made to the textfield.
    Can someone help me out?
    Thanks alot
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
         //TODO: submit to resource bundle for internationalization
         private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
         private JButton[] days = null;
         private JLabel monthLabel = null;
         private Calendar calendar = null;
         private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
         super();
         this.setModal(true);
         initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
         String text;
         if (e.getActionCommand().equals("D")){
              //return a date
              text = ((JButton) e.getSource()).getText();
              if (text.length() > 0){
                   this.returnDate(text);
              } else {
                   Toolkit.getDefaultToolkit().beep();
         } else {
              this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
         Calendar cal = this.getCalendar();
         int startPos;
         int currentMonth = cal.get(Calendar.MONTH);
         //for painting ease, quick display
         mainPanel.setVisible(false);
         //set month
         monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
         //set to first day
         cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
         //now work the day labels
         startPos = cal.get(Calendar.DAY_OF_WEEK);
         for (int i = startPos - 1; i < days.length; i++) {
              days.setText(String.valueOf(cal.get(Calendar.DATE)));
              cal.roll(Calendar.DATE, true);
              if (cal.get(Calendar.DATE) == 1) {
                   //clear remaining labels going forward
                   for (int j = i + 1; j < days.length; j++) {
                        days[j].setText("");
                   break;
         //work first week
         for (int h = 0; h < startPos - 1; h++) {
              if (cal.get(Calendar.DATE) > 25 ) {
                   days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
                   cal.roll(Calendar.DATE, true);
              } else {
                   days[h].setText("");
         this.setCalendar(cal);
         mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
         if (this.calendar == null){
              calendar = Calendar.getInstance();
         return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
         JButton jb;
         /* layout:
         North panel: month + year display
         Center Panel: buttons for the days, 5 by 7 grid
         South Panel: navigation buttons */
         mainPanel = new JPanel();
         JPanel northPanel = new JPanel();
         JPanel centerPanel = new JPanel();
         JPanel southPanel = new JPanel();
         //widgets
         //NORTH
         monthLabel = new JLabel(months[9] + " 1953");
         northPanel.setLayout(new FlowLayout());
         northPanel.add(monthLabel);
         //CENTER
         centerPanel.setLayout(new GridLayout(5,7));
         days = new JButton[35];
         for (int i = 0; i <35; i++){
              jb = new JButton(String.valueOf(i));
              jb.setSize(25,25);
              jb.setBorder(new EmptyBorder(1,1,1,1));
              jb.setFocusPainted(false);
              jb.setActionCommand("D");
              jb.addActionListener(this);
              days[i] = jb;
              centerPanel.add(jb);
         //SOUTH
         southPanel.setLayout(new FlowLayout());
         southPanel.add(this.makeButton("<<"));
         southPanel.add(this.makeButton("<"));
         southPanel.add(this.makeButton(">"));
         southPanel.add(this.makeButton(">>"));
         mainPanel.setLayout(new BorderLayout());
         mainPanel.add(northPanel, "North");
         mainPanel.add(centerPanel,"Center");
         mainPanel.add(southPanel, "South");
         this.getContentPane().add(mainPanel);
         this.setSize(150,150);
         caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
         try{
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         } catch (Exception e){}
         final DateChooser dc = new DateChooser();
         JFrame jf = new JFrame();
         jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         JPanel jp = new JPanel();
         final JTextField jff = new JTextField("The date field will hold the result.");
         JButton jb = new JButton("...");
         jb.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
                   jff.setText("" + df.format(dc.getCalendar().getTime()));
         jp.add(jff);
         jp.add(jb);
         jf.getContentPane().add(jp);
         jf.setSize(300,300);
         jf.show();
         //set up location of the dialog
         dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
         JButton jb = new JButton(caption);
         jb.setSize(25,25);
         jb.setBorder(new EmptyBorder(1,4,1,4));
         jb.setFocusPainted(false);
         jb.setActionCommand(caption);
         jb.addActionListener(this);
         return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
         this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
         this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
         int field;
         if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
         if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
         if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
         if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
         caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
         calendar = newCalendar;

    I don't give a stuff bout your prob... the formatting just pissed me off, thats all!
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
    //TODO: submit to resource bundle for internationalization
    private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
    private JButton[] days = null;
    private JLabel monthLabel = null;
    private Calendar calendar = null;
    private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
    super();
    this.setModal(true);
    initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
    String text;
    if (e.getActionCommand().equals("D")){
    //return a date
    text = ((JButton) e.getSource()).getText();
    if (text.length() > 0){
    this.returnDate(text);
    } else {
    Toolkit.getDefaultToolkit().beep();
    } else {
    this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
    Calendar cal = this.getCalendar();
    int startPos;
    int currentMonth = cal.get(Calendar.MONTH);
    //for painting ease, quick display
    mainPanel.setVisible(false);
    //set month
    monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
    //set to first day
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
    //now work the day labels
    startPos = cal.get(Calendar.DAY_OF_WEEK);
    for (int i = startPos - 1; i < days.length; i++) {
    days.setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    if (cal.get(Calendar.DATE) == 1) {
    //clear remaining labels going forward
    for (int j = i + 1; j < days.length; j++) {
    days[j].setText("");
    break;
    //work first week
    for (int h = 0; h < startPos - 1; h++) {
    if (cal.get(Calendar.DATE) > 25 ) {
    days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    } else {
    days[h].setText("");
    this.setCalendar(cal);
    mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
    if (this.calendar == null){
    calendar = Calendar.getInstance();
    return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
    JButton jb;
    /* layout:
    North panel: month + year display
    Center Panel: buttons for the days, 5 by 7 grid
    South Panel: navigation buttons */
    mainPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel centerPanel = new JPanel();
    JPanel southPanel = new JPanel();
    //widgets
    //NORTH
    monthLabel = new JLabel(months[9] + " 1953");
    northPanel.setLayout(new FlowLayout());
    northPanel.add(monthLabel);
    //CENTER
    centerPanel.setLayout(new GridLayout(5,7));
    days = new JButton[35];
    for (int i = 0; i <35; i++){
    jb = new JButton(String.valueOf(i));
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,1,1,1));
    jb.setFocusPainted(false);
    jb.setActionCommand("D");
    jb.addActionListener(this);
    days = jb;
    centerPanel.add(jb);
    //SOUTH
    southPanel.setLayout(new FlowLayout());
    southPanel.add(this.makeButton("<<"));
    southPanel.add(this.makeButton("<"));
    southPanel.add(this.makeButton(">"));
    southPanel.add(this.makeButton(">>"));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(northPanel, "North");
    mainPanel.add(centerPanel,"Center");
    mainPanel.add(southPanel, "South");
    this.getContentPane().add(mainPanel);
    this.setSize(150,150);
    caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
    try{
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e){}
    final DateChooser dc = new DateChooser();
    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel jp = new JPanel();
    final JTextField jff = new JTextField("The date field will hold the result.");
    JButton jb = new JButton("...");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
    jff.setText("" + df.format(dc.getCalendar().getTime()));
    jp.add(jff);
    jp.add(jb);
    jf.getContentPane().add(jp);
    jf.setSize(300,300);
    jf.show();
    //set up location of the dialog
    dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
    JButton jb = new JButton(caption);
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,4,1,4));
    jb.setFocusPainted(false);
    jb.setActionCommand(caption);
    jb.addActionListener(this);
    return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
    this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
    this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
    int field;
    if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
    if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
    if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
    if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
    caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
    calendar = newCalendar;
    }

  • Help edit this code pliz

    Hi I got this code of the net which displays a calendar and when a date
    is selected from the calendar it is displayed in the textfield.
    At the moment if nothing is selected from the calendar it displays the first of the month in the textField.
    I want the calendar to work in such a way that if nothing is selected from the calendar then no changes are made to the textfield.
    Can someone help me out?
    Well the thing to look at is the main method.
    the main method:
    jb.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   dc.show();
                   jff.setText("" + dc.getCalendar().getTime());     
    The component works by exposing a Calendar object,
    which has been initialized to the first of the month.
    I think to change this, you would need to wrap the Calendar in
    a new method of Datechooser, like getDateText(). It
    would have code like
    return this.dateTextString;
    The DateChooser's actionPerformed method would need to
    update the dateTextString variable that this new
    method would expose...
    I don't have time to do this... can someone do this for me....pliz
    Thanks alot
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
    //TODO: submit to resource bundle for internationalization
    private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
    private JButton[] days = null;
    private JLabel monthLabel = null;
    private Calendar calendar = null;
    private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
    super();
    this.setModal(true);
    initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
    String text;
    if (e.getActionCommand().equals("D")){
    //return a date
    text = ((JButton) e.getSource()).getText();
    if (text.length() > 0){
    this.returnDate(text);
    } else {
    Toolkit.getDefaultToolkit().beep();
    } else {
    this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
    Calendar cal = this.getCalendar();
    int startPos;
    int currentMonth = cal.get(Calendar.MONTH);
    //for painting ease, quick display
    mainPanel.setVisible(false);
    //set month
    monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
    //set to first day
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
    //now work the day labels
    startPos = cal.get(Calendar.DAY_OF_WEEK);
    for (int i = startPos - 1; i < days.length; i++) {
    days.setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    if (cal.get(Calendar.DATE) == 1) {
    //clear remaining labels going forward
    for (int j = i + 1; j < days.length; j++) {
    days[j].setText("");
    break;
    //work first week
    for (int h = 0; h < startPos - 1; h++) {
    if (cal.get(Calendar.DATE) > 25 ) {
    days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    } else {
    days[h].setText("");
    this.setCalendar(cal);
    mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
    if (this.calendar == null){
    calendar = Calendar.getInstance();
    return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
    JButton jb;
    /* layout:
    North panel: month + year display
    Center Panel: buttons for the days, 5 by 7 grid
    South Panel: navigation buttons */
    mainPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel centerPanel = new JPanel();
    JPanel southPanel = new JPanel();
    //widgets
    //NORTH
    monthLabel = new JLabel(months[9] + " 1953");
    northPanel.setLayout(new FlowLayout());
    northPanel.add(monthLabel);
    //CENTER
    centerPanel.setLayout(new GridLayout(5,7));
    days = new JButton[35];
    for (int i = 0; i <35; i++){
    jb = new JButton(String.valueOf(i));
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,1,1,1));
    jb.setFocusPainted(false);
    jb.setActionCommand("D");
    jb.addActionListener(this);
    days = jb;
    centerPanel.add(jb);
    //SOUTH
    southPanel.setLayout(new FlowLayout());
    southPanel.add(this.makeButton("<<"));
    southPanel.add(this.makeButton("<"));
    southPanel.add(this.makeButton(">"));
    southPanel.add(this.makeButton(">>"));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(northPanel, "North");
    mainPanel.add(centerPanel,"Center");
    mainPanel.add(southPanel, "South");
    this.getContentPane().add(mainPanel);
    this.setSize(150,150);
    caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
    try{
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e){}
    final DateChooser dc = new DateChooser();
    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel jp = new JPanel();
    final JTextField jff = new JTextField("The date field will hold the result.");
    JButton jb = new JButton("...");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
    jff.setText("" + df.format(dc.getCalendar().getTime()));
    jp.add(jff);
    jp.add(jb);
    jf.getContentPane().add(jp);
    jf.setSize(300,300);
    jf.show();
    //set up location of the dialog
    dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
    JButton jb = new JButton(caption);
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,4,1,4));
    jb.setFocusPainted(false);
    jb.setActionCommand(caption);
    jb.addActionListener(this);
    return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
    this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
    this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
    int field;
    if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
    if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
    if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
    if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
    caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
    calendar = newCalendar;

    there are 2 errors in ur code which i removed and run the application.I dont understand really what is ur task??the text filed shows this text "The date field will hold the result." if calender is not selected.here is ur code.now withour errors
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.Date;
    import java.util.Calendar;
    * dialog to allow user to select a date and return
    * a java.util.Date object
    * Creation date: (2/5/00 10:57:04 AM)
    public class DateChooser extends JDialog implements ActionListener {
    //TODO: submit to resource bundle for internationalization
    private String[] months = {"Jan","Feb", "Mar","Apr", "May","June","July","Aug","Sept","Oct","Nov","Dec"};
    private JButton[] days = null;
    private JLabel monthLabel = null;
    private Calendar calendar = null;
    private JPanel mainPanel = null;
    * DateChooser constructor comment.
    public DateChooser() {
    super();
    this.setModal(true);
    initialize();
    * deal with all the buttons that may be pressed
    * Creation date: (2/5/00 11:36:11 AM)
    * @param e java.awt.event.ActionEvent
    public void actionPerformed(ActionEvent e) {
    String text;
    if (e.getActionCommand().equals("D")){
    //return a date
    text = ((JButton) e.getSource()).getText();
    if (text.length() > 0){
    this.returnDate(text);
    } else {
    Toolkit.getDefaultToolkit().beep();
    } else {
    this.roll(e.getActionCommand());
    * repaint the window with the supplied calendar date
    * Creation date: (2/5/00 11:04:03 AM)
    * @param d java.util.Date
    private void caption() {
    Calendar cal = this.getCalendar();
    int startPos;
    int currentMonth = cal.get(Calendar.MONTH);
    //for painting ease, quick display
    mainPanel.setVisible(false);
    //set month
    monthLabel.setText(months[cal.get(Calendar.MONTH)] + " " + cal.get(Calendar.YEAR));
    //set to first day
    cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1);
    //now work the day labels
    startPos = cal.get(Calendar.DAY_OF_WEEK);
    for (int i = startPos - 1; i < days.length; i++) {
    days.setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    if (cal.get(Calendar.DATE) == 1) {
    //clear remaining labels going forward
    for (int j = i + 1; j < days.length; j++) {
    days[j].setText("");
    break;
    //work first week
    for (int h = 0; h < startPos - 1; h++) {
    if (cal.get(Calendar.DATE) > 25 ) {
    days[h].setText(String.valueOf(cal.get(Calendar.DATE)));
    cal.roll(Calendar.DATE, true);
    } else {
    days[h].setText("");
    this.setCalendar(cal);
    mainPanel.setVisible(true);
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @return java.util.Calendar
    public java.util.Calendar getCalendar() {
    if (this.calendar == null){
    calendar = Calendar.getInstance();
    return calendar;
    * set up the layout and look of the dialog
    * but don't do any data yet.
    * Creation date: (2/5/00 11:02:37 AM)
    private void initialize() {
    JButton jb;
    /* layout:
    North panel: month + year display
    Center Panel: buttons for the days, 5 by 7 grid
    South Panel: navigation buttons */
    mainPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel centerPanel = new JPanel();
    JPanel southPanel = new JPanel();
    //widgets
    //NORTH
    monthLabel = new JLabel(months[9] + " 1953");
    northPanel.setLayout(new FlowLayout());
    northPanel.add(monthLabel);
    //CENTER
    centerPanel.setLayout(new GridLayout(5,7));
    days = new JButton[35];
    for (int i = 0; i <35; i++){
    jb = new JButton(String.valueOf(i));
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,1,1,1));
    jb.setFocusPainted(false);
    jb.setActionCommand("D");
    jb.addActionListener(this);
    days[i] = jb;
    centerPanel.add(jb);
    //SOUTH
    southPanel.setLayout(new FlowLayout());
    southPanel.add(this.makeButton("<<"));
    southPanel.add(this.makeButton("<"));
    southPanel.add(this.makeButton(">"));
    southPanel.add(this.makeButton(">>"));
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(northPanel, "North");
    mainPanel.add(centerPanel,"Center");
    mainPanel.add(southPanel, "South");
    this.getContentPane().add(mainPanel);
    this.setSize(150,150);
    caption();
    * for testing only.
    * Creation date: (2/5/00 11:19:35 AM)
    * @param args java.lang.String[]
    public static void main(String[] args) {
    try{
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e){}
    final DateChooser dc = new DateChooser();
    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel jp = new JPanel();
    final JTextField jff = new JTextField("The date field will hold the result.");
    JButton jb = new JButton("...");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    dc.show();
    java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM);
    System.out.println(df.format(new java.util.Date()));
    jff.setText("" + df.format(dc.getCalendar().getTime()));
    jp.add(jff);
    jp.add(jb);
    jf.getContentPane().add(jp);
    jf.setSize(300,300);
    jf.show();
    //set up location of the dialog
    dc.setLocationRelativeTo(jb);
    * return a button to the control Panel
    * Creation date: (2/5/00 10:57:59 AM)
    * @return java.lang.String
    private JButton makeButton(String caption) {
    JButton jb = new JButton(caption);
    jb.setSize(25,25);
    jb.setBorder(new EmptyBorder(1,4,1,4));
    jb.setFocusPainted(false);
    jb.setActionCommand(caption);
    jb.addActionListener(this);
    return jb;
    * roll the calendar to the day
    * then hide the dialog
    * Creation date: (2/5/00 11:40:31 AM)
    * @param day java.lang.String
    private void returnDate(String day) {
    this.getCalendar().set(this.getCalendar().get(Calendar.YEAR),this.getCalendar().get(Calendar.MONTH),Integer.parseInt(day));
    this.setVisible(false);
    * which way to roll the calendar
    * Creation date: (2/5/00 11:46:42 AM)
    * @param direction java.lang.String
    private void roll(String direction) {
    int field;
    if (direction.equals(">>")) calendar.roll(Calendar.YEAR,true);
    if (direction.equals(">")) calendar.roll(Calendar.MONTH,true);
    if (direction.equals("<<")) calendar.roll(Calendar.YEAR,false);
    if (direction.equals("<")) calendar.roll(Calendar.MONTH,false);
    caption();
    * Insert the method's description here.
    * Creation date: (2/5/00 1:12:24 PM)
    * @param newCalendar java.util.Calendar
    public void setCalendar(java.util.Calendar newCalendar) {
    calendar = newCalendar;

  • Pls help in this code

    Hi All,
    please let me know, if this code is right ??
    I want to select data and move to ind fields,
    data : w_post_code1 like adrc-post_code1,
           w_post_code2 like adrc-post_code2.
    SELECT single POST_CODE1 POST_CODE2  INTO
    ( w_post_code1 w_post_code2 )  from adrc
    WHERE ADDRNUMBER eq s_adrnr .
    endselect.
    thank you.
    madhu

    Hi,
    Please try this.
    DATA: W_POST_CODE1 LIKE ADRC-POST_CODE1,
          W_POST_CODE2 LIKE ADRC-POST_CODE2.
    SELECT SINGLE POST_CODE1 POST_CODE2 INTO
    (W_POST_CODE1, W_POST_CODE2) FROM ADRC
    WHERE ADDRNUMBER EQ S_ADRNR .
                                                                                    WRITE:  W_POST_CODE1,  W_POST_CODE2.
    Regards,
    Ferry Lianto

  • I need help with this code

    Hello could any one tell me why this code is not writing to a file a i want to store what ever i enter in the applet a a file called applications.text
    Code:
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.applet.Applet.*;
    import javax.swing.border.*;
    public class ChinaTown5 extends JApplet
              implements ItemListener, ActionListener {
              private int foodIngrd1 = 0 ,foodIngrd2 = 0, foodIngrd3 = 0, foodIngrd4 = 0;
              private int foodIngrd5 = 0, foodIngrd6 = 0;                                    
              private JCheckBox hockey, football, swimming, golf, tennis, badminton;
              private String fName, lName, add, post_code, tel, url, datejoined,flag = "f1";
              private String value, converter, gender, sportType, show, sport, readData;
              private JRadioButton male, female;
              private JButton submit, clear, display;
              private DataInputStream receive;
              private DataOutputStream send;
              private String archive;
              Socket echoSocket = null;
    PrintWriter out = null;
    BufferedReader in = null;
              private JTextField joining_date;
              private JTextField textFName;
              private JTextField textLName;
              private JTextField telephone;
              private JTextField postcode;
              private JTextField address;
              private JTextField website;
              private JTextArea output,recieved;
              private double info = 0.0;
              private     ButtonGroup c;
              Socket Client ;
              public void init() {
                   JPanel main = new JPanel();     
                   JPanel info = new JPanel();
                   JPanel gender = new JPanel();
                   JPanel txt= new JPanel();
                   JPanel txtArea= new JPanel();
                   main.setLayout( new BorderLayout());
                   gender.setLayout(new GridLayout(1,2));
                   info.setLayout (new GridLayout(3,2 ));
                   txt.setLayout(new GridLayout(17,1));
                   txtArea.setLayout(new GridLayout(2,1));                                   
                   c = new ButtonGroup();
                   male = new JRadioButton("Male", false);
                   female = new JRadioButton("Female", false);
                   c.add(male);
                   c.add(female);
                   gender.add(male);
                   gender.add(female);
                   male.addItemListener(this);
                   female.addItemListener(this);
                   hockey = new JCheckBox ("Hockey");
                   info.add (hockey);
                   hockey.addItemListener (this);
                   football = new JCheckBox ("Football");
                   info.add (football);
                   football.addItemListener (this);
                   swimming = new JCheckBox ("Swimming");
                   info.add (swimming);
                   swimming.addItemListener (this);
                   tennis = new JCheckBox ("Tennis");
                   info.add (tennis);
                   tennis.addItemListener (this);
                   golf = new JCheckBox ("Golf");
                   info.add (golf);
                   golf.addItemListener (this);
                   badminton = new JCheckBox ("Badminton");
                   info.add (badminton);
                   badminton.addItemListener (this);
                   txt.add (new JLabel("First Name:"));
                   textFName = new JTextField(20);
                   txt.add("Center",textFName);
                   textFName.addActionListener (this);
                   txt.add (new JLabel("Last Name:"));
                   textLName = new JTextField(20);
                   txt.add("Center",textLName);
                   textLName.addActionListener (this);
                   txt.add (new JLabel("Telephone:"));
                   telephone = new JTextField(15);
                   txt.add("Center",telephone);
                   telephone.addActionListener (this);
                   txt.add (new JLabel("Date Joined:"));
                   joining_date = new JTextField(10);
                   txt.add("Center",joining_date);
                   joining_date.addActionListener (this);
                   txt.add (new JLabel("Address:"));
                   address = new JTextField(40);
                   txt.add("Center",address);
                   address.addActionListener (this);
                   txt.add (new JLabel("Postcode:"));
                   postcode = new JTextField(15);
                   txt.add("Center",postcode);
                   postcode.addActionListener (this);
                   txt.add (new JLabel("URL Address:"));
                   website = new JTextField(25);
                   txt.add("Center",website);
                   website.addActionListener (this);
                   output = new JTextArea( 15, 45);
                   output.setEditable( false );
                   output.setFont( new Font( "Arial", Font.BOLD, 12));
                   recieved = new JTextArea( 10, 40);
                   recieved .setEditable( false );
                   recieved .setFont( new Font( "Arial", Font.BOLD, 12));
                   txtArea.add(output);
                   txtArea.add(recieved);
                   submit = new JButton ("Submit Details");
                   submit.setEnabled(false);
                   info.add (submit);
                   submit.addActionListener(this);
                   clear = new JButton ("Clear Form");
                   clear.addActionListener(this);
                   info.add (clear);
                   display = new JButton ("Display");
                   display.addActionListener(this);
                   info.add (display);
                   EtchedBorder border = new EtchedBorder();
                   gender.setBorder(new TitledBorder(border,"Sex" ));
                   main.setBorder(new TitledBorder(border,"Computer Programmers Sports Club" ));
                   EtchedBorder border_sport = new EtchedBorder();
                   info.setBorder(new TitledBorder(border_sport," Select Preferred Sport(s)" ));
                   EtchedBorder border_info = new EtchedBorder();
                   txt.setBorder(new TitledBorder(border_info ," Personal Information" ));
                   EtchedBorder border_txtArea= new EtchedBorder();
                   txtArea.setBorder(new TitledBorder(border_info ," Registration Details" ));
                   main.add("North",txt);
                   main.add("West",gender);
                   main.add("East",info);
                   main.add("South",txtArea);
                   setContentPane(main);
              public void itemStateChanged (ItemEvent event) {
                   if (event.getItemSelectable() == male) {
                        gender = "Male";
                   else if (event.getItemSelectable() == female) {
                        gender = "Female";
                   if (event.getSource() == hockey) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + hockey.getLabel() + " ";
                   else if (event.getSource() == golf) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + golf.getLabel() + " ";
                   else if (event.getSource() == badminton) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + badminton.getLabel() + " ";
                   else if (event.getSource() == swimming) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + swimming.getLabel() + " ";
                   else if (event.getSource() == tennis) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + tennis.getLabel() + " ";
                   else if (event.getSource() == football) {
                             if (event.getStateChange() == ItemEvent.SELECTED) {
                                  sport = sport + football.getLabel() + " ";
                   chkError();
                   repaint();
              public void chkError() {
                   if (gender != " " && sport != " " && fName != " " && lName != " "
                        && add != " " && post_code != " " && datejoined != " " ) {
                        submit.setEnabled(true);
              public void errMsg() {
                        JOptionPane.showMessageDialog( null, "Please Enter your Name and address and date joined and your sex");
                        show = (      "\n\t\t **************************************************" +
                                       "\n\t\t\t Error" +
                                       "\n\t\t **************************************************" +
                                       "\n\n\t Please Enter your Name and address and date joined and your sex");
                        output.setText( show );               
              public void displayDetails() {          
                   show = ( "\n\t\t **************************************************" +
                             "\n\t\t\t Registration Details" +
                             "\n\t\t **************************************************" +
                             "\n\t First Name:" + "\t" + fName +
                             "\n\t Last name: " + "\t" + lName +
                             "\n\t Sex:" + "\t" + gender +
                             "\n\t Tel No:" + "\t" + tel +
                             "\n\t Url Address:" + "\t" + url +
                             "\n\t Address:" + "\t" + add +
                             "\n\t Postcode:" + "\t" + post_code +
                             "\n\t Sport:" + "\t" + sport +
                             "\n\n\t\t\t Thank You For Registering" );
                   output.setText( show );
              public void LogFile() {
                   archive = ("\n\t First Name:" + "\t" + fName +
                             "\n\t Last name: " + "\t" + lName +
                             "\n\t Sex:" + "\t" + gender +
                             "\n\t Tel No:" + "\t" + tel +
                             "\n\t Url Address:" + "\t" + url +
                             "\n\t Address:" + "\t" + add +
                             "\n\t Postcode:" + "\t" + post_code +
                             "\n\t Sport:" + "\t" + sport);
                   try {
              BufferedWriter out = new BufferedWriter(new FileWriter("applications.txt"));
              out.write(archive);
              out.close();
              catch ( IOException e) {System.out.println("Exception: File Not Found");}
              public void actionPerformed (ActionEvent e){
                   if ( e.getSource() == submit) {
                        datejoined = joining_date.getText();
                        post_code = postcode.getText();
                        fName = textFName.getText();
                        lName = textLName.getText();
                        add = address.getText();
                        tel = telephone.getText();
                        url = website.getText();
                        if ( gender != " " && sport != " " && fName != " " && lName != " "
                        && add != " " && post_code != " " && datejoined != " " ) {     
                        LogFile();
                        displayDetails();
                        else { errMsg(); }
                   if (e.getSource() == display) {
                        try {
                             BufferedReader reader = new BufferedReader(new FileReader(new File("applications.txt")));
                             String readData;
                             while( (readData = reader.readLine()) != null ){     
                                  out.println(readData);
                                  recieved.setText(readData);
                        catch (IOException err) {System.err.println("Error: " + err);}          
                   if ( e.getSource() == clear ) {
                        badminton.setSelected(false);
                        swimming.setSelected(false);
                        football.setSelected(false);
                        tennis.setSelected(false);
                        hockey.setSelected(false);
                        golf.setSelected(false);
                        female.setSelected(false);
                        male.setSelected(false);
         textFName.setText(" ");
                        textLName.setText(" ");
                        address.setText(" ");
                        postcode.setText(" ");
                        telephone.setText(" ");
                        website.setText(" ");
                        joining_date.setText(" ");
                        output.setText(" ");
                        gender = " ";
                        sport = " ";
              repaint ();
    }

    Why isn't it writing to a file? Most likely because it's an applet and you haven't signed it. Applets are not allowed to access data on the client system like that.

  • Need Help on this Code Immediately

    Hi Friends,
    Iam very new to java.
    I have a Java Code that iam trying to Run. The Code Compiles fine but it fails on its 3rd Loop where it is trying to Run a report.
    I have the Code part that is errorring out. Can someone please look into the code and tell me if i need to make any changes to the Code.
    The Code when Executed gives an Error "The Client Did Something Wrong".
    Please Help Me!!!
          * Execute a report.
          *@param     path     This is the search path to the report.
          *@param     format     The array that contains the format options (PDF,HTML,etc...)
         public void executeReport(String path,String[] format)
              ParameterValue pv[] = new ParameterValue[]{};
              Option ro[] = new Option[3];
              RunOptionBoolean saveOutput = new RunOptionBoolean();
              RunOptionStringArray rosa = new RunOptionStringArray();
              RunOptionBoolean burstable = new RunOptionBoolean();
              // Define that the report to save the output.
              saveOutput.setName(RunOptionEnum.saveOutput);
              saveOutput.setValue(true);
              // What format do we want the report in: PDF? HTML? XML?
              rosa.setName(RunOptionEnum.outputFormat);
              rosa.setValue(format);
              // Define that the report can be burst.
              burstable.setName(RunOptionEnum.burst);
              burstable.setValue(true);
              // Fill the array with the run options.
              ro[0] = rosa;
              ro[1] = saveOutput;
              ro[2] = burstable;
              try
                   SearchPathSingleObject spSingle = new SearchPathSingleObject();
                   spSingle.setValue(path);
                   // Get the initial response.
                   AsynchReply res = reportService.run(spSingle,pv,ro);
                   // If it has not yet completed, keep waiting until it is done.
                   // In this case, we wait forever.
                   while (res.getStatus() != AsynchReplyStatusEnum.complete && res.getStatus() != AsynchReplyStatusEnum.conversationComplete)
                        res = reportService.wait(res.getPrimaryRequest(), new ParameterValue[]{}, new Option[]{});
                   reportService.release(res.getPrimaryRequest());
                   // Return the final response.
              catch (Exception e)
                   System.out.println(e);
         }

    Guess I was too late. Sorry
    Inestead of posting you need help on code immediately how about intest posting the particular topic that you are working on. It's quite doubtful that you would be here if you didn't have a question.

  • I need help in this code

    wazap guys ? long time not 2 see U :)
    i need help , this application that will follow is supposed to count the words lengths
    i.e if typed "I am poprage" the program will output :
    the word length the occurence
    1 1
    2 1
    3
    4
    5
    6
    7 1
    compile it & u will understand it.
    the problem is that it makes a table for each damen word
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    public class Application2 extends JFrame{
    private JLabel label;
    private JTextField field;
    private JTextArea area;
    private JScrollPane scroll;
    private int count;
    public Application2(){
    super("Application 2 / Word Length");
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    label = new JLabel("Enter The Text Here");
    c.add(label);
    field = new JTextField(30);
    field.addActionListener(
    new ActionListener(){
    public void actionPerformed(ActionEvent e){
    StringTokenizer s = new StringTokenizer(e.getActionCommand());
    count = s.countTokens();
    while(s.hasMoreTokens()){
    count--;
    pop(s.nextToken());
    c.add(field);
    area = new JTextArea(10,30);
    area.setEditable(false);
    c.add(area);
    scroll = new JScrollPane(area);
    c.add(scroll);
    setSize(500,500);
    show();
    public void pop (String s){
    String poprage = "";
    int count1 = 0;
    int count2 = 0;
    int count3 = 0;
    int count4 = 0;
    int count5 = 0;
    int count6 = 0;
    int count7 = 0;
    int count8 = 0;
    int count9 = 0;
    int count10 = 0;
    int count11 = 0;
    int count12 = 0;
    int count13 = 0;
    int count14 = 0;
    int count15 = 0;
    int count16 = 0;
    int count17 = 0;
    int count18 = 0;
    int count19 = 0;
    int count20 = 0;
    int count21 = 0;
    int count22 = 0;
    int count23 = 0;
    int count24 = 0;
    int count25 = 0;
    for(int i = 0; i < s.length(); i++){
    if(s.length() == 1) count1 += 1;
    else if(s.length() == 2) count2 += 1;
    else if(s.length() == 3) count3 += 1;
    else if(s.length() == 4) count4 += 1;
    else if(s.length() == 5) count5 += 1;
    else if(s.length() == 6) count6 += 1;
    else if(s.length() == 7) count7 += 1;
    else if(s.length() == 8) count8 += 1;
    else if(s.length() == 9) count9 += 1;
    else if(s.length() == 10) count10 += 1;
    else if(s.length() == 11) count11 += 1;
    else if(s.length() == 12) count12 += 1;
    else if(s.length() == 13) count13 += 1;
    else if(s.length() == 14) count14 += 1;
    else if(s.length() == 15) count15 += 1;
    else if(s.length() == 16) count16 += 1;
    else if(s.length() == 17) count17 += 1;
    else if(s.length() == 18) count18 += 1;
    else if(s.length() == 19) count19 += 1;
    else if(s.length() == 20) count20 += 1;
    else if(s.length() == 21) count21 += 1;
    else if(s.length() == 22) count22 += 1;
    else if(s.length() == 23) count23 += 1;
    else if(s.length() == 24) count24 += 1;
    else if(s.length() == 25) count25 += 1;
    poprage += "The Length\t"+"The Occurence\n"+
    "1\t"+count1+"\n"+
    "2\t"+count2+"\n"+
    "3\t"+count3+"\n"+
    "4\t"+count4+"\n"+
    "5\t"+count5+"\n"+
    "6\t"+count6+"\n"+
    "7\t"+count7+"\n"+
    "8\t"+count8+"\n"+
    "9\t"+count9+"\n"+
    "10\t"+count10+"\n"+
    "11\t"+count11+"\n"+
    "12\t"+count12+"\n"+
    "13\t"+count13+"\n"+
    "14\t"+count14+"\n"+
    "15\t"+count15+"\n"+
    "16\t"+count16+"\n"+
    "17\t"+count17+"\n"+
    "18\t"+count18+"\n"+
    "19\t"+count19+"\n"+
    "20\t"+count20+"\n"+
    "21\t"+count21+"\n"+
    "22\t"+count22+"\n"+
    "23\t"+count23+"\n"+
    "24\t"+count24+"\n"+
    "25\t"+count25+"\n";
    area.append(poprage);
    public static void main (String ar[]){
    Application2 a = new Application2();
    a.addWindowListener(
    new WindowAdapter(){
    public void windowClosing( WindowEvent e ){
    System.exit(0);
    can any one fix it ???????
    REGARDS.

    Okay, so I took a look at it, where you are having the problem is that your pop() method not only updated the count variable, but then displays the result each time you call it. and since you call it in the loop, guess what it will give you a "table" for each "damen word"...
    Any way, I was bored enough to "fix" the program and included comments as to what I did and the relative "why"...
    So here goes...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    public class Application2 extends JFrame{
    private JLabel label;
    private JTextField field;
    private JTextArea area;
    private JScrollPane scroll;
    private int count;
    // moved these up here so that all methods in this class
    // can see and modify them, and more importantly so that they would not go
    // out of scope and end up zero'd out before we display the values
    // in the "table", once that done, then we can zero them out.
    // although an array would be better and easier to use... -MaxxDmg...
    private int count1 = 0;private int count2 = 0;
    private int count3 = 0;private int count4 = 0;
    private int count5 = 0;private int count6 = 0;
    private int count7 = 0;private int count8 = 0;
    private int count9 = 0;private int count10 = 0;
    private int count11 = 0;private int count12 = 0;
    private int count13 = 0;private int count14 = 0;
    private int count15 = 0;private int count16 = 0;
    private int count17 = 0;private int count18 = 0;
    private int count19 = 0;private int count20 = 0;
    private int count21 = 0;private int count22 = 0;
    private int count23 = 0;private int count24 = 0;
    private int count25 = 0;
    // end move int count variable declarations  - MaxxDmg...
    public Application2(){
    super("Application 2 / Word Length");
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    label = new JLabel("Enter The Text Here");
    c.add(label);
    field = new JTextField(30);
    field.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    String poprage = ""; // move this here, once pop() loop is done, then this string
    // will be constructed and displayed  - MaxxDmg...
    StringTokenizer s = new StringTokenizer(e.getActionCommand());
    count = s.countTokens();
    while(s.hasMoreTokens()){ // this is the "pop() loop" since it calls pop() to count the words - MaxxDmg...
    count--;
    pop(s.nextToken()); // runs pop which only increments the count variable as needed - MaxxDmg...
    }// end "pop() loop" - MaxxDmg...
    // string poprage constructed one pop() loop is done to display the proper results - MaxxDmg...
    poprage += "The Length\t"+"The Occurence\n"+"1\t"+count1+"\n"+
    "2\t"+count2+"\n" + "3\t"+count3+"\n" + "4\t"+count4+"\n" +
    "5\t"+count5+"\n" + "6\t"+count6+"\n" + "7\t"+count7+"\n" +
    "8\t"+count8+"\n" + "9\t"+count9+"\n" + "10\t"+count10+"\n" +
    "11\t"+count11+"\n" + "12\t"+count12+"\n" + "13\t"+count13+"\n" +
    "14\t"+count14+"\n" + "15\t"+count15+"\n" + "16\t"+count16+"\n" +
    "17\t"+count17+"\n" + "18\t"+count18+"\n" + "19\t"+count19+"\n" +
    "20\t"+count20+"\n" + "21\t"+count21+"\n" + "22\t"+count22+"\n"+
    "23\t"+count23+"\n" + "24\t"+count24+"\n" + "25\t"+count25+"\n";
    area.append(poprage);
    // end string construction and area update...  - MaxxDmg...
    // all int count variable set to 0 for next usage - MaxxDmg...
    count = 0;
    count1 = 0;count2 = 0;count3 = 0;count4 = 0;count5 = 0;
    count6 = 0;count7 = 0;count8 = 0;count9 = 0;count10 = 0;
    count11 = 0;count12 = 0;count13 = 0;count14 = 0;count15 = 0;
    count16 = 0;count17 = 0;count18 = 0;count19 = 0;count20 = 0;
    count21 = 0;count22 = 0;count23 = 0;count24 = 0;count25 = 0;
    // end count variable reset... - MaxxDmg...
    c.add(field);
    area = new JTextArea(10,30);
    area.setEditable(false);
    c.add(area);
    scroll = new JScrollPane(area);
    c.add(scroll);
    setSize(500,500);
    show();
    public void pop (String s){
    // now all this method does is increment the count variables - MaxxDmg...
    // which will eliminate the "making a table" for each "damen word" - MaxxDmg...
    if(s.length() == 1) count1 += 1;
    else if(s.length() == 2) count2 += 1;
    else if(s.length() == 3) count3 += 1;
    else if(s.length() == 4) count4 += 1;
    else if(s.length() == 5) count5 += 1;
    else if(s.length() == 6) count6 += 1;
    else if(s.length() == 7) count7 += 1;
    else if(s.length() == 8) count8 += 1;
    else if(s.length() == 9) count9 += 1;
    else if(s.length() == 10) count10 += 1;
    else if(s.length() == 11) count11 += 1;
    else if(s.length() == 12) count12 += 1;
    else if(s.length() == 13) count13 += 1;
    else if(s.length() == 14) count14 += 1;
    else if(s.length() == 15) count15 += 1;
    else if(s.length() == 16) count16 += 1;
    else if(s.length() == 17) count17 += 1;
    else if(s.length() == 18) count18 += 1;
    else if(s.length() == 19) count19 += 1;
    else if(s.length() == 20) count20 += 1;
    else if(s.length() == 21) count21 += 1;
    else if(s.length() == 22) count22 += 1;
    else if(s.length() == 23) count23 += 1;
    else if(s.length() == 24) count24 += 1;
    else if(s.length() == 25) count25 += 1;
    }// end modified pop() method - MaxxDmg...
    public static void main (String ar[]){
    Application2 a = new Application2();
    a.addWindowListener(
    new WindowAdapter(){
    public void windowClosing( WindowEvent e ){
    System.exit(0);
    }So read the comments, look at the code and compare it to the original. You will see why the original did not give you the results you wanted, while the fixed version will...
    - MaxxDmg...
    - ' He who never sleeps... '

  • Need Help with this code

    I am very new to java (just started today), and I am trying to do a mortgage calculator in java. I have a class file which I am using but when I try to compile it, I get the error message "Exception in thread "main" java.lang.NoClassDefFoundError: Mortgage Loan". I realize that this means I am missing a public static void somewhere (sounds like I know what I am talking about huh?) The problem is I don't know where to put it or even what to put in it. I got the code from another site and it seems to work fine there. Here is the code for the class file....any help anyone can offer will be greatly appreciated. thx
    import KJEgraph.*;
    import KJEgui.*;
    import java.applet.Applet;
    import java.awt.*;
    import java.io.PrintStream;
    public class MortgageLoan extends CalculatorApplet
    public MortgageLoan()
    RC = new MortgageLoanCalculation();
    cmbPREPAY_TYPE = new KJEChoice();
    lbLOAN_AMOUNT = new Label("");
    lbINTEREST_PAID = new Label("");
    lbTOTAL_OF_PAYMENTS = new Label("");
    lbMONTHLY_PI = new Label("");
    lbMONTHLY_PITI = new Label("");
    lbPREPAY_INTEREST_SAVINGS = new Label("");
    public double getPayment()
    calculate();
    return RC.MONTHLY_PI;
    public void initCalculatorApplet()
    tfINTEREST_RATE = new Nbr("INTEREST_RATE", "Interest rate", 1.0D, 25D, 3, 4, this);
    tfTERM = new Nbr("TERM", "Term", 0.0D, 30D, 0, 5, this);
    tfLOAN_AMOUNT = new Nbr("LOAN_AMOUNT", "Mortgage amount", 100D, 100000000D, 0, 3, this);
    tfPREPAY_STARTS_WITH = new Nbr("PREPAY_STARTS_WITH", "Start with payment", 0.0D, 360D, 0, 5, this);
    tfPREPAY_AMOUNT = new Nbr("PREPAY_AMOUNT", "Amount", 0.0D, 1000000D, 0, 3, this);
    if(getParameter("PAYMENT_PI") == null)
    tfPAYMENT_PI = new Nbr(0.0D, getParameter("MSG_PAYMENT_PI", "Payment"), 0.0D, 10000D, 0, 3);
    else
    tfPAYMENT_PI = new Nbr("PAYMENT_PI", "Payment", 0.0D, 10000D, 0, 3, this);
    tfYEARLY_PROPERTY_TAXES = new Nbr("YEARLY_PROPERTY_TAXES", "Annual property taxes", 0.0D, 100000D, 0, 3, this);
    tfYEARLY_HOME_INSURANCE = new Nbr("YEARLY_HOME_INSURANCE", "Annual home insurance", 0.0D, 100000D, 0, 3, this);
    super.nStack = 1;
    super.bUseNorth = false;
    super.bUseSouth = true;
    super.bUseWest = true;
    super.bUseEast = false;
    RC.PREPAY_NONE = getParameter("MSG_PREPAY_NONE", RC.PREPAY_NONE);
    RC.PREPAY_MONTHLY = getParameter("MSG_PREPAY_MONTHLY", RC.PREPAY_MONTHLY);
    RC.PREPAY_YEARLY = getParameter("MSG_PREPAY_YEARLY", RC.PREPAY_YEARLY);
    RC.PREPAY_ONETIME = getParameter("MSG_PREPAY_ONETIME", RC.PREPAY_ONETIME);
    RC.MSG_YEAR_NUMBER = getParameter("MSG_YEAR_NUMBER", RC.MSG_YEAR_NUMBER);
    RC.MSG_PRINCIPAL = getParameter("MSG_PRINCIPAL", RC.MSG_PRINCIPAL);
    RC.MSG_INTEREST = getParameter("MSG_INTEREST", RC.MSG_INTEREST);
    RC.MSG_PAYMENT_NUMBER = getParameter("MSG_PAYMENT_NUMBER", RC.MSG_PAYMENT_NUMBER);
    RC.MSG_PRINCIPAL_BALANCE = getParameter("MSG_PRINCIPAL_BALANCE", RC.MSG_PRINCIPAL_BALANCE);
    RC.MSG_PREPAYMENTS = getParameter("MSG_PREPAYMENTS", RC.MSG_PREPAYMENTS);
    RC.MSG_NORMAL_PAYMENTS = getParameter("MSG_NORMAL_PAYMENTS", RC.MSG_NORMAL_PAYMENTS);
    RC.MSG_PREPAY_MESSAGE = getParameter("MSG_PREPAY_MESSAGE", RC.MSG_PREPAY_MESSAGE);
    RC.MSG_RETURN_AMOUNT = getParameter("MSG_RETURN_AMOUNT", RC.MSG_RETURN_AMOUNT);
    RC.MSG_RETURN_PAYMENT = getParameter("MSG_RETURN_PAYMENT", RC.MSG_RETURN_PAYMENT);
    RC.MSG_GRAPH_COL1 = getParameter("MSG_GRAPH_COL1", RC.MSG_GRAPH_COL1);
    RC.MSG_GRAPH_COL2 = getParameter("MSG_GRAPH_COL2", RC.MSG_GRAPH_COL2);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_NONE);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_MONTHLY);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_YEARLY);
    cmbPREPAY_TYPE.addItem(RC.PREPAY_ONETIME);
    cmbPREPAY_TYPE.select(getParameter("PREPAY_TYPE", RC.PREPAY_NONE));
    CheckboxGroup checkboxgroup = new CheckboxGroup();
    cbPRINCIPAL = new Checkbox(getParameter("MSG_CHKBOX_PRINCIPAL_BAL", "Principal balances"), checkboxgroup, true);
    cbAMTS_PAID = new Checkbox(getParameter("MSG_CHKBOX_TOTAL_PAYMENTS", "Total payments"), checkboxgroup, false);
    CheckboxGroup checkboxgroup1 = new CheckboxGroup();
    cbYEAR = new Checkbox(getParameter("MSG_CHKBOX_BY_YEAR", "Report amortization schedule by year"), checkboxgroup1, true);
    cbMONTH = new Checkbox(getParameter("MSG_CHKBOX_BY_MONTH", "Report amortization schedule by Month"), checkboxgroup1, false);
    cbYEAR.setBackground(getBackground());
    cbMONTH.setBackground(getBackground());
    setCalculation(RC);
    cmbTERM = getMortgageTermChoice(getParameter("TERM", 30));
    public void initPanels()
    DataPanel datapanel = new DataPanel();
    DataPanel datapanel1 = new DataPanel();
    DataPanel datapanel2 = new DataPanel();
    int i = 1;
    datapanel.setBackground(getColor(1));
    boolean flag = getParameter("SHOW_PITI", false);
    boolean flag1 = getParameter("SHOW_PREPAY", true);
    datapanel.addRow(new Label(" " + getParameter("MSG_LOAN_INFORMATION", "Loan Information") + super._COLON), getBoldFont(), i++);
    datapanel.addRow(tfLOAN_AMOUNT, getPlainFont(), i++);
    bAllTerms = getParameter("SHOW_ALLTERMS", false);
    if(bAllTerms)
    datapanel.addRow(tfTERM, getPlainFont(), i++);
    else
    datapanel.addRow(getParameter("MSG_TERM", "Term") + super._COLON, cmbTERM, getPlainFont(), i++);
    datapanel.addRow(tfINTEREST_RATE, getPlainFont(), i++);
    if(flag)
    datapanel.addRow(tfYEARLY_PROPERTY_TAXES, getPlainFont(), i++);
    datapanel.addRow(tfYEARLY_HOME_INSURANCE, getPlainFont(), i++);
    if(flag)
    datapanel.addRow(getParameter("MSG_MONTHLY_PAYMENT", "Monthly payment (PI)") + " " + super._COLON, lbMONTHLY_PI, getPlainFont(), i++);
    datapanel.addRow(getParameter("MSG_PITI", "Monthly payment (PITI)") + " " + super._COLON, lbMONTHLY_PITI, getPlainFont(), i++);
    } else
    datapanel.addRow(getParameter("MSG_MONTHLY_PAYMENT", "Monthly payment") + " " + super._COLON, lbMONTHLY_PI, getPlainFont(), i++);
    if(!flag || !flag1)
    datapanel.addRow(getParameter("MSG_TOTAL_PAYMENTS", "Total payments") + " " + super._COLON, lbTOTAL_OF_PAYMENTS, getPlainFont(), i++);
    datapanel.addRow(getParameter("MSG_TOTAL_INTEREST", "Total interest") + " " + super._COLON, lbINTEREST_PAID, getPlainFont(), i++);
    datapanel.addRow("", new Label(""), getTinyFont(), i++);
    if(flag1)
    datapanel.addRow(new Label(" " + getParameter("MSG_PREPAYMENTS", "Prepayments") + " " + super._COLON), getBoldFont(), i++);
    datapanel.addRow(getParameter("MSG_PREPAYMENT_TYPE", "Type") + " " + super._COLON, cmbPREPAY_TYPE, getPlainFont(), i++);
    datapanel.addRow(tfPREPAY_AMOUNT, getPlainFont(), i++);
    datapanel.addRow(tfPREPAY_STARTS_WITH, getPlainFont(), i++);
    datapanel.addRow(getParameter("MSG_PREPAYMENT_SAVINGS", "Savings") + " " + super._COLON, lbPREPAY_INTEREST_SAVINGS, getPlainFont(), i++);
    Panel panel = new Panel();
    panel.setBackground(getColor(1));
    panel.setLayout(new BorderLayout());
    panel.add("Center", datapanel);
    panel.add("East", new Label(""));
    cbPRINCIPAL.setBackground(getColor(2));
    cbAMTS_PAID.setBackground(getColor(2));
    datapanel2.setBackground(getColor(2));
    datapanel1.addRow("", cbYEAR, "", cbMONTH, getPlainFont(), 1);
    datapanel2.addRow("", cbPRINCIPAL, "", cbAMTS_PAID, getPlainFont(), 1);
    gGraph = new Graph(new GraphLine(), imageBackground());
    gGraph.FONT_TITLE = getGraphTitleFont();
    gGraph.FONT_BOLD = getBoldFont();
    gGraph.FONT_PLAIN = getPlainFont();
    gGraph.setBackground(getColor(2));
    gGraph.setForeground(getForeground());
    Panel panel1 = new Panel();
    panel1.setLayout(new BorderLayout());
    panel1.add("North", datapanel2);
    panel1.add("Center", gGraph);
    panel1.setBackground(getColor(2));
    addPanel(panel);
    addDataPanel(datapanel1);
    addPanel(panel1);
    public void refresh()
    gGraph._bUseTextImages = false;
    if(cbAMTS_PAID.getState())
    gGraph.setBackground(getColor(2));
    gGraph.removeAll();
    gGraph._legend.setVisible(true);
    gGraph._legend.setOrientation(14);
    gGraph._titleXAxis.setText("");
    gGraph._titleGraph.setText("");
    gGraph._axisX.setVisible(true);
    gGraph._axisY.setVisible(true);
    gGraph.setGraphType(new GraphStacked());
    gGraph.setGraphCatagories(RC.getAmountPaidCatagories());
    try
    gGraph.add(new GraphDataSeries(RC.DS_PRINCIPAL, RC.MSG_PRINCIPAL, getGraphColor(1)));
    gGraph.add(new GraphDataSeries(RC.DS_INTEREST, RC.MSG_INTEREST, getGraphColor(2)));
    gGraph._axisY._bAutoMinimum = false;
    gGraph._axisY._axisMinimum = 0.0F;
    gGraph._axisY._bAutoMaximum = false;
    gGraph._axisY._axisMaximum = (float)(RC.TOTAL_OF_PAYMENTS / (double)RC.iFactor2);
    catch(Exception _ex)
    System.out.println("Huh?");
    gGraph._titleYAxis.setText("");
    gGraph._titleGraph.setText(RC.getAmountLabel2());
    gGraph.dataChanged(true);
    } else
    gGraph.setBackground(getColor(2));
    gGraph.removeAll();
    gGraph._legend.setVisible(true);
    gGraph._legend.setOrientation(4);
    gGraph._titleXAxis.setText(RC.MSG_PAYMENT_NUMBER);
    gGraph._titleGraph.setText("");
    gGraph._titleYAxis.setText(RC.MSG_PRINCIPAL_BALANCE);
    gGraph._axisX.setVisible(true);
    gGraph._axisY.setVisible(true);
    gGraph.setGraphType(new GraphLine());
    gGraph.setGraphCatagories(RC.getCatagories());
    try
    if(cmbPREPAY_TYPE.getSelectedItem().equals(RC.PREPAY_NONE))
    gGraph.add(new GraphDataSeries(RC.DS_PRINCIPAL_BAL, RC.MSG_NORMAL_PAYMENTS, getGraphColor(1)));
    } else
    gGraph.add(new GraphDataSeries(RC.DS_PREPAY_PRINCIPAL_BAL, RC.MSG_PREPAYMENTS, getGraphColor(2)));
    gGraph.add(new GraphDataSeries(RC.DS_PRINCIPAL_BAL, RC.MSG_NORMAL_PAYMENTS, getGraphColor(1)));
    gGraph._axisY._bAutoMinimum = false;
    gGraph._axisY._bAutoMaximum = true;
    gGraph._axisY._axisMinimum = 0.0F;
    catch(Exception _ex)
    System.out.println("Huh?");
    gGraph._titleYAxis.setText(RC.getAmountLabel());
    gGraph._titleGraph.setText("");
    gGraph.dataChanged(true);
    gGraph._titleXAxis.setText(RC.MSG_YEAR_NUMBER);
    lbMONTHLY_PITI.setText(Fmt.dollars(RC.MONTHLY_PITI, 2));
    lbMONTHLY_PI.setText(Fmt.dollars(RC.MONTHLY_PI, 2));
    lbLOAN_AMOUNT.setText(Fmt.dollars(RC.LOAN_AMOUNT));
    lbTOTAL_OF_PAYMENTS.setText(Fmt.dollars(RC.PREPAY_TOTAL_OF_PAYMENTS, 2));
    lbINTEREST_PAID.setText(Fmt.dollars(RC.PREPAY_INTEREST_PAID, 2));
    lbPREPAY_INTEREST_SAVINGS.setText(Fmt.dollars(RC.PREPAY_INTEREST_SAVINGS, 2));
    setTitle("Fixed Mortgage Loan Calculator");
    public void setValues()
    throws NumberFormatException
    RC.PREPAY_TYPE = cmbPREPAY_TYPE.getSelectedItem();
    RC.PREPAY_AMOUNT = tfPREPAY_AMOUNT.toDouble();
    RC.PREPAY_STARTS_WITH = tfPREPAY_STARTS_WITH.toDouble();
    RC.INTEREST_RATE = tfINTEREST_RATE.toDouble();
    RC.YEARLY_PROPERTY_TAXES = tfYEARLY_PROPERTY_TAXES.toDouble();
    RC.YEARLY_HOME_INSURANCE = tfYEARLY_HOME_INSURANCE.toDouble();
    if(bAllTerms)
    RC.TERM = (int)tfTERM.toDouble();
    else
    RC.TERM = getMortgageTerm(cmbTERM);
    RC.LOAN_AMOUNT = tfLOAN_AMOUNT.toDouble();
    if(cbYEAR.getState())
    RC.BY_YEAR = 1;
    else
    RC.BY_YEAR = 0;
    RC.MONTHLY_PI = tfPAYMENT_PI.toDouble();
    if(RC.MONTHLY_PI > 0.0D)
    RC.PAYMENT_CALC = 0;
    else
    RC.PAYMENT_CALC = 1;
    MortgageLoanCalculation RC;
    Nbr tfINTEREST_RATE;
    Choice cmbTERM;
    Nbr tfTERM;
    boolean bAllTerms;
    Nbr tfLOAN_AMOUNT;
    Nbr tfPREPAY_AMOUNT;
    Nbr tfPREPAY_STARTS_WITH;
    Nbr tfPAYMENT_PI;
    Nbr tfYEARLY_PROPERTY_TAXES;
    Nbr tfYEARLY_HOME_INSURANCE;
    KJEChoice cmbPREPAY_TYPE;
    Label lbLOAN_AMOUNT;
    Label lbINTEREST_PAID;
    Label lbTOTAL_OF_PAYMENTS;
    Label lbMONTHLY_PI;
    Label lbMONTHLY_PITI;
    Label lbPREPAY_INTEREST_SAVINGS;
    Checkbox cbPRINCIPAL;
    Checkbox cbAMTS_PAID;
    Graph gGraph;
    Checkbox cbYEAR;
    Checkbox cbMONTH;
    }

    There are imports that aren't available to us, so no. nobody probaly can. Of course maybe someon could be bothered going through all of your code, and may spot some mistake. But I doubt they will since you didn't bother to use [c[b]ode] tags.

  • Adding values to insert query [was: Plz help with this code]

    I have created a comments section in which there is only one field comment here is the code of the form:
    <form id="frmComment" name="frmComment" method="POST" action="<?php echo $editFormAction; ?>">
        <h3>
          <label for="namegd"></label>Comment:</h3>
        <p>
          <label for="comment2"></label>
          <textarea name="comment" id="comment2" cols="60" rows="10" ></textarea>
        </p>
        <p>
          <label for="submit">
          </label>
          <input type="submit" name="submit" id="submit" value="Submit" />
          <label for="reset"></label>
          <input type="reset" name="reset" id="reset" value="Clear" />
        </p>
    <input type="hidden" name="MM_insert" value="frmComment" />
    </form>
    and the insert into code applied to the form is this
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmComment")) {
      $insertSQL = sprintf("INSERT INTO comments (`comment`, ) VALUES (%s)",
                           GetSQLValueString($_POST['comment'], "text"));
      mysql_select_db($database_my_connection, $my_connection);
      $Result1 = mysql_query($insertSQL, $my_connection) or die(mysql_error());
    But I want the form to insert two more values to the database one will be the commented_by and the other will be post_id where commented_by = ($_SESSION['Username']) and post_id = $row_Recordset1['id'] can some one plz let me know what will be the modified code and ya commented_by is a text field and post_id is an int field.
    Plz guys help me Thanks in advance

    Adding the extra values to the insert query is easy:
    $insertSQL = sprintf("INSERT INTO comments (`comment`, commented_by, post_id) VALUES (%s, %s, %s)",
             GetSQLValueString($_POST['comment'], "text"),
             GetSQLValueString($_SESSION['Username'], "text"),
             GetSQLValueString($row_recordset1['id'], "int"));
    You need to make sure that the code for recordset1 comes before the insert query. By default, Dreamweaver places recordset code immediately above the DOCTYPE declaration, and below other server behaviors. So, you need to move the code. Otherwise, this insert query won't work.

  • Please help with this code....

    I create a button with ActionListner and a writeCd method. Now I want everytime i push the button, it will read the writeCd method. I dont' know how to make it work. Please help me out as soon as possible. Thanks a lot. Below are the codes of the button and writeCd method.
    class findCD implements ActionListener
    public void actionPerformed(ActionEvent event)
    //what do I need to put here to make the button work
    //with method writeCD() below
    public void writeCd() throws Exception
    String outputFileName;
    PrintWriter outputFile;
    outputFileName = "D:\\cdoutput.txt";
    outputFile = new PrintWriter(new FileWriter(outputFileName,true));
    int loopTest;
    do
    String numStr = JOptionPane.showInputDialog("Please enter Index number");
    int number = Integer.parseInt(numStr);
    cC.setIndexNumber(number);
    numStr = JOptionPane.showInputDialog("Please enter cd name");
    number = Integer.parseInt(numStr);
    cC.setCdName(number);
    String message = cC.toString() +
    "\nYour input is: ";
    JOptionPane.showMessageDialog(null, message);
    outputFile.println(numStr + "");
    loopTest = JOptionPane.showConfirmDialog(null,"Do another?","",0,1);
    while (loopTest == 0);
    outputFile.close();

    class findCD implements ActionListener
           public void actionPerformed(ActionEvent event)
                try
                     writeCd();
                } catch(Exception e){
                                        e.printStackTrace();
      public void writeCd() throws Exception
          String outputFileName;
          PrintWriter outputFile;
          outputFileName = "D:\\cdoutput.txt";
    outputFile = new PrintWriter(new
    (new FileWriter(outputFileName,true));
             int loopTest;
             do
    String numStr =
    umStr = JOptionPane.showInputDialog("Please enter
    Index number");
             int number = Integer.parseInt(numStr);
             cC.setIndexNumber(number);
    numStr = JOptionPane.showInputDialog("Please
    "Please enter cd name");
             number = Integer.parseInt(numStr);
             cC.setCdName(number);
             String message = cC.toString() +
                              "\nYour input is: ";
             JOptionPane.showMessageDialog(null, message);
            outputFile.println(numStr + "");
    loopTest =
    pTest = JOptionPane.showConfirmDialog(null,"Do
    another?","",0,1);
             while (loopTest == 0);
           outputFile.close();
        }That should work. This also assumes that the method writeCd is in the class findCD.

Maybe you are looking for

  • Smart Album : Inconsistency in the Date Type format used inside Aperture ?

    Hello, After using Aperture 2.0 for some days, I tried to create a Smart Album using as creation option for the Album the Date + "is in the Range" option which is leaving two blank fields for filling the two dates which are supposed to be the date li

  • Issue creating WBS using BAPI_BUS2054_CREATE_MULTI

    Hi All, I am trying to create WBS elements under existing project (CJ20N) using “BAPI_BUS2054_CREATE_MULTI”. I am I am getting “ET_RETURN” with message type ‘S-W-I’, even after commit no WBS created. Type ‘S’ message says “Individual check for creati

  • Importing HTML with Javascript

    Hi folks, I have multiple (but simple) HTML forms that need to be imported as they are. Basically, I want to avoid the work of editing each button's Javascript manually in Acrobat, so I have the form ready in HTML with some JavaScript. Each form butt

  • Export to JPG

    Hi I was looking for exporting the ai file to jpg file using the SDK CS4 I was able to export the ai file to jpg file through the plugin based on the some code from the fourms the issue is i get an html file along with the jpg file when i do a PlayAc

  • New 20Inch Hard drive Size

    I just bought the 20 inch 2.4 G Hz iMac and on the website it says the hard drive is 320gb but my hard drive only has 298gb total, anyone know whats up with that. ps i ran that techtool deluxe and it said my vram failed, what is this crap about thank