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.
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 AMladsoftware 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 -
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 -
Plz Help With This Important Decision
I really need help deciding if i should run bootcamp or not. i have 33 gb left on my hd(i only started w/55.5 after formatting). i just cant decide. plz help!!!
Remember also, you want to keep about 15% of your drive free, so virtual memory will work efficiently.
-Bmer
Mac Owners Support Group
Join Us @ MacOSG.com
ITMS: MacOSG Podcast
An Apple User Group -
Views: Thanks mahesh, plz help with this also
Thanks Mahesh for your note.
Please also let me know that how we can use the foreign key relationship as i have shown in the join conditions. We use the relationship tab on the view maintainence screen to add all the join conditions due to foreign keys, if i am not wrong.
Please help me with this point tooSo what are you trying to do.. you want to check if that entry also exist in sfilght table.. include that table in that tables list and add one more condition in the join conditions...
View Maintenance? i dont see any..
Thansk
Mahesh -
Wow... someone plz help with this
ok so I was under the impression that using an int array buffer to draw on, and then using MemoryImageSource was a hell of a lot faster than having an Image buffer that you drew on and then drew to the screen once the frame was done... It was significantly faster with a raycasting engine I did a while ago. However, I have this new 3d engine (calculates screen-points from vertices) and the first version used an Image buffer. It went about 200 fps with a screen size of about 700,700. However, my new one becomes unuseable with a screen-size greater then 300,300 with only 1 model showing(the original has about 30) and uses MemoryImageSource. The fps in the second is greatly dependent on the screen size so Im thinking it has to do with the buffer, anyone got anything to say about this?
-MikeIf you factor your code cleanly, switching from MemoryImageSource to any java.awt.Image subtype
(BufferedImage or VolatileImage) shouldn't be difficult. I would suggest running some examples
and tests before doing any major changes. The main advantage to VolatileImage is that it tries
to keep it's pixel data in video memory, and that will accellerate blitting. In the jdk 1.4 this
acceleration is done to some BufferedImages and in 1.5 all instances of BufferedImage attempt
to "manage" the pixel data in this way -- you don't have to do anything special to benefit from it,
just use BufferedImage in a straightforward way.
As far as Full-Screen Exclusive Mode, it is a complete change in rendering (assuming you go with
active rendering) and it doesn't mean you will achieve more fps, but as the tutorial states:
If your performance metric is simply the speed at which double-buffering or page-flipping occurs versus
direct rendering, you may be disappointed. You may find that your numbers for direct rendering far exceed
those for double-buffering and that those numbers far exceed those for page-flipping. Each of these
techniques is for used for improving perceived performance, which is much more important in graphical
applications than numerical performance.
Double-buffering is used primarily to eliminate visible draws which can make an application look
amateurish, sluggish, or appear to flicker. Page-flipping is used primarily to also eliminate tearing, a
splitting effect that occurs when drawing to the screen happens faster than the monitor's refresh rate.
Smoother drawing means better perceived performance and a much better user experience. -
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... ;)
MikeHi,
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 -
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.
-
Hello all,
I have to write a jsp program which edits a text file and saves it...
here is what i have written..it prints all the lines in a text file and diplays a ewdit button beside each line...
i would appreciate it if u tell me how to pass an argument to the function respPrompt..
also please tell me how to display content in a dialog box(text box)..
once user makes changes it should save the data in a file..
thanks
rao
<%@page contentType="text/html" import= "javax.swing.*,java.io.*"%>
<%@page pageEncoding="UTF-8"%>
<!-- dialog box when page load to ask questions -->
<%
out.println("<HTML>\n");
out.println("<HEAD><TITLE>Hello</TITLE></HEAD>\n");
out.println( "<BODY BGCOLOR=\"#FDF5E6\">\n"); out.println("<table border=0>");
int counter =0;
int i=1;
String dialog;
String resp;
String res;
String title = "\nList of the Departments and equivalent journels\n";
try{
int j=1;
String editline;
File testFile = new File("C:\\Message.txt");
BufferedReader input = new BufferedReader( new FileReader(testFile) );
File testFile1 = new File("C:\\Message.txt");
BufferedReader input1 = new BufferedReader( new FileReader(testFile1) );
String line = null;
//String favorite = window.prompt("What is your favorite color?", "RED");
while (( line = input.readLine()) != null){
out.println("<tr><td bgcolor=\"#CCCCCC\">");
%>
<input type="button" value="Edit" onClick="respPrompt()">
<% out.println(i+")"+line+"\n\n");
out.println("</td></tr>");
i++;
catch (FileNotFoundException ex) { ex.printStackTrace(); }
%>
<!-- end of dialog box -->
<!-- script to generate htmlArea -->
<script language="JavaScript">
function respPrompt() {
var favorite = prompt('What is your favorite color?', "");
var j = 10;
// if (favorite) equivalent to if (favorite != null && favorite != "");
if (favorite) alert("Your favorite color is: " + favorite);
else alert("You pressed Cancel or no value was entered!");
</script>
</body>
</html>Remember also, you want to keep about 15% of your drive free, so virtual memory will work efficiently.
-Bmer
Mac Owners Support Group
Join Us @ MacOSG.com
ITMS: MacOSG Podcast
An Apple User Group -
Plz help with this applet problem
i made this player in jmf... and i tried to play file over http in it..
player runs as applet in a jsp page.
the prob is i was using .class file for the applet..but it wouldnt open a remote url coz applets run in sandbox mode...
so i signed the applet..which caused it to end up in a jar..
now the jar is perfectly playing remote urls..BUT
it gives NoClassDefFound Error for ControllerListener class
so
1) with .class files it runs in all computers, but opens only files present on same servrer
2) with .jar file it runs only on computers with jmf 2.1.1 installed, others giv the above error
any ideas y this is so?
and how do i add the whole javax.media package to teh jar if need be?
i used:
jar cvf test.jar PlayerApplet.java
but how does ones add javax.media package?
thanksSorry. In that page I have to insert a CODE. I think I can get the code debugging the applet. Not the source code, a CODE that is in a class called Training.class
<applet archive="http://www.mod-x.co.uk/mod_x_LeV_2/M_LeVeL3_od/7nf73b.jar" code="Training.class" width=300 height=50></applet>
Cheers :D
EDIT: Look, more logs in the java console when I leave the page:
basic: New window ID: 0
basic: Stopping applet ...
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter@ab835a
basic: Finding information ...
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@db3331, refcount=0
basic: Caching classloader: sun.plugin.ClassLoaderInfo@db3331
basic: Current classloader cache size: 1
basic: Done ...
basic: Joining applet thread ...
basic: Destroying applet ...
basic: Disposing applet ...
basic: Quiting applet ...
basic: Joined applet thread ...
Cheers :D
Message was edited by:
Tiger -
Need some help with this code.
var myDoc = app.documents[0]
var mySel = app.selection[0]
var myStory = mySel.parentStory; // Now we are pointing to the entire story
var myHolidayStyle1 = "Holiday-Header" // Header 'day of the week'
var myHolidayStyle2 = "Holiday-Sub-Heading-Date" // Header 'month and day'
var myHolidayStyle3 = "Holiday-Header-Body" // Lead Paragraph 'default paragraph style'
if (mystory = "Monday" ) {
paragraphs(0).appliedparagraphstyles = myHolidayStyle1;
else if (mystory = "Tuesday") {
mystory.paragraphs(0). appliedparagraphstyles = myHoldiayStyle1;
else if (mystory = "Wednesday") {
mystory.papragraph(0).appliedparagraphstyles = myHolidayStyle1;
else if (mystory = "Thursday") {
mystory.paragraphs(0).appliedparagraphstyles = myHolidayStyle1;
else if (mystory = "Friday") {
mystory.paragraphs(0).appliedparagraphstyle = myHolidayStyle1;
else if (mystory = "Saturday") {
mystory.paragraphs(0).appliedparagrahstyles = myHolidayStyle1;
else if (mystory = "Sunday") {
mystory.paragraphs(0).appliedparagraphstyles = myHolidayStyle1;
// it finds if in the selection of the month and day if they equal for example Decmeber 15 then applies the HolidaySub-Heading-Date
if (mystory = "December 15") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 15") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 16") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 17") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 18") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 19") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 20") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 21") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 22") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 23") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 24") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
else if (mystory = "December 25") {
mystory. paragraphs(1).appliedparagraphstyles = myHolidayStyle2;
// If text doesn't equal Day of the week like Monday and doesn't equal month and date like Decmber 14
// then the document loops into doing the the rest of the document in Holiday-Header-Body
// not sure if this loop will stop once it reaches another day of the week and then repeat the above tasks again.
if (mystory =! [myHolidayStyle0], [myHolidayStyle1]) { // not sure if I did this IF selection not equal Holidaystyle 0 and style 1 then perform loop, correctly???
for (loop=0; loop<myStory.paragraphs.length; loop++)
myStory.paragraphs[loop].appliedParagraphStyle = myHolidayStyle3;
=============================
==========================
I'm getting a error saying Paragraph is not a function, but nor is mystory.paragraph(0) , so i'm just trying to figure out what synax goes before that.
=============================
The text that is bold is the prolbem i'm having. I just got a Javascript bible on how to program in javascript. How would i make that function work. I'm sure its simple. I'm just hoping I have If some Then ({) command follow by what I want it to do is correct. And I'm understanding this. there is so many different syntax's to choose from, any help would be appreciated. I work for a Newspaper company, and Indesign CS3 Javascript coding is a bit diffrent from normal javascript.Okie, I'm making progress now. Because well it didnt crash, but then again, LOL the script didnt apply the paragraph styles when I selected the text!
any suggestions?
I'm also getting a weird error now with the loop, but I also dont think its working because maybe the myStyle and myStle1 aren't applying themselves correctly, in the first part of the script.
this is the Error Message:
Error Number : 30477
Error String: Invalid value of set propert 'appliedParagraphStyle'. Expected ParagraphStyle or String, but Recieved nothing.
Line: 110
Source: myStory.paragraphs[loop].appliedParagraphStyle = myStyle3;
//var myDoc = app.documents[0]
var mySel = app.selection[0];
var myStory = mySel.parentStory; // Now we are pointing to the entire story
var myStyle = app.activeDocument.paragraphStyles.item ( "Holiday-Header" ) ;
var myStyle1 = app.activeDocument.paragraphStyles.item ( "Holiday-Sub-Heading-Date" ) ;
var myStyle3 = app.activeDocument.paragraphStyles.item ( "Holiday-Header-Body" ) ;
if (myStory.contents == "Monday" ) {
myStory.paragraphs.appliedParagraphStyle = myStyle;
else if (myStory.contents == "Tuesday") {
myStory.paragraphs[0]. appliedParagraphStyle = myStyle;
if (myStory.contents == "Wednesday") {
myStory.papragraph[0].appliedparagraphstyle = myStyle;
else if (myStory.contents == "Thursday") {
myStory.paragraphs[0].appliedparagraphstyle = myStyle;
if (myStory.contents == "Friday") {
myStory.paragraphs[0].appliedparagraphstyle = myStyle;
else if (myStory.contents == "Saturday") {
myStory.paragraphs[0].appliedparagrahstyle = myStyle;
if (myStory.contents == "Sunday") {
myStory.paragraphs[0].appliedparagraphstyle = myStyle;
// it finds if in the selection of the month and day if they equal for example Decmeber 15 then applies the HolidaySub-Heading-Date
if (myStory.contents == "December 2") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 3") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 4") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 5") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 6") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 7") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 8") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 9") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 10") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 11") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 12") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 13") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 14") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 15") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 16") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 17") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 18") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 19") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 20") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 21") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 22") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 23") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
if (myStory.contents == "December 24") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
else if (myStory.contents == "December 25") {
myStory. paragraphs[1].appliedparagraphstyle = myStyle1;
// If text doesn't equal Day of the week like Monday and doesn't equal month and date like Decmber 14
// then the document loops into doing the the rest of the document in Holiday-Header-Body
// not sure if this loop will stop once it reaches another day of the week and then repeat the above tasks again.
// not sure if I did this IF selection not equal mystyle and mystyle1 then perform loop, is done correctly???
if (myStory.contents != (myStyle && myStyle1)) {
for (loop=0; loop<myStory.paragraphs.length; loop++)
myStory.paragraphs[loop].appliedParagraphStyle = myStyle3;
I'm truly grateful for the Support and Assistance everyone has been providing me, I'm learning, and I thank you all for your help. -
Need a little help with this code
Hi,
right now I'm going through the xmlmenu tutorial, which I've
found at kirupa.com. It's pretty much clear to me. Then I decided
to try to import a blur filter. And as soon as I wright the import
flash.filter line, I get a syntax error. Where is the problem? How
do I get button's blurx/y = 0 onRollover? I was thinking to apply
the filter to menuitem mc (see the code)
Here's the codeyes, you are right - flash.filters. Another "syntax error"
;-). I did manage to get it work (the import line part). My next
question is to which MC must I apply the blur filter to get next
result:
by default the buttons are blured. OnRollOver the button gets
cleared of blur. Here's my blur code:
var myBlur = new flash.filters.BlurFilter(20,20,2);
var myTempFilters:Array = _root.mainmenu_mc.filters;
->which MC must be here to get the wanted result??????
myTempFilters.push(myBlur);
_root.mainmenu_mc.filters = myTempFilters;
curr_item.onRollOut = function() {
myBlur.blurX = 20;
myBlur.blurY = 20;
this.filters = new Array(myBlur);
curr_item.onRollOver = function() {
myBlur.blurX = 0;
myBlur.blurY = 0;
this.filters = new Array(myBlur);
THX for your help -
I need help with this code involving making stuff in safari appear the same in internet explorer
In the Preview mode, Safari shows it the way I want it too
look, but when I go to view it on Internet Explorer, the window
look blank. When I check the 'veiw source code' for it it shows all
the codes I have for it. I'm guessing because I'm using positioning
in CSS and HTML its not aligning right in explorer. But I heard
from one of my friends that there is a code that somehow makes it
so that the webpage looks the same for safari and internet
explorer. He said he didn't know the code, and I've can't find it
on the web so far, so maybe somebody here knows what I'm talking
about? He said all I had to do is enter the code in the code panel
and it should work.Looks like you did not close the JavaScript comments on the
portfolio page:
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr;
for(i=0;a&&i<a.length&&(x=a
)&&x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new
Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for
(i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers
.document);
if(!x && d.getElementById) x=d.getElementById(n);
return x;
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new
Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x;
if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
</script>
Try adding the closing comment just above the closing
</script> tag, like this:
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr;
for(i=0;a&&i<a.length&&(x=a
)&&x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new
Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for
(i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers
.document);
if(!x && d.getElementById) x=d.getElementById(n);
return x;
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new
Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x;
if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
//-->
</script>
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com
"SCathey" <[email protected]> wrote in
message news:[email protected]...
>
http://myweb.usf.edu/~scathey/
Theres the link. The home, resume, and bio page
> seems to work fine, but when I check the portfollio
page, thats when it turns
> blank in internet explorer. I used a javascript slide
show code for those
> pages, but I used a similar code like that and I had no
previous problems. I
> just want to know if there is a code that allows the
codes to work the same in
> all browsers.
> -
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.
-
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
-
Hi, I have a HP Laserjet 4 and I moved to Thailand. First question is what is the wattage on this unit so i can get a power converter to use it? Second can this run on 220V from 110V purchased in America? Or does it need to have the power supply c
-
JTextPane and RTF line returns
I'm wondering is there anyway to use a line return with JTextPane's? I'm not sure if thats what they're called but what i'm talking about is the RTF equivelent of <BR>. I tried importing a file with line returns and none of they were treated as a spa
-
How do I open an htm file with Firefox 3.6.14?
I have downloaded a photo with file extension htm. It suggests only Firefox. When I double click on the download it just opens a Facebook page which I can't open it from
-
I have 2 macs at home; the imac (latest 10.8.2) works fine, but my rMBP will not update pages documents in the cloud. anything that is opened/modified will show a dotted outline cloud and will say that it's pending the update, but it never happens.
-
Fetching from a cursor and writing to a file in Pro*C
Hi guys, I have a situation in hand here and I guess my "C" skills are putting me up to the test. My cursor is fetching 3 records and its all fine. I am also being able to sprintf those details and the fprintf also works perfectly -- except when I co