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?
thanks
Sorry. 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
Similar Messages
-
Please I really need help with this video problem.
Hi!
Please I need help with this app I am trying to make for an Android cellphone and I've been struggling with this for a couple of months.
I have a main flash file (video player.fla) that will load external swf files. This is the main screen.When I click the Sets Anteriores button I want to open another swf file called sets.swf.The app is freezing when I click Sets Anteriores button
Here is the code for this fla file.
import flash.events.MouseEvent;
preloaderBar.visible = false;
var loader:Loader = new Loader();
btHome.enabled = false;
var filme : String = "";
carregaFilme("home.swf");
function carregaFilme(filme : String ) :void
var reqMovie:URLRequest = new URLRequest(filme);
loader.load(reqMovie);
loader.contentLoaderInfo.addEventListener(Event.OPEN,comeco);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progresso);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completo);
palco.addChild(loader);
function comeco(event:Event):void
preloaderBar.visible = true;
preloaderBar.barra.scaleX = 0;
function progresso(e:ProgressEvent):void
var perc:Number = e.bytesLoaded / e.bytesTotal;
preloaderBar.percent.text = Math.ceil(perc*100).toString();
preloaderBar.barra.scaleX = perc;
function completo(e:Event):void
preloaderBar.percent.text = '';
preloaderBar.visible = false;
btHome.addEventListener(MouseEvent.MOUSE_DOWN,onHomeDown);
btHome.addEventListener(MouseEvent.MOUSE_UP,onHomeUp);
btSets.addEventListener(MouseEvent.MOUSE_DOWN,onSetsDown);
btSets.addEventListener(MouseEvent.MOUSE_UP,onSetsUp);
btVivo.addEventListener(MouseEvent.MOUSE_DOWN,onVivoDown);
btVivo.addEventListener(MouseEvent.MOUSE_UP,onVivoUp);
btHome.addEventListener(MouseEvent.CLICK,onHomeClick);
btSets.addEventListener(MouseEvent.CLICK,onSetsClick);
function onSetsClick(Event : MouseEvent) : void
if (filme != "sets.swf")
filme = "sets.swf";
carregaFilme("sets.swf");
function onHomeClick(Event : MouseEvent) : void
if (filme != "home.swf")
filme = "home.swf";
carregaFilme("home.swf");
function onHomeDown(Event : MouseEvent) : void
btHome.y += 1;
function onHomeUp(Event : MouseEvent) : void
btHome.y -= 1;
function onSetsDown(Event : MouseEvent) : void
btSets.y += 1;
function onSetsUp(Event : MouseEvent) : void
btSets.y -= 1;
function onVivoDown(Event : MouseEvent) : void
btVivo.y += 1;
function onVivoUp(Event : MouseEvent) : void
btVivo.y -= 1;
Now this is the sets.fla file:
Here is the code for sets.fla
import flash.utils.Timer;
import flash.events.TimerEvent;
var video:Video;
var nc:NetConnection;
var ns:NetStream;
var t : Timer = new Timer(1000,0);
var meta:Object = new Object();
this.addEventListener(Event.ADDED_TO_STAGE,init);
function init(e:Event):void{
video= new Video(320, 240);
addChild(video);
video.x = 80;
video.y = 100;
nc= new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
ns.bufferTime = 1;
ns.client = meta;
video.attachNetStream(ns);
ns.play("http://www.djchambinho.com/videos/segundaquinta.flv");
ns.pause();
t.addEventListener(TimerEvent.TIMER,timeHandler);
t.start();
function onStatusEvent(stat:Object):void
trace(stat.info.code);
meta.onMetaData = function(meta:Object)
trace(meta.duration);
function timeHandler(event : TimerEvent) : void
if (ns.bytesLoaded>0&&ns.bytesLoaded == ns.bytesTotal )
ns.resume();
t.removeEventListener(TimerEvent.TIMER,timeHandler);
t.stop();
The problem is when I test it on my computer it works but when I upload it to my phone it freezes when I click Sets Anteriores button.
Please help me with this problem I dont know what else to do.
thank youMy first guess is you're simply generating an error. You'll always want to load this on your device in quick debugging over USB so you can see any errors you're generating.
Outside that, if you plan on accessing anything inside the SWF you should be loading the SWF into the correct context. Relevant sample code:
var context:LoaderContext = new LoaderContext();
context.securityDomain = SecurityDomain.currentDomain;
context.applicationDomain = ApplicationDomain.currentDomain;
var urlReq:URLRequest = new URLRequest("http://www.[your_domain_here].com/library.swf");
var ldr:Loader = new Loader();
ldr.load(urlReq, context);
More information:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7de0.html
If you're doing this on iOS you'll need to stripped SWFs if you plan on using any coding (ABC) inside the files. You mentioned iOS so I won't get into that here, but just incase, here's info on stripping external SWFs:
http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air- apps-on-ios/ -
Plz help with deploying applet that uses SSL
Hi, maybe this is not the adecuate forum but ive already tried in others and i got no answer.
Im trying to use a certificate with my applet ( tha sends a lot of info to the server and also connects to another hibernate db) but im getting this error:
Server side:
username is: Panda
Registered the SSLServerSocket on port 6969
Listening ....
---- Got a connection from a client
this is an unknown client
!!!!!!Error in reading or writing from/to the client:
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at PaqueteServidor.Server$handleRequest.run(Server.java:130)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.getSession(Unknown Source)
at PaqueteServidor.Server.printClientCerts(Server.java:47)
at PaqueteServidor.Server.run(Server.java:100)
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at PaqueteServidor.Server$handleRequest.run(Server.java:130)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.getSession(Unknown Source)
at PaqueteServidor.Server.printClientCerts(Server.java:47)
at PaqueteServidor.Server.run(Server.java:100)
Client side:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at Interfaz.InterfazMovil.init(InterfazMovil.java:89)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown Source)
... 14 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
at java.security.cert.CertPathBuilder.build(Unknown Source)
... 19 more
19:40:34,444 INFO Environment:464 - Hibernate 3.0.5
19:40:34,444 INFO Environment:477 - hibernate.properties not found
19:40:34,444 INFO Environment:510 - using CGLIB reflection optimizer
19:40:34,454 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
19:40:34,645 INFO Configuration:1110 - configuring from resource: /bd/hibernate/hibernate.cfg.xml
19:40:34,645 INFO Configuration:1081 - Configuration resource: /bd/hibernate/hibernate.cfg.xml
19:40:35,045 ERROR XMLHelper:59 - Error parsing XML: /bd/hibernate/hibernate.cfg.xml(21) The content of elements must consist of well-formed character data or markup.
19:40:35,045 ERROR Configuration:1172 - problem parsing configuration/bd/hibernate/hibernate.cfg.xml
org.dom4j.DocumentException: Error on line 21 of document : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at bd.hibernate.HibernateUtil.currentSession(HibernateUtil.java:51)
at bd.controlador.CLetrero.ListarLetreros(CLetrero.java:45)
at Interfaz.InterfazMovil.init(InterfazMovil.java:126)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Nested exception:
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at bd.hibernate.HibernateUtil.currentSession(HibernateUtil.java:51)
at bd.controlador.CLetrero.ListarLetreros(CLetrero.java:45)
at Interfaz.InterfazMovil.init(InterfazMovil.java:126)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
%%%% Error Creating SessionFactory %%%%
org.hibernate.HibernateException: problem parsing configuration/bd/hibernate/hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1173)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at bd.hibernate.HibernateUtil.currentSession(HibernateUtil.java:51)
at bd.controlador.CLetrero.ListarLetreros(CLetrero.java:45)
at Interfaz.InterfazMovil.init(InterfazMovil.java:126)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.dom4j.DocumentException: Error on line 21 of document : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1168)
... 6 more
java.lang.NullPointerException
at bd.hibernate.HibernateUtil.currentSession(HibernateUtil.java:59)
at bd.controlador.CLetrero.ListarLetreros(CLetrero.java:45)
at Interfaz.InterfazMovil.init(InterfazMovil.java:126)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Plz help and thx in advance.I know I didn't get round to replying but no need to post it so many times.
http://forum.java.sun.com/thread.jspa?threadID=666870
http://forum.java.sun.com/profile.jspa?userID=543817
http://forum.java.sun.com/thread.jspa?threadID=669965
http://forum.java.sun.com/profile.jspa?userID=543817
http://forum.java.sun.com/thread.jspa?threadID=669975
http://forum.java.sun.com/thread.jspa?threadID=669973
Could it be that the server and client need to open different keystores?
http://forums.java.sun.com/thread.jspa?threadID=573918&messageID=3272683
reply 7
My example given before should work on different machines, try to export the server key and import it into the
client keystore. Export the client key and import in the server keystore if you want the server to authenticate
the client.
http://forum.java.sun.com/thread.jspa?threadID=666870
reply 4
Check the method getSSLSocketFactory in the applet, that will open a keystore for you. -
Still Need Help with this String Problem
basically, i need to create a program where I input 5 words and then the program outputs the number of unique words and the words themselves. for example, if i input the word hello 5 times, then the output is 1 unique word and the word "hello". i have been agonizing over this dumb problem for days, i know how to do it using hashmap, but this is an introductory course and we cannot use more complex java functions, does ANYONE know how to do this just using arrays, strings, for loops, if clauses, etc. really basic java stuff. i want the code to be able to do what the following program does:
import java.io.*; import java.util.ArrayList;
public class MoreUnique {
public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = new String[5]; int uniqueEntries = 0; ArrayList<String> ue = new ArrayList<String>();
for (int i = 0; i < 5; i++) { System.out.print((i +1) + ": "); str[i] = br.readLine(); }
for (int j = 0; j < 5; j++) {
if (!ue.contains(str[j].toLowerCase())) { ue.add(str[j].toLowerCase()); } } uniqueEntries = ue.size(); System.out.print("Number of unique entries: " + uniqueEntries + " { ");
for (int q = 0; q < ue.size(); q++ ) { System.out.print(ue.get(q) + " "); } System.out.println("}"); } } but i need to find how to do it so all 5 words are put in at once on one line, and without all the advanced java functions that are in here, can anyone help out?you have to compare string 0 to strings 1-4, then
string 1 with strings 2-4, then string 2 with strings
3 and 4 then string 3 with string 4....right???Here's a way to do it:
public class MoreUnique {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final int NUM_WORDS = 5;
String[] words = new String[NUM_WORDS];
int uniqueEntries = 0;
for(int i = 0; i < NUM_WORDS; i++) {
System.out.print((i+1)+": ");
String temp = br.readLine();
if(!contains(temp, words)) {
words[uniqueEntries++] = temp;
System.out.print("Number of unique entries: "+uniqueEntries+" { ");
for (int i = 0; i < uniqueEntries; i++ ) {
System.out.print(words[i]+" ");
System.out.println("}");
private static boolean contains(String word, String[] array) {
Your code here: just a simple for-statement to
loop through your array and to see if 'word'
is in your 'array'.
}Try to fill in the blanks.
Good luck. -
I need help with the following book problem...could someone write this code for me?? Thanks!!
First design and implement a class called PairOfDice, composed of two six-sided Die objects. Using the PairOfDice class, design and implement a class to play a game called Pig. In this game, the user competes against the computer. On each turn, the current player rolls a pair of dice and accumulates points. The goal is to reach 100 points before your opponent does. If, on any turn, the player rolls a 1, all points accumulated for that round are forfeited and control of the dice moves to the other player. If the player rolls two 1s in one turn, the player loses all points accumulated thus far in the game and loses control of the dice. The player may voluntarily turn over the dice after each roll. Therefore the player must decide to either roll again (be a pig) and risk losing points, or relinquish control of the dice, possibly allowing the other player to win. Implement the computer player such that it always relinquishes the dice after accumulating 20 or more points in any given round.
I realize this is a long code, so it would be greatly appreciated to anyone who writes this one for me, or can at least give me any parts of it. I honestly have no clue how to do this because our professor is a dumbass and just expects us to know how to do this...he doesn't teach us this stuff...don't ask. Anyways, thanks for taking the time to read this and I hope someone helps out!! Thank you in advance to anyone who does!!!Nasty comments? It's not a matter of not liking you, it's a matter of responding to the
"I'ts everyone else's fault but mine" attitude of your post.
If you are genuine, the program is very easy to write, so, your Professor is correct when he said you should
be able to do it. I'm still very much in the beginner category at java, and it took me only 20 mins to write
(+5 mins to design it on paper). 2 classes in one file < 100 lines. Most of the regulars here would do it in half the time / half the lines.
All of the clues are in the description, break them down into their various if / else conditions. Write it down on paper.
Have a go. Try to achieve something. Post what you've tried, no-one will laugh at you, and you will be
pleasanty surprised at the level of help you will get when you've "obviously" made some effort.
Again, have a go. If you don't like problem-solving, then you don't like programming. So, you gotta ask
yourself - "what am I doin' here?" -
Help with this occurring problem group differs on Library should be 0 group is 80
Please can someone help me with the following problems when using disk utility.
Keep getting the same repeating errors after repairing.
Group differs on "Library:; should be 0; group is 80
Permissions differ on "Library"; should be drwxr-xr-x; they are drwxrwxr-t.
Group differs on :Library/Preferences:; should be 0; group is 80.
Permissions differ on "Library/Preferences"; should be drwxr-xr-x; they are drwxrwxr-x.You can safely ignore it:
http://support.apple.com/kb/ts1448 -
Plz help with me gui problem(arraylist)
my program
stocksymbol ------------------ stockname ------------------ enter
(label) (textfield) (label) (textfield) (button)
create a gui application using jframe and jpanel so that user can enter stock details(symbol,name) when user press "enter(button)" the text entered in the textfield should be add to an arraylist.
when we close the window ,we have to print the items present in the arraylist....
i have created all the components but iam getting difficult in display the arraylist when i close the window
i have created these classes
public class Stock {?}
public class StockEntryFrame extends JFrame {
// code to allow the frame to handle a window closing event ? when the window is closed,
// the stock list should be printed. ?
public class StockEntryPanel extends JPanel {
public StockEntryPanel(ArrayList<Stock> stockList) {
can u plz help me how to diplay the contents in arraylistMY PROGRAM IS LIKE THIS:::::::::
STOCKNAME-----------
STOCKSYMBOL---------
STOCK PRICE--------
ENTER(BUTTON)
WHEN USER ENTERS HIS INPUT IN THE TEXT BOX AND PRESS ENTER, THEN THE TEXT PRESENT IN THE TEXTBOX SHOULD BE ENTERED INTO AN ARRAYLIST.
THIS IS A GUI PROGRAM......
WHEN WE CLOSE THE FRAME ,WE HAVE TO DISPLAY THE CONTENTS PRESENT IN THE ARRAYLIST
I HAVE CREATED THE PROGRAM LIKE THIS
CLASS STOCKENTRYPANEL EXTENDS JPANEL
//ADDING ALL THE COMPONETNS TO THE PANEL
CLASS STOCKENTRY FRAME EXTENDS JFRAME
//ADDING PANEL TO THE FRAME
//I NEED THE CODE HERE
WHEN WE CLOSE THE WINDOW THE ARRAYLIST DETAILS SHOULD BE PRINTED
} -
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 -
Let's see who can help with this applet
Hello. I am new in Java and confused with this assignment.
I have to write an applet for a store that sells 8 products
whose retails prices are Product 1 - $2.98, Product 2 - $4.50, Product 3 - $9.98, Product 4 - $ 4.49, Product 5 - $ 6.87,
Product 6 � $ 12.37, Product 7 - $ 14.30 and Product 8 - $ 11.40.
The applet: 1) Has an intro message to a store named for you, where you describe what products they have, 2) Reads a series of pairs of numbers: Product Number and Quantity Number.
Use a switch structure to determine the retail prices for each product. Use "TextField" to obtain the product number from the user. Use a �sentinel controlled� loop to determine when the program should stop looping to display the final result (I used number -1 as sentinel). Display the total value of all products sold.
This is the program I wrote:
//java core packages
import java.awt.*;
import java.awt.event.*;
import java.text.NumberFormat;
import java.util.Locale;
// Java extension packages
import javax.swing.*;
public class MYSHOP extends JApplet implements ActionListener {
// GUI componentes
JLabel productNumLabel, quantityNumLabel;
JTextField productNumField, quantityNumField;
// variables
double subtotal = 0;
double total = 0;
public void init()
// display intro message
JOptionPane.showMessageDialog( null, "Welcome toablabla.\nWe
offer you blablabla\nClick OK to start shoping",
"Company information", JOptionPane.PLAIN_MESSAGE );
// obtain content pane and set its layout to FlowLayout
Container container = getContentPane();
container.setLayout( new FlowLayout() );
// create productNumLabel, productNumField and attach them to
// content pane
productNumLabel = new JLabel( "Enter Product Number (-1 to
quit):" );
productNumField = new JTextField( 4 );
productNumField.addActionListener( this );
container.add( productNumLabel );
container.add( productNumField );
// create productNumLabel, productNumField and attach them to
// content pane
quantityNumLabel = new JLabel("Enter Quantity:");
quantityNumField = new JTextField( 4 );
quantityNumField.addActionListener( this );
container.add( quantityNumLabel );
container.add( quantityNumField );
} // end method init
public void actionPerformed( ActionEvent actionEvent )
int index = Integer.parseInt( productNumField.getText() );
int ammount = 0;
while ( index != -1 )
NumberFormat moneyFormat =
NumberFormat.getCurrencyInstance( Locale.US );
if( actionEvent == quantityNumField.getText() )
ammount = Integer.parseInt( quantityNumField.getText() );
switch (index)
case 1:
subtotal += ( 2.98 * ammount );
break;
case 2:
subtotal += ( 4.5 * ammount );
break;
case 3:
subtotal += ( 9.98 * ammount );
break;
case 4:
subtotal += ( 4.49 * ammount );
break;
case 5:
subtotal += ( 6.87 * ammount );
break;
case 6:
subtotal += ( 12.37 * ammount );
break;
case 7:
subtotal += ( 14.30 * ammount );
break;
case 8:
subtotal += ( 11.40 * ammount );
break;
case -1:showStatus( "The Total is: " + subtotal );
System.exit(0);
break;
default:
JOptionPane.showMessageDialog( null,"There is no
such product", "ERROR",
JOptionPane.ERROR_MESSAGE);
} // end switch structure
} // end while structure
productNumField.setText(""); // clear productNum field
quantityNumField.setText(""); // clear quantityNum field
} // end method actionPerformed
} // end class MYSHOP
When I try to compile it, the error I get is "incomparable types: java.awt.event.ActionEvent and java.lang.String", in the line:
if( actionEvent == quantityNumField.getText() )
The error pointer points to "==" in that line
What should I write in that line instead?
Also, if someone realizes that some part of the code is in the wrong place, please tell me.
Thanks in advance.Instead of
if( actionEvent == quantityNumField.getText() ) I think you want
if( actionEvent.getSource() == quantityNumField )HTH,
Radish21 -
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 -
Please, help with this strange problem
Hi,
I'm trying to get the serial value of a informix serial column after inserting a record. I'm using the ifxjdbc driver for Informix (v 2.2).
I've written the code below:
Connection conn = null;
PreparedStatement st = null;
try
conn = ds.getConnection();
st = conn.prepareStatement("INSERT INTO Comunicats (vchTitle) "+
"VALUES (?)");
st.setString(1,vchTitle);
if (st.executeUpdate() != 1) throw new EJBException();
/** Now getting the Primary key inserted **/
long sCodCom = ((IfmxStatement)st).getSerial();
st.close();
conn.close();
where I'm getting the connection from a datasource (ds) connected to a Informix pool using that driver (com.informix.jdbc.ifxDriver)
This code inserts the row but fails getting the serial value. The error message is:
"java.lang.ClassCastException: weblogic.jdbc.rmi.SerialPreparedStatement (...) "
Obviously, the cast ((IfmxStatement)st) doesn't work.
If I change how to get the connection, and I use the DriverManager and declare a Statement st variable (instead of a preparedStatement variable):
conn = DriverManager.getConnection(Informix_Url);
Statement st = conn.createStatement();
int nRet = st.executeUpdate("INSERT INTO ...");
Then it works.
But I don't wanna use the DriverManager. I wanna use my pool and datasource to get the connection.
Has anybody tried something similar successfully?
Thanks a lot.
Joan.Hello jbalaguero,
We are now facing the same problem ie. it works with DriverManager connection but not with Weblogic Connection Pool connection!
Where you able to solve this problem? If yes please tell how!
Thanks.
Hi,
I'm trying to get the serial value of a informix
serial column after inserting a record. I'm using the
ifxjdbc driver for Informix (v 2.2).
I've written the code below:
Connection conn = null;
PreparedStatement st = null;
try
conn = ds.getConnection();
st = conn.prepareStatement("INSERT INTO Comunicats
(vchTitle) "+
"VALUES (?)");
st.setString(1,vchTitle);
if (st.executeUpdate() != 1) throw new
EJBException();
/** Now getting the Primary key inserted **/
long sCodCom = ((IfmxStatement)st).getSerial();
st.close();
conn.close();
where I'm getting the connection from a datasource
(ds) connected to a Informix pool using that driver
(com.informix.jdbc.ifxDriver)
This code inserts the row but fails getting the serial
value. The error message is:
"java.lang.ClassCastException:
weblogic.jdbc.rmi.SerialPreparedStatement (...) "
Obviously, the cast ((IfmxStatement)st) doesn't work.
If I change how to get the connection, and I use the
DriverManager and declare a Statement st variable
(instead of a preparedStatement variable):
conn = DriverManager.getConnection(Informix_Url);
Statement st = conn.createStatement();
int nRet = st.executeUpdate("INSERT INTO ...");
Then it works.
But I don't wanna use the DriverManager. I wanna use
my pool and datasource to get the connection.
Has anybody tried something similar successfully?
Thanks a lot.
Joan. -
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 advanceAdding 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. -
Another Videora Post- I just need help with this one problem, please!
I am guessing that the best way to convert your videos to an iPod compatible format is Videora. It works lovely, except for one glitch. I notice that the audio is noticeably off when I play the video. Any solution on how to fix this? I would really appreciate it if anyone helped me out on this
Windows XPIt is on both, I am thinking.. I tried it with a movie avi file, and it always comes out off.
-
HELP With This Big Problem (TEXT ON HOMESCREEN)
I need to know how to put my own text on my homescreen where the time and battery is etc ive read over some few threads im lost i need some steps please help i really would like this feature on my phone
please be specific, what txt? a picture txt? SMS icon?
please provide BB model and OS version -
Please help with this select problem.
Hi,
I am trying to run the following PL-SQL:
declare
p binary_integer := 2;
begin
loop
insert into xyz
values
(p, (select time_b from xyz where id = (p - 1)) + (time '00:00:01' - time '00:00:00'), 'text');
loop_count := loop_count + 1;
exit when loop_count = 10;
end loop;
end;
When I run this, I get the error "encountered the symbol "select" when expecting one of the following symbols..." However, When I run the following query, it inserts the appropriate record:
insert into xyz
values
(p, (select time_b from xyz where id = 1) + (time '00:00:01' - time '00:00:00'), 'text');
Anybody help?
Thanks,
Message was edited by:
user494578And do you have a good reason to use PL/SQL instead of plain SQL ?
In SQL you could just do this:
SQL> create table xyz
2 as
3 select 0 x, sysdate time_b, 'text' text from dual
4 /
Tabel is aangemaakt.
SQL> set verify off
SQL> define P_LAST_X=idle
SQL> define P_LAST_TIME_B=idle
SQL> column x new_value P_LAST_X
SQL> column time_b new_value P_LAST_TIME_B
SQL> select max(x) x
2 , to_char(max(time_b) keep (dense_rank last order by x),'dd-mm-yyyy hh24:mi:ss') time_b
3 from xyz
4 /
X TIME_B
0 11-10-2006 16:58:07
1 rij is geselecteerd.
SQL> insert into xyz
2 select &P_LAST_X + l
3 , to_date('&P_LAST_TIME_B','dd-mm-yyyy hh24:mi:ss') + l/24/60/60
4 , 'text'
5 from (select level l from dual connect by level <= 10)
6 /
10 rijen zijn aangemaakt.
SQL> select * from xyz
2 /
X TIME_B TEXT
0 11-10-2006 16:58:07 text
1 11-10-2006 16:58:08 text
2 11-10-2006 16:58:09 text
3 11-10-2006 16:58:10 text
4 11-10-2006 16:58:11 text
5 11-10-2006 16:58:12 text
6 11-10-2006 16:58:13 text
7 11-10-2006 16:58:14 text
8 11-10-2006 16:58:15 text
9 11-10-2006 16:58:16 text
10 11-10-2006 16:58:17 textHope this helps.
Regards,
Rob.
Maybe you are looking for
-
Firefox stops responding almost everytime I use Facebook
When I scroll down on Facebook or try to go to a game, Firefox stops responding for 10 to 45 seconds and comes on again. When i start scrolling it stops responding again. this problem occurs quite regularly
-
Hi, I have a doubt on functioning of Before or After Triggers. Here is an example of it: I created a trigger on EMP table create or replace trigger tri11 before insert or update or delete on emp for each row begin if to_char(sysdate,'dy')='fri' then
-
i am writing a code in jsp which should download a xml file in client machine. now the problem is while loading it is showing to store the .jsp file to be stored which is storing it in xml format , but the alert message shown is showning to save as s
-
Pricing unit in condition type..
Hi folks, I have a problem with " pricing unit". Iam using condition type EK01 . Under normal circumstance, the pricing unit takes the value of 1.. Suddenly, it is taking 100 as value. Can anyone give a clue from where this, Pricing Unit picks thi
-
52" TV on 50" Wall Mount?
I was wondering if the ...."Sanus - Tilting Wall Mount for 30 " - 50" Flat-Panel TVs - Black" ...will work with a 52" Samsung LN52A750 HDTV?Is the 30-50" limit based on size? or weight also?Thanks, Bill