1,963 Posted Topics
Re: Try to read line by line. Use the methods hasNextLine and readLine. Then save that line into a String. Once you have the String, use the method indexOf(String) and find where the "<text>" and "</text>" are found. Then use the substring method. All the above methods can be found at … | |
Re: charAt is a method of the String class. In case you don't know it: [CODE] String s = "abs"; char ch = s.charAt(0); System.out.println(ch); [/CODE] You might want to loop the String and use the charAt to take each character, using the charAt. Have a new String an initialize it … | |
Re: Have you written any code or, you used exclusively the gui builder for that? You should learn how to code those events. How to add action listeners to your buttons. You need to read some tutorials and try to make that gui on your own. Just declare those components and … | |
Re: Your query is wrong. Do some studying about sql. If you want to use ? and prepared statements don't use quotes. Use this: [CODE] "Select * from pin_numbers where pin_number like ?" pst.setString(1,pin); [/CODE] If you want to search rows that have this: "twt000" inside their value, then this '*' … | |
Re: Declare that variable public, or better have public get methods: [CODE] class ClassA { private int value = 0; public int getValue() { return value; } } [/CODE] [CODE] class ClassB { public static void main(String [] args) { ClassA cla = new ClassA(); System.out.println(cla.getValue()); } } [/CODE] | |
Re: Use javascript. When the button is clicked make that value empty. Assign an id attribute to the text field and use it to take the field as an object. [CODE] <input type="text" value="A" id="id_A" name="someName" /> [/CODE] javscript: [CODE] document.getElementById("id_A").value=""; [/CODE] Check these tutorials: [URL="http://www.w3schools.com/default.asp"]http://www.w3schools.com/default.asp[/URL] | |
Re: [QUOTE=Jhanylyn;1107798]hai..pwedi nyo b akong bgyan ng isang code about selection sort....thanks[/QUOTE] Start a new thread and write proper english | |
Re: I wrote my version using your code. I used the JPanel class. I declared it as an attribute of the class so I can have access to it in the method that handles the double clicking. [CODE] package stam.bar; import java.awt.event.*; import javax.swing.*; public class SimpleFrame extends JFrame implements MouseListener … | |
Re: Assuming that you have this javascript function: [CODE] <head> <script> function abc(arg) { ... } </script> </head> [/CODE] And in the jsp you have: [CODE] <body> <% .. // get patientmodel %> <input type="button" name="but" value="Click me" onclick="abc('<%=patientmodel.getpatient()%>');" /> </body> [/CODE] Or you can use it in any other way. … | |
Re: Try using the equals method instead of the '=='. You need to override that method in your classes. | |
Re: We don't know what this "Assault fleet" game is, even if we were willing to write the code for you. Explain what you want to do and wait for our suggestions | |
Re: You have to "connect" the objects: BookList and UserList. Either add an attirubte to one of those to be the other. Add to the BookList an UserList attribute. [CODE] book.setAvailable(resultSet.getBoolean("available")); appliedUser.setId(resultSet.getLong("user_id")); book.setAppliedUser(appliedUser); bookList.add(book); [/CODE] Or create a new class that has those 2 as attribute and return that class. In … | |
Re: It is obviously that even the %d that you use is correct, the %lf is not. Try to use this: %f. And check this link for more information: [URL="http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#syntax"]http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html#syntax[/URL] | |
Re: What error message and are you sure that the query is valid? Have you tried to run in at the MySql command prompt ? | |
Re: Do you get any errors when the server stops. Can you add some messages to be printed before it stops? | |
Re: The code works for me. Does the message display correctly? ("there is a value") Can you post an image of the gui that you see. Also is the image file at the correct path. ("image.jpg") . Have you tried the full path? Also have you tried setting the size of … | |
Re: I am really not sure if it will work, but I think that if an element is set to be disabled then it is not sent. So you can try this: Whenever you click a check box, use javascript to enable the text field attached to it. If you un-check … | |
Re: Use the String class. Specifically the split method. Check the String API for that method: [CODE] String s = "Bleach,22,13,TiteKubo"; String [] tokens = s.split(","); //Now print the array and see what happens: for (int i=0;i<tokens.length;i++) { System.out.println(i+": "+tokens[i]); } System.out.println("-----"); System.out.println(tokens[0]); System.out.println(tokens[1]); System.out.println(tokens[2]); System.out.println(tokens[3]); [/CODE] | |
Re: [QUOTE=churva_churva;1320716]what is the meaning of the word ophane case......[/QUOTE] Post again the code in code tags. And where do you get that error? | |
Re: Why do you stop your code at case 6? Don't you close the main and class right parenthesis. Anyway, given the instructions, place the switch statement, with the case block in the do while loop. You will need to define the userChoice and give it value from the keyboard: [CODE] … | |
Re: You have misplaced lots of '}' and '{'. You haven't some of those and you have opened others where you shouldn't. Review your code and check those brackets. | |
Re: The OpenCV library is very good for image processing. Unfortunately it is for C. I am not sure if there is one for java as well. | |
Re: You can add get methods to your thread class. Assuming that the thread class instance is visible in your gui class, you can start it and you can call its get methods anywhere you want in the gui and get the latest values of the thread's attributes. | |
Re: [QUOTE=jayr apuhin;1320413]what nested loops in java 1. sample output * * * * * 2. enter a number: 3 input * * * 3. 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25[/QUOTE] Start … | |
Re: I would have done this: [CODE] <img src="images/bus.jpg" id="ck" alt="" width="40" height="40" name="imgChange" onclick="changeImage();"> [/CODE] [CODE] function changeImage() { if (document.getElementById("ck").src=='images/bus.jpg') { document.getElementById("ck").src = 'images/nice.jpg'; } else if (document.getElementById("ck").src=='images/nice.jpg') { document.getElementById("ck").src = 'images/bus.jpg'; } } [/CODE] | |
Re: Since the switch can only use char or integer, you have two solution: Parse what you are reading to an integer or a char: Integer.parseInt(input); for integers or for chars: [CODE] if (input.length()==1) char ch=input.charAt(0); else {//error} [/CODE] Make sure that you entering valid values ( use try {}catch() {} … | |
Re: You will need JSP as well, not only HTML. Search for tutorials at the top of the JSP forum | |
Re: I haven't tried it, but can you try this: [CODE] b obj = new a(); ((a)obj).a1(); [/CODE] With this: [U](a)obj[/U] you are casting the obj to the [B]a[/B] class. Then calling the a1 method. You can try it, but I don't know if it will work. | |
Re: Assuming you have this: "((a<b)&&(c<d))" Start by looping the String (check the String class API, use the methods, length, charAt() ) Write a loop and take each character of the String using the charAt method. In the loop. Whenever you find a '(' put it into the stack. Whenever you … | |
Re: What values do you get when you print them? Where in your code you print them? | |
Re: Call the method: [CODE] int [] array = breakUp("some string"); array[0]; array[1]; array[2]; .... [/CODE] | |
Re: If you want validation in the servlet, then use java code after you get the request. But that is not very good because you have already sent the request. The idea is to validate before sending the request at the jsp. So you can try this: [CODE] <form name="..." action="... … | |
Re: When was this project assigned to you? How much time was it given to your class to finish it and when do you have to submit it? | |
Re: Post in the javascript forum or the JSP forum your code. The error is with your javascript. You probably haven't defined an element with name eNew or you are trying to use it incorrectly | |
Re: Come up with some ideas based on what you are good at and start coding. You can search this forum or the internet for project ideas | |
Re: [CODE] new MultiThreader().jobSpawner(this, jobName); [/CODE] 'this' is a key word that can be used in a class only by its class members and it used to call class variables and methods: [CODE] private int a = 0; public void setA(int a) { System.out.println(this.a); // it will print the value of … | |
Re: Use javascript, get the id or the name of the field and set its value to "" empty. [CODE] <form name="formName"> <input type="text" name="field" id="field_id" value="aaaaa" /> </form> [/CODE] Then write code to execute this javascript: [CODE] document.formName.field.value=""; //OR document.getElementById("field_id").value=""; [/CODE] Definitely check this: [URL="http://www.w3schools.com/default.asp"]http://www.w3schools.com/default.asp[/URL] for more. | |
Re: Just to add something to [I]jon.kiparsky[/I]'s good advice, each object has a toString method, whether it is overriden or not. Even the ArrayList. If an ArrayList has String objects: [CODE] ArrayList<String> list = new ArrayList<String>(); list.add("aaaa"); list.add("bbbb"); // They both do the same System.out.println(list); //or System.out.println(list.toString()); [/CODE] Then the above … | |
Re: [QUOTE=ankilosado;1296778]I find it difficult to understand the shadowing, privacy and inheritance... I declared a class that has an array as an attribute. I have declared it as private. Then I created a series of classes that inherit from the former. I thought that these new classes already had the attributa … | |
Re: Are you referring to a commercial [U]telecom billing system[/U] that costs tens of thousands of dollars and a group of many people have worked on that for many months? | |
Re: May I ask a question? Probably it is stupid but just in case to make sure. Have you compiled the HelloWorld.java file and where the HelloWorld.class file is? | |
Re: That is the same question you asked in one of your previous threads: [URL="http://www.daniweb.com/forums/thread305019.html"]http://www.daniweb.com/forums/thread305019.html[/URL] You got answers to that thread. If you didn't like the answers don't start a new thread. In that thread we asked what a "picture puzzle" was and got no answers. Instead you created a new … | |
Re: What errors do you get. In the catch print the exception that you get in order to know what went wrong. That message means nothing: System.out.println("Error in file") [CODE] catch (Exception e) { System.out.println("Error: "+e.getMessage()); // or less elegant e.printStackTrace(); } [/CODE] | |
Re: When you say 'on top of' can you provide a small example. For example if the file1 is: (X,Y,Z) = (10,2,5) and file2 is: (X,Y,Z) = (1,1,2). What do you want your program to do? You can create an new array: coordinatesDiff, and do this: [CODE] coordinatesDiff[i][0] = coordinates1[i][0] - … | |
Re: Can you try to print the pbeKeySpec value and see what it has? Also is there any specific reason that you need to read the input character by character and then copy it to another array? Can you just use the Scanner class to read the whole line and get … | |
Re: Yes but this: 2323237777777 is an int. And int numbers can not handle that; it is too big. This is a long: 2323237777777L [CODE] long me = 2323237777777L; [/CODE] | |
Re: It seems that you have messed up with the brackets. You have this: [CODE] public void actionPerformed(ActionEvent e) { if (e.getSource() == writeBtn) { if (e.getSource() == libraryBtn) { } else if (e.getSource() == exitBtn) { } } } [/CODE] Maybe you need this: [CODE] public void actionPerformed(ActionEvent e) { … | |
Re: Yes JSP, it can be done with jsp, but do you know java? Because you can not write jsp, and especially such project without knowing good java. Check the tutorials at the top of the java and the jsp forum. |
The End.