1,963 Posted Topics

Member Avatar for JBeginer7891

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.

Member Avatar for JBeginer7891
0
4K
Member Avatar for PuQimX

You declared the method like this: [B]Scan1(int[] num1)[/B] And you are calling it like this: [B]Scan1()[/B] Something is missing

Member Avatar for ainct
0
143
Member Avatar for smackdown90

[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 …

Member Avatar for peter_budo
0
253
Member Avatar for tjsail

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 …

Member Avatar for tjsail
0
136
Member Avatar for scratchwiz

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 …

Member Avatar for verruckt24
0
732
Member Avatar for Dearster

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 …

Member Avatar for javaAddict
1
117
Member Avatar for fardoonmuhafiz

Because that is how it was written. There is no why. Maybe you should rephrase your question

Member Avatar for verruckt24
-3
147
Member Avatar for bardcode1

Please use code tags and try to point us to the part of the code you are having problems with

Member Avatar for javaAddict
0
214
Member Avatar for mayaaa

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

Member Avatar for mayaaa
0
3K
Member Avatar for vampire_ashiko
Member Avatar for xlx

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]

Member Avatar for xlx2
0
102
Member Avatar for jemz

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 …

Member Avatar for jemz
0
185
Member Avatar for cchrisgates

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?

Member Avatar for javaAddict
0
111
Member Avatar for fowlergod09

[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 …

Member Avatar for javaAddict
0
424
Member Avatar for kaushalya_uom

[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 …

Member Avatar for javaAddict
0
131
Member Avatar for OffbeatPatriot

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

Member Avatar for OffbeatPatriot
0
136
Member Avatar for Ashwin Vasnai

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 …

Member Avatar for lanhlung696
0
364
Member Avatar for itsmeisuru

Usually an ';' is added at the end of each command, such as this: [CODE] System.out.println("yes") [/CODE]

Member Avatar for staneja
0
136
Member Avatar for doha786

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

Member Avatar for javaAddict
0
467
Member Avatar for Austinjs0102
Member Avatar for rwildman23

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 …

Member Avatar for javaAddict
0
107
Member Avatar for javaAddict

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: > …

Member Avatar for javaAddict
1
929
Member Avatar for deepu.bhanu

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

Member Avatar for javaAddict
0
152
Member Avatar for shiv0013

At the line: obj[0].current=0; Something is null. You forgot to create the object that you are using.

Member Avatar for PersonalIT
0
1K
Member Avatar for jemz

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?

Member Avatar for jemz
1
103
Member Avatar for jemz

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 …

Member Avatar for javaAddict
0
3K
Member Avatar for soteri0s

[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.

Member Avatar for BestJewSinceJC
0
725
Member Avatar for mseck

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 …

Member Avatar for javaAddict
0
147
Member Avatar for vinoli
Re: Java

does it compile? have you compile it? what is your code? how do you run it?

Member Avatar for javaAddict
0
89
Member Avatar for checho

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. …

Member Avatar for checho
0
167
Member Avatar for ElieM

[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 …

Member Avatar for javaAddict
0
664
Member Avatar for Stefano Mtangoo

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.

Member Avatar for jwenting
0
151
Member Avatar for indu_ss4

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 …

Member Avatar for indu_ss4
0
201
Member Avatar for feoperro

And the code you used? Also at which line do you get the exception. go there and see what is null

Member Avatar for feoperro
0
101
Member Avatar for mseck

[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 …

Member Avatar for javaAddict
0
162
Member Avatar for mseck

[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 …

Member Avatar for javaAddict
0
268
Member Avatar for wacky4444

If you want more than 1 command to be executed "under" the if, you will need brackets: [CODE] if (number1 < number2) .. .. .. [/CODE]

Member Avatar for javaAddict
0
81
Member Avatar for muusa

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 …

Member Avatar for muusa
0
284
Member Avatar for Consus

[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.

Member Avatar for javaAddict
0
116
Member Avatar for muusa

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.

Member Avatar for muusa
0
170
Member Avatar for Ecliptical210

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 …

Member Avatar for javaAddict
0
155
Member Avatar for GoldenDrago

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 …

Member Avatar for javaAddict
0
83
Member Avatar for Ecliptical210

[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 …

Member Avatar for javaAddict
0
160
Member Avatar for checho

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 …

Member Avatar for Andreas Hollman
0
490
Member Avatar for dado87

[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

Member Avatar for ithelp
-7
82
Member Avatar for swethakrich

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 …

Member Avatar for javaAddict
0
181
Member Avatar for Dearster

The method: String.split() Check the API: [CODE] String s = "a b c d"; String [] tok = s.split(" "); System.out.println(tok.length); [/CODE]

Member Avatar for stultuske
1
124
Member Avatar for P00dle
Member Avatar for cristine.apin
Member Avatar for musthafa.aj
0
1K
Member Avatar for JBeginer7891

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 = …

Member Avatar for JBeginer7891
0
426

The End.