1,963 Posted Topics
Re: You need to pass at the constructor of the JTable as parameter the DefaultTableModel. Check the API of JTable. Then use the methods of DefaultTableModel to add, remove, or update the rows. Check the API of DefaultTableModel. | |
Re: You declared the method like this: [B]Scan1(int[] num1)[/B] And you are calling it like this: [B]Scan1()[/B] Something is missing | |
Re: [QUOTE=peter_budo;1125587]Correct me if I'm wrong, but aren't data in the table first populated by servlet? If it so then you have some unique IDs you can reuse for creating links with call for servlet plus additional parameter which in this case would be some unique ID, for example book shop … | |
Re: Who is writing to file? Maybe you don't need to read the file, but the lines that are written by the process. But if the files closes and then someone else tries to append something else to that file with a new [I]writer[/I] then if you don't remember what was … | |
Re: You are calling a constructor that does not exist. It is like calling a method with the wrong number or arguments. You haven't declared that kind of constructor: [CODE]Student s1 = new Student("kamal", "kandy", "5678")[/CODE] Also if you paid attention to the errors that you get, you should be able … | |
Re: I haven't tried that before but there is the next() method: Call the method twice and give 2 numbers as input: [CODE] String a = scan.next(); String b = scan.next(); [B][COLOR="Green"]scan.nextLine();[/COLOR][/B] double num1 = Double.parseDouble(a); .... [/CODE] The input would be: >20 30 A small explanation about the addition of … | |
Re: Because that is how it was written. There is no why. Maybe you should rephrase your question | |
Re: Please use code tags and try to point us to the part of the code you are having problems with | |
Re: Also what you want will not be in a separate method but you will submit the form "towards" the servlet when you click the button and execute the code inside the toGet method of the servlet | |
Re: I didn't know that this was possible. Good. [QUOTE=masijade;1119557] [CODE] import static test.Test1.cons; .. System.out.println(cons); [/CODE] [/QUOTE] I usually do it like this: [CODE] System.out.println(Test1.cons); [/CODE] | |
Re: The JButton takes as argument an Icon. If you look at the class ImageIcon which extends Icon you will find 2 things: The constructor of ImageIcon takes as argument an Image object. There is a method: getImage() that "Returns this icon's Image." The Image class has the method that you … | |
Re: First of all if you look at the API of the classes: [U]ObjectOutputStream, ObjectInputStream[/U], you will find examples on how to save and read objects. Use those. Also what type is the itemInventory and does it implement the java.io.Serializable interface? | |
Re: [QUOTE=PriyaJessi;626531]Hi You have not assigned any value for s which you declred as String s(as an instance variable) So JVM considers it as null so by giving s.length it cant count the characters of null so you're getting null ponterException. You just try by assigning some values ti s and … | |
Re: [QUOTE=vaishnavicse;1119466]is any one there to help me? i need to know how a text folder is searched using java.. .[/QUOTE] There is no such thing as a text folder. Also start a new thread with some code since in this thread there were some suggestions. If those do not cover … | |
Re: Because the toRemove, doesn't have an Element actors: [CODE]toRemove.removeAll(actors);[/CODE] Look the API, it removes the element you put as input. I assumed that added Actor instances, not Collection instances. Also look at the API for a better description | |
Re: And where are you having problem? Don't expect to do this for you and if reply by saying that you want some guidelines then I will ask guidelines at which part of your problem: 1) Creating the database 2) Open Database Connection (JDBC Connectivity) 3) Write the query (SQL query … | |
Re: Usually an ';' is added at the end of each command, such as this: [CODE] System.out.println("yes") [/CODE] | |
Re: Create a class with name, age, ... as attributes. With each loop create that object and put it into a Vector. Then write code that displays the values of the Objects inside the Vector at the table | |
| |
Re: For debugging try whenever you add anything to the list to print it as well as the element entered: [CODE] Student stu = new Student(passStudentName, passGrade); people.add(stu); System.out.println("Student:"+ stu); System.out.println("People:"+ people); [/CODE] Do that for all cases and try to add a person and see what happens. Also I trust … | |
I had a problem at work which I solved, but that raised me another question. I wanted to export a page to excel, so I used this: [CODE] response.setContentType("application/vnd.ms-excel;charset=iso-8859-7"); [/CODE] It worked but while I was searching for an answer I found 3 possible content types for the excel: > … | |
Re: Search this forum to find how you can read any file line by line. Then the String class has a method what will allow you to separate the line read like this: line -> aaa,bbbb,cccc, into this: aaa bbbb cccc | |
Re: At the line: obj[0].current=0; Something is null. You forgot to create the object that you are using. | |
Re: You still need to create a File object if you want to read it. How else will you? Have you tried to look at the API of the classes mentioned and follow the steps provided? | |
Re: You cannot write to note pad because notepad is an editor not a file. You need to write to a file. If you want to read that file using notepad then the file shoudend with .txt : [CODE] File file = new File("C:/path/fileName.txt"); [/CODE] I usually use BufferedWriter: [CODE] File … | |
Re: [QUOTE=soteri0s;1117277]correction it throws Exception in thread "main" java.lang.NullPointerException at LinkedStringLog.smallest(LinkedStringLog.java:187) at CMPS39001.main(CMPS39001.java:121)[/QUOTE] At the line specified you are using something which is null. | |
Re: Every time you call a next method, try to call afterward the nextLine() command. whenever you do this: > next() > nextDouble() You read the next input but you don't change the line. So the next call will not read what you entered, but what is left until the end … | |
Re: does it compile? have you compile it? what is your code? how do you run it? | |
Re: And to continue the suggestions, the Account class could look like this: [CODE] public abstract class Account { private Custome cust = null; private double rate = 0.0; private double balance = 0.0; } [/CODE] You can implement any methods you want (get/set). It doesn't matter that it is abstract. … | |
Re: [QUOTE=ElieM;1113485] I know that classes need to be inside main but there's no main here that's why I'm trying to call it from there. [/QUOTE] That statement alone proves that you must stop right now working with JSPs. How much experience do you have with core java? Do you have … | |
Re: It appears that up until now I am the only one that voted NET Beans. Also at work we use eclipse, but I prefer Net Beans at home. Also the IDE that I hate the most is JDeveloper. | |
Re: There are tutorials here: [URL="http://www.w3schools.com/default.asp"]http://www.w3schools.com/default.asp[/URL] on how to create tables and links. You can also place a link inside a table: [CODE] <td> <a href="some_link.jsp">some text</a> </td> [/CODE] Now if you don't know how to read data from the database, that is an entirely different thing, and you need to … | |
![]() | Re: And the code you used? Also at which line do you get the exception. go there and see what is null ![]() |
Re: [QUOTE=mseck;1111741]For some reason when i try to compile it, i still get an error pointing at the operator[/QUOTE] In your other thread, I already told you how to correct all your mistakes. I explained much in detail and told you what to change and correct, but you INSIST in writing … | |
Re: [QUOTE=mseck;1111606]Good Morning ! Who said it was my homework? I am trying to lean it on my own, I've tried to do it but keep on getting error. i would appreciate, if i could get directed the right direction. thank you[/QUOTE] Then post your code, and don't tell me that … | |
Re: If you want more than 1 command to be executed "under" the if, you will need brackets: [CODE] if (number1 < number2) .. .. .. [/CODE] | |
Re: First of all why are you calling out.close ? And especially inside the while. What needs closing is the BufferedReader input, outside the while. You close it once you are done reading. If you close it inside the while, the next loop will execute and try to read the next … | |
Re: [QUOTE=Draculaboy1014;1109549]So howd you do it cause I have the same homework ?[/QUOTE] Follow the instructions from the replies that he got. Meaning start a new thread with what you have done so far, and we will continue from there and help. | |
Re: It is possible but pointless. If you want to call the class program to get the answer, then just put what is inside the main to a separate method with arguments and call that method. | |
Re: It is better to get the text from the JTextField and add it directly to the JComboBox using the add method of the JComboBox class. I order to get use the getSelectedItem method of the JComboBox class. It returns an object, so you will need to cast it to a … | |
Re: Of course you get an error, since the Chars is an array of Game objects and you are trying to pass a String: "". In the method you are doing: Chars[i] = new Game(nm, rc,typ, jc,wep) Do the same, only this time pass empty Strings. Also it is better to … | |
Re: [CODE] String[] hgfjhg = StudentClass.students; studentNameList = new JComboBox(hgfjhg); [/CODE] The "students" array in the StudentClass class is declared: [CODE] public static String [] students; [/CODE] It is [B]null![/B]. That is why it is not working. You are giving values to this array inside the constructor. Do you call the … | |
Re: You can have a method in the Student class: [CODE] public int comporeByGrade(Student st) { return grade - st.getGrade(); } [/CODE] The above method will return positive if this Student is [U]greater than[/U] the argument, negative if it is [U]lower than[/U] and zero if their grades are [U]equal[/U]. So write … | |
Re: [QUOTE=dado87;1106350]GIVEN: patient,doctor,descriptions of doctor,does+medicines,visits,invoice,invoice detail. 1-recognize the given in a table 2-desighn the organized table 3-determine the primary and secondary key 4-describe[/QUOTE] We are not a service that does people's homework for free | |
Re: I have never tried that before but you can do this and see if it works: Instead of sending the value of the combo box have 2 hidden fields: [CODE] <input type="hidden" name="hiddenList1" value="" /> [/CODE] When you click the button to submit run a javascript that loops the list … | |
Re: The method: String.split() Check the API: [CODE] String s = "a b c d"; String [] tok = s.split(" "); System.out.println(tok.length); [/CODE] | |
Re: Have you looked the API for JFileChooser? | |
Re: Do you want that line to be appended at the end of the file, after the existing lines? | |
Re: Try to add some System.out.println in order to see if the data have been read: [CODE] JTable table = new JTable(data, columnNames); // use for loops and print the data the the varaibles: "data", "columnNames" have [/CODE] Also try this: [CODE] JTable table = new JTable(data, columnNames); JScrollPane scrollPane = … |
The End.