|
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.
|
|
|
|
|
Yes, you can use enums to do exactly what the OP wants. Enums in Java are more than simple integers. They can have constructors, they can override methods from Object like toString(), they can have their own methods for specific processing and their own private variables, all sorts of clever things.
Lots of people talk about "enumerations" when they really mean "enumerated types". I guess that whoever set this exercise didn't think about that (shock horror, teachers are human too).
An Enumeration in Java is really just a sort of iterator. When they introduced the enum keyword into Java it broke a lot of existing code because it was common practice to call your Enumeration variable enum, because that is what all the Sun examples did, and all of a sudden that became a restricted name.
|
|
|
|
|
Yes, I was aware of this, having lived through the frustration of using enums in C++ but not having them in Java, while I was working on a JNI library for a multi-platform project.
|
|
|
|
|
Yes, you are right, I realized my mistake after people started using both terms. What I really want to do is use enumerated types to solve this problem, I just still can't wrap my mind around how to do it. I understand the concepts of enumerated types, just not the implications. I don't get how enumerated types use or even create its variables. If somebody could make perhaps a short replica of what needs to be done here, say just A+, A, and A-, and explain just what is actually going on during processing, I think I could finally get a better handle on these tricky enumerated types.
Thank you for all your comments so far! I seem to have really started a discussion lol.
|
|
|
|