Dear Ian Smith,
I try your solution and it works! The main issue in my code is:
//Incorrect code
MyRobot myrobot = new MyRobot();
//Correct code
Robot myrobot = new Robot();
User Profile
Collapse
-
java.awt.Robot - Stimulate Key Press Not Working
Dear All,
I had google for example how to use java.awt.Robot class. I also read Java Document regarding of awt.Robot class. When I test below code, I get error message "cannot find symbol method delay(int)" and "cannot find symbol method keyPress (int)". May I know what is my problem?
*Installed JDK Version 6 update 21
...Code:import java.awt.AWTException; import java.awt.Robot;
-
Thanks for the advise on finding "new Result". I didn't aware that what I'm doing actually is initialize another Result object rather that manipulated on existing method. Now I finally know the problem is locate on MySurvey.java line 48. Need change from result.printRep ort(); to centerPanel.get Result().printR eport();
Jos thank you very much....Leave a comment:
-
Java Array Problem, unable to print out accumulate value.
I been keep trace the problem for very long but i still cannot find the reason why it cant print out the correct output. Hereby i show all classes in my small Java Application. Hope anyone able to help me identify the source of the problem causing printing zero value in the array.
ButtonPanel.jav a
...Code:import java.awt.*; import java.awt.event.*;
Last edited by xirowei; Apr 6 '08, 11:17 AM. Reason: Bytes.com got bug in showing Java code, hence i adding in comment to notice other user that the line of code that appear invalid actually is a line of correct code.Leave a comment:
-
Java Array Problem
...Code:public class Result { private int countA = 0; private int countB = 0; private int statement; private boolean statusA = false; private boolean statusB = false; [B]private int[] arrayA = new int[2]; [B]<= the problem seem like happen at here?[/B] private int[] arrayB = new int[2];[/B] [B]<= the problem seem like happen at here?[/B] public Result() { } public -
Thanks. I already found a way to compute out permutation with allow repeats....Leave a comment:
-
I'm not sure is this the one i searching for because after compile and run that example i get following error message:
Exception in thread "main" java.lang.Array IndexOutOfBound sException: 0
at Permutation.mai n(Permutation.j ava:20)
Is there any way to fix it so i able to run and view the output?
...Code:/************************************************************************* * Compilation:
Leave a comment:
-
How to compute Permutation of 4P3?
Let's say i create a String array that store 4 Alphabets {"A","B","C","D "}
How can i get the result if i need permutation of 4P3 and 4P2?
I had refer to many examples from the internet, but those examples cannot compute n selection from m elements. They only able to computer permutation of m elements without selection e.g. 4P4.
Hence i need guideline in how to compute... -
-
php echo problem
echo "<td width=\"300\" align=\"left\"> <?php echo $_SESSION['EmployeeNo'] ?></td>";
The above line of code give me the error message:
"Parse error: syntax error, unexpected T_ENCAPSED_AND_ WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\XAMPP\htdocs \DW\personalDet ail.php on line 132"
I new to php, no idea how to fix this issue, i just... -
How to set more than one attribute in same cookie?
I try to search information from many websites, but what i can found is they only demonstrate the example with ONE ATTRIBUTE in a Cookie only.
What i want is how to set more than 1 attribute in a same cookie?
Below is my code: currently i only can show the username but cannot show the age. How to enable the ShowCookie.jsp able to show both the attribute of "username" and "age" enter by User?
... -
I finally figure out the correct way to do this question. Below is the working code.
...Code:import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class LabWork3_Q1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html");Leave a comment:
-
I had been working on this question and here is my latest version (still contain problem)
My problem is WHY the doPost method UNABLE to receive parameter of textfield name "word" from doGet method?
...Code:import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class LabWork3_Q1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponseLeave a comment:
-
I had make some modify but now encounter new problem in count length function.
After i enter a word and click on Submit button, Tomcat show line 34 error, may i know how to solve this problem?
...Code:import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class LabWork3_Q1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponseLeave a comment:
-
how to pass variable from public void doGet to public void doPost?
i'm newbie in java servlet, how to let public void doPost can access to public void doGet, stringLength variable?
below is my code:
...Code:import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class LabWork3_Q1 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException -
xirowei replied to non-static method problem: how to access non-static method from another .java file?in Javaepots9 thank you very much. You guide is really simple and easy to understand. Now it solve my problem of the non-static problem.Leave a comment:
-
xirowei started a topic non-static method problem: how to access non-static method from another .java file?in Javanon-static method problem: how to access non-static method from another .java file?
i now learning Object Oriented Programming but stuck. Need help. Below is the code.
[CODE=java] PanelOption.jav a
import java.awt.*;
import java.awt.event. *;
import javax.swing.*;
import javax.swing.eve nt.*;
public class PanelOption extends JPanel
{
//some code
public PanelOption()
{
createOptionGUI ();
}
...
No activity results to display
Show More
Leave a comment: