1,963 Posted Topics

Member Avatar for luwenbin

[QUOTE=luwenbin;855876] [QUOTE=ithelp] Ok, after coding it I will send it to your professor directly , let me know his email address. [/QUOTE] SNIP I don't believe he fell for that!

Member Avatar for javaAddict
0
137
Member Avatar for epoe

Something else that came to mind: Use the split method like this: [ICODE]String[] str = stringRead.split(" ");[/ICODE] This will get you all the 'words' including the ":". So loop throught the array until you find the ":". You will know that, what is before the ":" and after should be …

Member Avatar for javaAddict
0
126
Member Avatar for Atomika3000

Instead of PrintWriter use: BufferedWriter. When you write to the file, it overrides what it is written: [CODE] FileWriter fileWriter = new FileWriter("fileName"); //better check the API for this BufferedWriter writer = new BufferedWriter(fileWriter); writer.write("line"); writer.newLine(); // or writer.write("line\n"); writer.close(); // again check the API because I don't remember if …

Member Avatar for javaAddict
0
96
Member Avatar for get2tk

[QUOTE=get2tk;852451] The following class might be useful: java.util.Date represents dates. Its toString() method returns the date and time in human readable form: getTime() returns a long representing the date in milliseconds, so that (d1.getTime() - d2.getTime())/1000L will be the time in seconds between dates d1 and d2. Finally, new Date() …

Member Avatar for javaAddict
0
109
Member Avatar for javaAddict

Just a quick question. No rush to answer, it is not important, I might discover it later myself, but just in case someone knows it: I have been trying to create a [URL="http://java.sun.com/javase/6/docs/api/java/lang/reflect/Method.html"]Method[/URL] object using this method: [URL="http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getMethod(java.lang.String,%20java.lang.Class...)"]Class.getMethod(String name, Class<?>... parameterTypes)[/URL] like this: [CODE] obj.getClass().getMethod(methodName, Class.forName(methodType)) [/CODE] My problem is …

Member Avatar for javaAddict
0
148
Member Avatar for mielcita

First of all this: [ICODE]if (buffer.equals(null))[/ICODE] is totaly wrong. Not because it won't compile but because [B][U]If[/U][/B] buffer is null you cannot call any methods. You will get a NullPointerException The best way to check if something is null is the simplest: [ICODE]if (buffer==null)[/ICODE] For all the other cases use …

Member Avatar for javaAddict
0
136
Member Avatar for Paul.Esson

[QUOTE=Waqas_Moeed;853083] Try this one.... Regards .................[/QUOTE] Congratualtions, The oldest thread reviving I have ever seen. Not to mention all the forum rules that you've just broken. (We do not give away free homework and we use code tags) Last post by [I]server_crash[/I] was [B]May 8th, 2005 14:16[/B]. What were you …

Member Avatar for javaAddict
0
285
Member Avatar for Zass101

[QUOTE=Zass101;849612]I will pay the first person to finish this task via paypal!!! I will pay $5! [/QUOTE] Only $5 !! You have to be insane. Firstly, the amount in insulting. In this forum there are many professional programmers that get paid much much more. Why should they bother to fix …

Member Avatar for peter_budo
-3
224
Member Avatar for smsamrc

[QUOTE=BestJewSinceJC;846678]Yes, read it in as a String and print it out. ?[/QUOTE] Actually what [I]smsamrc[/I] is asking is to print at the console something like this: To have 2 as base and 3 to be smaller and to the upper right corner of 2.

Member Avatar for smsamrc
0
758
Member Avatar for ktunisia

Search for code examples on how to read files (Scanner, BufferedReader). Write some test classes that just print the data of the files Search for code examples on how to run queries. Write some test classes that execute simple. Use the above to read the data, construct the queries and …

Member Avatar for ktunisia
0
112
Member Avatar for aixing

The problem is where you create your query not where you read the value and call the set method: Assuming this: [CODE] public void setId(String id) { this.id = id; } [/CODE] >>> query = . . . . + "[COLOR="Red"][B]'[/B][/COLOR]" + id +"[COLOR="Red"][B]'[/B][/COLOR], " I think you forgot to …

Member Avatar for aixing
0
154
Member Avatar for king_786
Member Avatar for pao09

Pass the information from one frame to the other before you call the "show" method. Remember you can have the TextFields of the second frame public or with set methods in order to set their values from the first frame

Member Avatar for pao09
0
111
Member Avatar for karan_the

[CODE] String [] array = new String[5]; // array is not null but array[0], ... are null //array variable is an array and should be treated like one. // instatiating the elements of the array: array[0] = "aa"; array[1] = "bb"; System.out.println("Array: "+array); for (int i=0;i<array.length;i++) { System.out.println("Elements: "+array[i]); } …

Member Avatar for javaAddict
0
176
Member Avatar for smsamrc

I didn't quite understood what you really want because I think it is very simple: [CODE] Vector v = new Vector(); v.add("4 2 5 3 6 0"); [/CODE] or [CODE] Vector v = new Vector(); v.add("4,2"); v.add("5,3"); v.add("6,0"); [/CODE] or insert them in any format you like

Member Avatar for smsamrc
0
2K
Member Avatar for monad

I think using javascript. I don't have time to look it up but if you search at [URL="http://www.w3schools.com/default.asp"]w3schools[/URL], you will find a complete reference of DHTML in order to do what you want

Member Avatar for javaAddict
0
62
Member Avatar for jam7cacci

The first error is easy. You cannot compare String using this: "<". For Strings you need to use this function: [CODE] if ( txt_pay.getItem().compareTo(txt_amount.getItem())<0 ) { jOptionPane1.showMessageDialog(this, "please enter the right amount"); } [/CODE] And when you do this: [CODE] if (txt_pay.getItem().isEmpty()) [/CODE] The method isEmpty() needs to return a …

Member Avatar for jam7cacci
0
112
Member Avatar for hollywoood69

A small tutorial with examples about objects in arrays [CODE] Video video = new Video(); // ONE instance of Video Video [] videos = new Video[5]; // this is an array // videos is an array and should be treated as an array // videos[0] is a Video but it …

Member Avatar for javaAddict
0
389
Member Avatar for ~s.o.s~

[QUOTE=chriswellings;839536]really? do you like it (both code geass and anime in general?) how many other series have you seen?[/QUOTE] I have noticed this thread about anime and since I am also a fan I would like to answer that I have seen in total about 95 anime. Starting form Astroboy …

Member Avatar for Narue
2
322
Member Avatar for daffer

The error is simple, it cannot find the cinstructor you are using: "cannot find symbol constructor Plane (int,int,int,int,int,int,java.awt.Image, java.applet.AudioClip, Player)" Meaning that the constructor you are using doesn't exist. I haven't looked at your code, but the arguments you enter at the constructor must much the ones that are declared …

Member Avatar for javaAddict
0
128
Member Avatar for king_786

We already know what factorials are and how to compute them. But thanks anyway for the tip

Member Avatar for tux4life
0
244
Member Avatar for christiangirl

Where exactly do you get those exceptions. A FileNotFoundException means exactly that; the file you are trying to access doesn't exist.

Member Avatar for christiangirl
0
138
Member Avatar for get2tk

>Create variables to hold how many times each value occured: [CODE] int countOf2s = 0; int countOf3s = 0; ... [/CODE] >Create a method that returns a random number from 1 to 6 > inside a for loop (it will be executed 12000) call the above methods 2 times, add …

Member Avatar for BestJewSinceJC
0
91
Member Avatar for mkadiri

Your input method seems correct but there are a few things you need to add: [CODE] public static void Input(String [] composer, String [] piece) { int i = 0; while( i<composer.length ) { String comp = JOptionPane.showInputDialog("input composer"); if (comp.equals("q")) { break; } else { composer [i] = comp; …

Member Avatar for mkadiri
0
122
Member Avatar for peter_budo

I don't know if this suggestion applies to your problem, but you can try this: Have the class implement the [URL="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html"]Comparable[/URL] interface: [CODE] public class ContactListLabel implements Comparable<ContactListLabel > { public int compareTo(ContactListLabel label) { return nameLabel.compareTo(label.getNameLabel()); } } [/CODE] When you get the Contacts from RMS and store them …

Member Avatar for peter_budo
0
335
Member Avatar for ivatanako

[QUOTE=loren_28;740056]kindly please help to solve my problem??? create a program that the user allow to input a 5 integers, that looking the lowest value?[/QUOTE] It would be useful to read a Thread before posting to it. Perhaps your question has already been answered.

Member Avatar for jasimp
0
213
Member Avatar for doha786

The setText method does exactly what it says; it SETs the text of the TextArea. So The TextArea will have whatever value you put as argument. You can either, create a String with all the values and then set that String OR BETTER: Use the append method of the TextArea. …

Member Avatar for javaAddict
0
110
Member Avatar for joshmo

You can have the variable be "global". Here are 2 examples: [CODE] class ClassA { public int variableA = 0; public ClassA() { } public void method() { variableA = 2; } } [/CODE] [CODE] class ClassB { public ClassB() { } public void methodB() { ClassA clA = new …

Member Avatar for javaAddict
0
3K
Member Avatar for king_786

Obviously instead of 3 you will have the number of '*' you want to print. And in the for-loop use the method: [CODE] System.out.print(""); [/CODE] The above method doesn't change line. Of course when the loop is done remember to call the one that changes line in order to continue …

Member Avatar for javaAddict
0
187
Member Avatar for dep.new

Even if you do come up with an algorithm for that you will still need to make some comparison.So why don't you try this: [CODE] public int max(int a, int b, int c) { if ((a>=b)&&(a>=c)) { return a; } if ((b>=a)&&(b>=c)) { return b; } return c; } [/CODE] …

Member Avatar for javaAddict
0
299
Member Avatar for K?!

You might want to create your own class. The classes Date and Time are used to store what the say: Date and Time. You need to store duration. (duration of race) You cannot say that a swimmer swimmed for 'Date' object time. But you can say this:He started swimming at …

Member Avatar for K?!
0
102
Member Avatar for aixing

[CODE] <form name="theForm" method="post" action=""> [/CODE] Where it says action you need to put the jsp which you want to go after submiting the form. If it is let empty, it is submitted to the same form. So try this: [CODE] <form name="theForm" method="post" action="anotherPage.jsp"> [/CODE] You can also put …

Member Avatar for javaAddict
0
90
Member Avatar for rajeev_vlal

I also like to do small projects just for fun. Especially projects that I can use for my self. Although I don't find this project very interesting here is what you can do: > In one package write the classes as explained in the diagram. > In another package, classes …

Member Avatar for BestJewSinceJC
0
72
Member Avatar for leverin4

You can loop backwards the arrays, take the elements and convert them into Strings and concatenate them. Then convert the Strings to numbers and multiply them. [CODE] String s; loop i take element i convert it to String concatenate it to s variable end loop convert s to number [/CODE]

Member Avatar for JamesCherrill
0
167
Member Avatar for MAJORG

That does it do, and what it was supposed to do? Also tell us where is the problematic part of the code. Also you might want to add some [I]System.out.println[/I] and see what are the values of the variables at the parts you are having problems

Member Avatar for BestJewSinceJC
0
279
Member Avatar for jackiejoe

That is not a consructor: [CODE] public void myDataModel(Adult[] memAd ) { // pass in data array to constructor data = memAd; } [/CODE] This is a constructor: [CODE] public MyTableModel(Adult[] memAd ) { // pass in data array to constructor data = memAd; } [/CODE] I see that at …

Member Avatar for javaAddict
0
2K
Member Avatar for doha786

Simple program to read ONE file: [CODE] BufferedReader reader = new BufferedReader(new FileReader("filename.txt")); String line = reader.readLine(); while (line!=null) { // line read is not null // do things with the line ... .. . // read the next line and go to the beginning of the while. If it …

Member Avatar for Ezzaral
0
198
Member Avatar for heysebas

Java GUI is just another class. You can create instances of other classes inside and call their methods. Small, silly example: [CODE] class Person { public String name; public int age; public Person() { } } [/CODE] [CODE] class Print { private Person person; public Print(Person p) { person = …

Member Avatar for JamesCherrill
0
1K
Member Avatar for javaman2

add2 method is void. So it doesn't return anything. It just adds the argument to the Money object calling it. When you call it, as you can see, it adds the argument to the dollars and cents of the object that made the call. Also your minus algorithm is wrong …

Member Avatar for javaAddict
0
224
Member Avatar for shahab.burki

[QUOTE=ejosiah;833030]@stephen84s posting links with little relevance to any of us[/QUOTE] Sorry to intrude, but what do you mean by that?

Member Avatar for ejosiah
0
116
Member Avatar for coolbuddy059
Re: ping

I know the algorithm for pong. But my brother is better, he knows Ping Pong. Serioulsy, he learned it when he was at University and now he teaches gymnastics at schools

Member Avatar for ejosiah
-1
93
Member Avatar for amarjeetsingh

Try this simple example: [CODE] String s = "asjdhk123uhmsmik,z!?"; for (int i=0;i<s.length();i++) { char ch = s.charAt(i); System.out.println(ch); } [/CODE] Also you should always check the API to find more methods that could be useful. In this case, you should have looked the [URL="http://java.sun.com/javase/6/docs/api/java/lang/String.html"]String API[/URL]

Member Avatar for javaAddict
0
124
Member Avatar for cool_mike

x cannot be integer: [CODE]<input type="text" name="1">[/CODE] [CODE] String value = request.getParameter("1"); [/CODE] "1" is a String Now if you want the VALUE to be taken as an integer: [CODE]<input type="text" name="textName" value="123">[/CODE] [CODE] String value = request.getParameter("textName"); int intValue = Integer.parseInt(value); [/CODE] At the last example, the textfield can …

Member Avatar for javaAddict
0
81
Member Avatar for mvotilla
Member Avatar for javaAddict
0
47
Member Avatar for ankiy.singh

[URL="http://www.daniweb.com/forums/thread141776.html"]http://www.daniweb.com/forums/thread141776.html[/URL] It is at the top of the jsp forum

Member Avatar for javaAddict
0
41
Member Avatar for koolhoney07

[ICODE]System.currentTimeMillis();[/ICODE] It returns the current time in milliseconds. So you can call this method before the java method you want to count and then call it again and get the difference

Member Avatar for verruckt24
0
79
Member Avatar for amar4java

There is a link at the top of this forum. How can you miss it? [URL="http://www.daniweb.com/forums/thread141776.html"]http://www.daniweb.com/forums/thread141776.html[/URL]

Member Avatar for javaAddict
0
66
Member Avatar for damu

[QUOTE=stultuske;822272]I think he's trying to get a servlet running, not sure though[/QUOTE] Or a simple GUI. [I]damu[/I], you need to better describe your question and what you are trying to accomplish. An example would help

Member Avatar for rameshrajamani
0
140
Member Avatar for jhonny_86

I haven't used FileChooser much, but have you tried these methods: [QUOTE]setApproveButtonText(String approveButtonText) Sets the text used in the ApproveButton in the FileChooserUI. [/QUOTE] [QUOTE] showDialog(Component parent, String approveButtonText) Pops a custom file chooser dialog with a custom approve button. [/QUOTE]

Member Avatar for jhonny_86
0
126
Member Avatar for oldSoftDev

[CODE] BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("fileName")); String line = reader.readLine(); while (line!=null) { System.out.println("The Line is: "+line); // do calculations with line line = reader.readLine(); } } catch (Exception e) { } finally { if (reader!=null) reader.close(); } [/CODE] If you are unfamiliar with …

Member Avatar for oldSoftDev
0
113

The End.