|
Ah yes I forgot he wanted to make this an applet. He could use a:
JOptionPane.showInputDialogue("Question to be asked?");
This is a real simple way which I did on one of my applet program...Though I think it defeats the purpose of being an applet lol.
|
|
|
|
|
shawndeprey wrote: Also, I do not see where your enum places the string "right", and "wrong", in the variables of the enum. I would suggest just using simple string values for this, it would be much simpler.
What does this mean? I don't understand what you are trying to say here. What do you mean when you talk about "the variables of the enum"? Using an enum in this case seems to be overkill compared to a simple boolean but the way it is defined and used looks correct to me unless I am missing something.
|
|
|
|
|
David Skelly wrote: unless I am missing something.
Nothing at all, the basic code is OK. Apart from the fact that there is no repeat loop when a wrong answer is given. However the main problem is that this is really a Java application rather than an applet.
|
|
|
|
|
The Java applet class should contain:
1. Two Integers.
2. Integer 1 takes a Math.random
3. Integer 2 takes another Math.random
4. You give the JOptionpane.showinputdialog to ask question dont forget to parse
5. If statement to check result
6. Joptionpane to show the result of if
|
|
|
|
|
|
This is JavaScript, not Java. You are in the wrong forum. Try posting your question in the Web Development forum instead.
|
|
|
|
|
How applet insert in the client and server concept in java.
|
|
|
|
|
Vinoli wrote: How applet insert in the client and server concept in java.
Your question is not clear, can you try and explain what you are trying to do?
|
|
|
|
|
|
That's not a question, but an attempt to promote the product. In my case, you're failing - I'm not going to use a product that's promoted this way.
Now, if you wrote an article, then I might take the time to read it, and perhaps, evaluate the product someday.
I are Troll
|
|
|
|
|
i have a application that contains purchase page which transaction happened through Authorize.net.i want return back to my application ,After submit the form. Is there any possible?
|
|
|
|
|
sangeethanarayan wrote: i have a application that contains purchase page which transaction happened through Authorize.net.i want return back to my application ,After submit the form.
Well its your application ...
sangeethanarayan wrote: Is there any possible?
There are many, what is your question?
|
|
|
|
|
use something like <pre> <a href="newwindowURL" target="_blank" onClick="location.href('oldwindowURL')">click here</a></pre>
|
|
|
|
|
When button is pressed which one finds whether is it double or single click?
|
|
|
|
|
Vinoli wrote: When button is pressed which one finds whether is it double or single click?
You need to implement MouseListener interface. The mouseClicked() accepts argument of type MouseEvent . You could use the getClickCount() method of MouseEvent
Example:
public void mouseClicked(MouseEvent e)
{
System.out.println
( "Click at (" + e.getX() + ":" + e.getY() + ")" );
if (e.getClickCount() == 2)
System.out.println( " and it's a double click!");
else
System.out.println( " and it's a single click!");
}
Regards
Nuri Ismail
|
|
|
|
|
I wrote program for color palatte.The concept is Buttons should have different colors.If any button pressed means particular color should displayed in the background.But buttons should not posses any letter.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
<br />
<br />
public class color extends Applet implements ActionListener<br />
{<br />
Button r,g;<br />
public void init()<br />
{<br />
r=new Button();<br />
g=new Button();<br />
r.setBackground(Color.red);<br />
g.setBackground(Color.green);<br />
add(r);<br />
add(g);<br />
r.addActionListener(this);<br />
g.addActionListener(this);<br />
}<br />
public void paint(Graphics g)<br />
{ <br />
repaint();<br />
}<br />
public void actionPerformed(ActionEvent e)<br />
{<br />
String c=null;<br />
c=e.getActionCommand();<br />
if(c.equals('r'))<br />
setBackground(Color.red);<br />
if(c.equals('g'))<br />
setBackground(Color.green);<br />
}<br />
}<br />
|
|
|
|
|
Use getSource() method of ActionEvent to determine which button is clicked:
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == r)
setBackground(Color.red);
else if(e.getSource() == g)
setBackground(Color.green);
}
Hope this helps.
Nuri Ismail
|
|
|
|
|
Thank you very much
|
|
|
|
|
im trying to create a tool. this tool need to read other source code?
what i know is using "token"
but i dont know how to code it using that "token".
I am a student. i hope that u all can help me to solve my problem
|
|
|
|
|
Google is your friend. The first result from 'token stream java' gives this[^].
Read. Try. Learn.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
thanx ya. i'll try to learn it
|
|
|
|
|
Hi, I am doing a project for school and i cannot for the LIFE of me figure out these enumerations. The problem in my book is as below:
Write a java enumeration LetterGrade that represents letter grades A through F, including plus and minus grades. Define a private instance variable holding a boolean value that is true if the grade is passing. Also, define a constructor that initializes this instance variable, an accessor method isPassing to return its value, and a method toString that returns the grade as a String. Finally, write a program that demonstrates the enumeration.
Now, this problem is not very precise as to what I need to pass into the enumeration, but my guess is the numerical grade, 1-100, as an integer. It then should determine if the grade is passing or failing, return that, and then return the appropriate letter grade as a string.
I have tried so hard and for so long to do this but I just cannot get it as all. How would I make an enumeration like this and implement it? I tried using something like you see below but I got so many errors I wanted to cry. How do I do this and make it work.T-T Its due this friday. =\
A+(95), A(93), A-(90), B+(88), B(85)...F(63), F-(60);
|
|
|
|
|
shawndeprey wrote: Hi, I am doing a project for school and i cannot for the LIFE of me figure out these enumerations.
I don't know what you have been taught about this but there is an article here[^] which should get you started.
|
|
|
|
|
|
Well the OP in the title and the message talks of "Enumerations", and also wants to use things like A, A+, A- etc, so I thought enums probably would not do.
|
|
|
|