1,678 Posted Topics

Member Avatar for bokz06

[CODE=Java]public Object getValueAt(int row, int col) { return rosterList.get(row); for(int i = 0; i < 28; i++) <------- unreachable statement error { return col = i; } }[/CODE] You said return rosterList.get(row) which causes whatever element is at rosterList.get(row) to be returned. When you return something, you are literally "returning" …

Member Avatar for bokz06
0
5K
Member Avatar for javedali

Aren't "adding the books" to the database and "storing the books to the database" the same exact thing? You said them as if they were different. And we don't do chats and stuff like that, keep it on the site.

Member Avatar for BestJewSinceJC
0
219
Member Avatar for lazarus_5

public class DVD extends Product He means they have to go above where you make the class declaration. (Also note that if you have a package declaration, they should go below that). Example: package whatever; import whatever.*; public class Other{ }

Member Avatar for BestJewSinceJC
0
118
Member Avatar for dproun

You can import the class where "InterruptedExeption" is located. You're getting the error "cannot find symbol, class InterruptedExeption" because the compiler does not know what that class is. It doesn't know because you have not imported the resources. And "InterruptedExeption" is obviously a class you created, because you spelled Exception …

Member Avatar for dproun
0
139
Member Avatar for SceneZx

There will be a "carry over" if the result can't fit into a 32 bit integer, presumably, which will cause the carry flag to be set. Then you just need to check the carry flag, which will be 1 if there was a carry, 0 otherwise

Member Avatar for BestJewSinceJC
0
144
Member Avatar for amerabdullah

You're in the wrong forum, but if you were in the correct one, pasting a project description at people is unlikely to get you anything except complaints.

Member Avatar for BestJewSinceJC
0
86
Member Avatar for bluerose

I don't know too much about KeyListeners, but [CODE=Java] if ((e.getKeyCode() == KeyEvent.VK_ALT) && (e.getKeyCode() == KeyEvent.VK_ENTER)) { txtArea.setText(txtArea.getText()); txtArea.setText("\n"); } if (e.getKeyCode() == KeyEvent.VK_ENTER) { lblDisplay.setText(txtArea.getText()); txtArea.setText(""); txtArea.requestFocus(); } [/CODE] doesn't look like it could possibly work. If the first of those statements was true, then the second one …

Member Avatar for bluerose
0
357
Member Avatar for serkan sendur

[QUOTE=niek_e;865588]You both [i]do[/i] realize that we can't access area 51 right?[/QUOTE] They're aware. If it's anything like most sites, not a whole lot goes on in the employees only area/mod lounge/whatever its called anyway. (Although the site I adminned only has 100,000 members and this one has 5x that, so …

Member Avatar for ~s.o.s~
0
534
Member Avatar for alilskeetskeet

[url]http://daniweb.com/forums/announcement9-3.html[/url] And use =Java as the syntax.

Member Avatar for BestJewSinceJC
0
123
Member Avatar for Q8iEnG

You can't test a piece of code you wrote? And your professor told you not to test it? Hmm. And if you use Eclipse or netbeans, they will create a package for you quite easily. If you need instructions on how to do it in either of those IDEs, I …

Member Avatar for BestJewSinceJC
0
162
Member Avatar for sasukeuchiha

All the links Vernon pointed you towards are Timer related, it seems like. His may be a better solution than what I'll show you, but there is another way to do it pretty easily: Use Thread.sleep(milliSeconds); Then call whatever method it is you wanted to run every five seconds. You …

Member Avatar for BestJewSinceJC
0
139
Member Avatar for wedunnit

Another student in your class posted on this forum not too long ago. At least I'm assuming that's the case, since you guys basically have the same exact program other than the movie names. Anyway, your problem is that you are overwriting your dvd in the Invent2 class. edit: Nevermind. …

Member Avatar for BestJewSinceJC
0
126
Member Avatar for tasosa

You should also consider marking your threads as solved when you consider them solved. IMHO its kind of rude to repeatedly get help and not bother saying thank you by marking as solved.

Member Avatar for BestJewSinceJC
0
109
Member Avatar for blahblah619

You're in the wrong forum. And generally, a for loop is better for iteration than a while loop is if you know what values you want to iterate over.

Member Avatar for essential
0
81
Member Avatar for asian_al

Save the sentence that they type in into a String, lets call the String mySentence. Then use javax.swing.JOptionPane.showMessageDialog(null, mySentence); and it will display your string in a window.

Member Avatar for kvprajapati
0
93
Member Avatar for custurd12

You have a while loop that does while (noOfRentUnits is 0). But you never set noOfRentUnits to anything other than 0. Furthermore, you said profit = total rent - maintenance expense. But you defined total rent as noOfRentUnits * whatever, and you defined maintenance expense as noOfRentUnits * whatever. Both …

Member Avatar for BestJewSinceJC
0
1K
Member Avatar for taruj83

Make a class that extends JApplet. And follow [URL="http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html"]this tutorial[/URL] to make tabs.

Member Avatar for BestJewSinceJC
0
111
Member Avatar for BestJewSinceJC

Is using (in the paint method) g.clearRect() the correct way to clear the screen? It's working but I don't know if there is a better way. . google says it is supposed to clear automatically when update is called but that doesn't seem to happen.

Member Avatar for BestJewSinceJC
0
138
Member Avatar for BestJewSinceJC

I have a list of teams, it can be any length. Now, for each team, I want to create a 2D box that says the team's name in the box. And I want to match these teams up against each other. So basically I want to be able to drag …

Member Avatar for BestJewSinceJC
0
161
Member Avatar for kingarabian

I think he was being sardonic. That might be the wrong word. In any case, he was giving you as much information on the topic as you're going to get, considering the unclearly written, uncommented code that you posted & the code it uses which you didn't post. Not to …

Member Avatar for kingarabian
0
127
Member Avatar for pyscho
Member Avatar for Lensva

As hard as I searched, I did not see a question mark anywhere, leading me to believe you didn't ask one.

Member Avatar for Lensva
0
84
Member Avatar for Laidler

If you want things to show up in a grid then use GridLayout. I'm not saying its impossible to do otherwise but why make your job harder than it needs to be.

Member Avatar for BestJewSinceJC
0
98
Member Avatar for CSdude

That's because scanToken = new Scanner(line); creates a new Scanner object based on the String, line, that you passed as the argument. Obviously, since line is a String, it is not an integer, and trying to read ints from it will not succeed. The first declaration of Scanner that you …

Member Avatar for BestJewSinceJC
0
92
Member Avatar for tone10lite

If you could read the forum rules by tonight, I'd appreciate it, unless you think someone is going to do your code for you. [url]http://www.daniweb.com/forums/announcement9-2.html[/url]

Member Avatar for BestJewSinceJC
-1
103
Member Avatar for jade387

if (iStream.close() { // print out the results here. System.out.print("Enter a fname: "); System.out.print("Enter a fname: "); System.out.print("Enter a fname: "); System.out.print("Enter a fname: "); System.out.print("Enter a fname: "); System.out.print("Enter your vote (0-4): "); } } First of all you have a syntax error because there is no closing paren …

Member Avatar for BestJewSinceJC
0
104
Member Avatar for javaman2

Do a web search - BubbleSort is a very common algorithm. You won't have trouble finding hundreds of Java code examples. Compare them to what you have and you'll see what sections you need to implement. If you're still confused at that point, then come ask.

Member Avatar for blumen
0
369
Member Avatar for Laidler

Implement ActionListener. In your actionPerformed method, write a for loop to set each element of the array to null. [url]http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html[/url]

Member Avatar for BestJewSinceJC
0
80
Member Avatar for ahoest

"however should i do this seperate from the mouselistener on the component itself??" I might be misinterpreting what you said, but if not, you can define an inner class that implements MouseListener, then add a mouse listener of that inner class type to the component. [url]http://www.javaworld.com/javaworld/javaqa/2000-03/02-qa-innerclass.html?page=2[/url] edit: as for your …

Member Avatar for ahoest
0
4K
Member Avatar for tomo_uni

[url]http://lists.apple.com/archives/java-dev/2003/Aug/msg00683.html[/url] I'm not sure how helpful that reference is, but there are hundreds of answers to this question on the web. And on daniweb there are quite a few as well.

Member Avatar for BestJewSinceJC
0
77
Member Avatar for Ko Thu

Google search? [url]http://support.adobe.com/devsup/devsup.nsf/docs/51545.htm[/url]

Member Avatar for BestJewSinceJC
0
52
Member Avatar for Laidler

Not supposed to give away code, as this doesn't really help you learn, but any explanation I give you will be much more complicated than the code itself is, and might confuse you, so here is how you do it. public String toString(){ String s = ""; if (power==true){ s …

Member Avatar for BestJewSinceJC
0
1K
Member Avatar for grisha83

So that we can initialize our program's variables without knowing ahead of time what they should be initialized to. Consider the String class (that Java provides for you). If there wasn't a constructor String s = new String("This is what it'll say!"); then I couldn't make the String say that. …

Member Avatar for BestJewSinceJC
0
103
Member Avatar for sammo5889

If what you're trying to do is width/2, You need to input the width, then have the program divide it by two for you. Sorry if that doesn't answer your question, I'm not quite sure I understand.

Member Avatar for JamesCherrill
0
125
Member Avatar for kbullard516

Like the error message says, you're trying to call a method that takes int,int,int but you're passing int,int,int[]. So either re-declare the method as taking an int[] as one of the parameters, or call the existing method correctly.

Member Avatar for kbullard516
0
89
Member Avatar for sriradha
Re: hi

Not sure if that is a homework question or not, but that is a good question. Here is one example I found on the web, it seems legitimate, and it makes a good point that you would not be able to have the same functionality without the inner class. [url]http://www.sbras.ru/win/docs/java/tutorial/java/javaOO/innerclasses.html[/url] …

Member Avatar for BestJewSinceJC
0
94
Member Avatar for llemes4011

It sounds like what you want is just a JLabel followed by a JTextField. [url]http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html[/url]

Member Avatar for BestJewSinceJC
0
392
Member Avatar for Laidler

You can't instantiate an abstract class or call an abstract method as far as I know. What exactly are you trying to do? Post the code where you're trying to "get the abstract method to work".

Member Avatar for BestJewSinceJC
0
197
Member Avatar for dranoel23

A member here suggested this tutorial on animation a few days ago: [url]http://www.developer.com/java/article.php/893471[/url] I don't know how helpful it will be, or if it answers your question, just passing it along since it is an animation tutorial suggested by a reliable member here.

Member Avatar for dranoel23
0
431
Member Avatar for llemes4011

Yes, use a JTabbedPane. Tutorial [URL="http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html"]here[/URL]. And you create buttons using the JButton class. If you have to move the buttons around, you might want to look into different Layout Managers, some are better than others as far as giving you control over where things are placed.

Member Avatar for llemes4011
0
94
Member Avatar for Zibo

You could also simply go to the directory where your netbeans projects are, and drop any files that your program needs in the right place. Then netbeans will automatically include them in your jar file and your program will find them correctly.

Member Avatar for BestJewSinceJC
0
178
Member Avatar for peedi

No, that does not work. What you need to do is each time you generate a random number, check every index of the array (using a for loop) to see if that random number has been generated before. If it has, generate a random number and check again. If it …

Member Avatar for BestJewSinceJC
0
5K
Member Avatar for tomo_uni

You have to write the method using a method body. What's the point of having a method that does nothing, like your current one would, anyway? Either that or declare the class as abstract. Listen to your compiler.

Member Avatar for BestJewSinceJC
0
107
Member Avatar for mhodgkins

Objects are just representations of things and their data. Each class in Java represents an Object. So, for example, if you made a class called Car [CODE=Java]public class Car{ String steeringWheel; String brake; int horsepower; int miles_per_gallon; public Car(String typeOfWheel, String brakeType, int power, int mpg){ steeringWheel = typeOfWheel; brake …

Member Avatar for BestJewSinceJC
0
134
Member Avatar for DealthRune

You are in the Java forum. I imagine you'd get a better answer in the correct forum.

Member Avatar for ShawnCplus
0
131
Member Avatar for Nisaac

Well explain what, specifically, you need help with. i.e. X method ]doesn't work, and it is supposed to do Y. Or I need help with reading in the file. etc.

Member Avatar for Nisaac
0
206
Member Avatar for transplantedNYr

Did you try: if (turn > 0){ return CCW; }else if (turn < 0){ return CW; } return COLLINEAR; Worth a try, and does the same thing as you were trying to do with your code above.

Member Avatar for transplantedNYr
0
244
Member Avatar for AirmanTheGreat

Well, you declared a double[] doubleArray. So you have to change the method header of the total_average method to double[], not to double, since you want to pass in an array of doubles. Then in your main method just say total_average(doubleArray);

Member Avatar for AirmanTheGreat
0
151
Member Avatar for cameclifton

Errors: 1. "string" is not a type of Object. It is "String". Change that declaration of public static void main string[] args to public static void main String[] args. 2. You declared a, b, c, and d twice. You can only declare a variable once. Saying 'int whatever' declares a …

Member Avatar for BestJewSinceJC
0
1K
Member Avatar for deepakyadav1830

For any class that implements Map, you can use Map's get method() to get the value, then assuming it is a float, add it to the other float. [url]http://java.sun.com/javase/6/docs/api/java/util/Map.html[/url] eh? [url]http://www.daniweb.com/forums/thread189520.html[/url] The other thing you should do is not double post threads.

Member Avatar for BestJewSinceJC
0
253

The End.