1,678 Posted Topics

Member Avatar for JooClops

This is the Java forum. Java is an Object Oriented programming language. Javascript is a web-based scripting language.

Member Avatar for JooClops
0
122
Member Avatar for doha786

Since you're using the File class, you can use the class's getName method to return the name of the file associated with it. If that method doesn't work for you, here is the Javadoc [url]http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html[/url]

Member Avatar for BestJewSinceJC
0
98
Member Avatar for amegahed3

Read in the first three lines and throw them away. Using fscanf, you can read in doubles with %lf, floats with %f, and you can use %s to read in Strings. %s will get rid of the first word I believe (first thing matches by the delimiter pattern, which is …

Member Avatar for jephthah
0
271
Member Avatar for Hockeyfreak889

With Google. April Fools! Read this tutorial, I think it is what you are looking for. And I also think I linked someone to it maybe a day ago. [url]http://java.sun.com/docs/books/tutorial/2d/images/index.html[/url]

Member Avatar for Hockeyfreak889
0
100
Member Avatar for k2k

Using setVisible(true) on the JFrame should be making it appear. However, I noticed that you're removing a Container, the JScrollPane, from the JFrame after setting it to invisible. Why not just remove it, then call the validate method? [url]http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Container.html#validate([/url]) edit: I'm going to run your code and see if I …

Member Avatar for k2k
0
127
Member Avatar for BestJewSinceJC

I was doing a bit of reading, and according to what I read, GUIs can be set up and realized in any thread, but doing more GUI work in a normal thread (non-EDT) after a call to setVisible can be dangerous. The explanation given is as follows: [QUOTE]The example constructs …

Member Avatar for BestJewSinceJC
0
103
Member Avatar for TransKim

what are you having trouble with? I'd like to help, but what you're trying to do is foreign to me. I'd like to assume it is the same as any other Java code, but that may or may not be the case.

Member Avatar for peter_budo
0
123
Member Avatar for DanielB2

I don't know how to play Backgammon but I imagine since GNU's Backgammon game is open source (right?) I suppose you could use file input/output to play each other.

Member Avatar for BestJewSinceJC
0
78
Member Avatar for doha786

This can be accomplished the same way you would "connect" two classes that are not GUI classes. You have to make sure your GUI class implements ActionListener though. ActionListener has one method, actionPerformed(ActionEvent e), so implement that method and put the code to get the search term from the text …

Member Avatar for doha786
0
91
Member Avatar for sundar4047

Read this. I have a feeling it will help you, since it says it is a tutorial on loading and displaying images in Java. :) [url]http://java.sun.com/docs/books/tutorial/2d/images/[/url]

Member Avatar for BestJewSinceJC
0
85
Member Avatar for britto

Are you using netbeans or another IDE? And if so, what? In netbeans you can accomplish this by right clicking the Form (on the listing, underneath where it says the project name->package name->form) then clicking save as template, I believe.

Member Avatar for darkagn
0
84
Member Avatar for neutralfox

An example. . . (You can google Java WAV and a lot more will come up if this one doesn't work for you) [url]http://www.anyexample.com/programming/java/java_play_wav_sound_file.xml[/url] This is probably a difficult read but it seems to have a lot of relevant and useful information. [url]http://java.sun.com/docs/books/tutorial/sound/sampled-overview.html[/url]

Member Avatar for neutralfox
0
141
Member Avatar for bebe11bebe

You can't use a return statement unless you are in a method, so I'm assuming that is the case here. And to figure out the index, 1. Keep a counter and increment it each time you don't find the element you're looking for. Then return the counter I can't think …

Member Avatar for BestJewSinceJC
0
92
Member Avatar for BLY
Member Avatar for BestJewSinceJC
0
160
Member Avatar for Robtyketto

You basically want to set it up so that everything gets repainted, not just your rectangles. So put your drawRectangle statements in the method where all the other graphics are drawn (paint I believe), and use an "if" statement and a boolean to determine if you actually want to draw …

Member Avatar for Ezzaral
0
669
Member Avatar for rajeev_vlal

This is off topic. . But that appears to be a UML class diagram. . but for some reason it seems like the composition diamond on the Course_Student should be on the other side of the arrow?

Member Avatar for BestJewSinceJC
0
72
Member Avatar for leverin4

What are you having trouble with. . having the numbers in forwards/normal order, or with multiplying the numbers, or both? The Math.pow method is useful, but I'm not sure how large your numbers are. You should check out the BigInteger class. It has multiplication and exponents for large numbers. [url]http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigInteger.html[/url]

Member Avatar for JamesCherrill
0
167
Member Avatar for lauren316

[QUOTE]The program asks the user to enter a number one time, and then asks to enter the amount of the item five times, totals each item, and then show the overall total.[/QUOTE] What is the purpose of the first number the system asks the user to enter? Is it to …

Member Avatar for BestJewSinceJC
0
113
Member Avatar for neutralfox

You're using netbeans? It doesn't matter what you're using though, Java works the same regardless. If you're in one class, and you make an instance of that class, a different class will not know it exists. In order for this to happen, you would have to have something like the …

Member Avatar for BestJewSinceJC
0
151
Member Avatar for younaskhanpk

I thought what Stephen said was pretty clear. We aren't going to write your code for you. If you don't know how to write an actionPerformed method, then check out [URL="http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html"]this link on how to write action listeners[/URL]

Member Avatar for younaskhanpk
0
100
Member Avatar for JavaKiddo

Yes, it makes sense. This code is available on the web, it doesn't make 100% sense to me right now (haven't looked that hard really), but it does what you're looking for. It seems to just use the drawLine method to continuously draw lines where the mouse is positioned and …

Member Avatar for Ezzaral
1
123
Member Avatar for redmaverick

[B]Comments on circledriver class:[/B] You don't need two Scanner Objects. You can use the same Scanner Object for reading in different types of data. Also, the standard is to capitalize the class name as far as I know, so it should be called CircleDriver. [B]Comments on DB class[/B] [CODE=Java]if (select.equalsIgnoreCase("circle") …

Member Avatar for BestJewSinceJC
0
113
Member Avatar for xVent

[url]http://www.google.com/search?q=creating+executable+jar+file&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a[/url] What do you want us to do? If you really can't accomplish this task using the command line, use an IDE like Eclipse that will do it for you.

Member Avatar for JamesCherrill
0
110
Member Avatar for madeindadex305

[QUOTE=Ezzaral;834481]Ah, sorry, I only glanced over the assignment and missed that requirement. You could change your if() criteria to check that the box is big enough to hold the item. If it's big enough, check against the one you have already found to see if the current box is smaller …

Member Avatar for Ezzaral
0
142
Member Avatar for subho07

Increase the size of the text fields? [url]http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTextField.html[/url] Notice the method "setColumns" that takes an int or Integer argument.

Member Avatar for subho07
0
247
Member Avatar for MAJORG

You might find Eclipse's debugger useful and easy to learn. Although I've personally (In Java) been able to find errors quite quickly with simple print statements.

Member Avatar for BestJewSinceJC
0
279
Member Avatar for neutralfox

I believe the String class has a toCharArray method that would help you. Then every 3 indexes are what you are looking for. Otherwise, use a for loop to add every substring of 3 chars to an array.

Member Avatar for neutralfox
0
114
Member Avatar for javaman2

Didn't we explain to you in the last thread how to use code tags? Under 'Go Advanced' there is a button that says code tags. Use it. Also add [CODE[B]=Java[/B]] to the first part.

Member Avatar for darkagn
0
150
Member Avatar for shimama

You should consider the fact that the pathname of the file matters, not only the file name.

Member Avatar for BestJewSinceJC
0
141
Member Avatar for prashant1111

Follow Ezzaral's suggestions, unless you're only trying to get input from the user, in which case you can read in Integers, Strings, etc with Scanner. (Google java scanner)

Member Avatar for BestJewSinceJC
0
76
Member Avatar for PhiberOptik

Post your code? I've used port numbers before, I can't speak for the similarity of my assignment to yours, but I believe I used values that darkagn suggested with no problems. I pretty much just used the Java Sun tutorials on Sockets when I used ports. But post it and …

Member Avatar for PhiberOptik
0
94
Member Avatar for denniskhor

I would help if your explanation was coherent. Repost it but this time, make sure it makes sense.

Member Avatar for denniskhor
0
120
Member Avatar for stewie griffin

Or if you want to generate any old runtime error, I've learned plenty of ways to do that in my time programming. :) One of the most common is indexing an array by an index too low or too high

Member Avatar for Ezzaral
0
171
Member Avatar for artemis_f

FYI, to add to what Ezzaral said, the clone method makes a shallow copy, not a deep copy. So it will just be a reference to the same object, not a new copy of the object. If you want to make a new copy of an Object, which is NOT …

Member Avatar for artemis_f
0
117
Member Avatar for ckillackey

The loop to populate should be a for loop, to add to what the person above me said. edit: I will check back on this tomorrow if I remember, I'm too tired right now. Sorry!

Member Avatar for sillyboy
0
119
Member Avatar for smithu.simi

I think this can be accomplished using int n = 0; printf("%d", n); But hey, that might be because it's the only C code I remember.

Member Avatar for BestJewSinceJC
0
112
Member Avatar for phalgun_g

[QUOTE=s_sridhar;832379]Writing programs for chess [complex calculations] can be done practicallly only by supercomputers[/QUOTE] Sounds false to me. Who told you that? ;)

Member Avatar for MosaicFuneral
0
161
Member Avatar for dammitjim30

You forced them to input a row between 1 and 3 and a column between 1 and 3. Your array has 3 rows and 3 columns. Arrays in Java (and most other languages) are indexed from 0 to (rows-1). Which means that your array's first cell is _board[0][0], and _board[3][3] …

Member Avatar for dammitjim30
-1
450
Member Avatar for javaman2

When you use the code tags in the Java forum, where it says [CODE], put [CODE=java] and it will give it Java highlighting and it will number the lines. This makes it easier for everyone to find and discuss things. Also, I looked through your code, and I noticed one …

Member Avatar for darkagn
0
708
Member Avatar for ZeRo 00

Lets assume you have two classes, Panel1 and Panel2. You could have a method called updateFromComboBox in Panel1's class. Then, when the combo box in Panel2 is selected, you can use the updateFromComboBox method to update Panel1 based on whatever was selected in Panel2. Note that this would require that …

Member Avatar for JamesCherrill
0
112
Member Avatar for amarjeetsingh

You just count the number of times each one appears in the String. A simple web search would tell you that.

Member Avatar for javaAddict
0
124
Member Avatar for rainny

So you have times stored in milliseconds in a JTable? Then use the getValueAt(row, column) method of JTable to get the values from the cells that are next to each other. If you look at the JTable documentation for the getValueAt method, you'll notice that the return type is Object. …

Member Avatar for BestJewSinceJC
0
95
Member Avatar for macfrik
Member Avatar for blaklite
Member Avatar for jackiejoe

I don't think you can "make netbeans do it". I think you have to take Ezzaral's advice and learn how to do it by coding it yourself in the source code under the source button for netbeans. Which basically amounts to a loop that goes through the table indexes and …

Member Avatar for BestJewSinceJC
0
87
Member Avatar for jdbarry

What equation exactly are you using? distance = (velocity initial) * time + one half (acceleration)(time squared) is the equation I remember. Your site is not accessible, probably because I don't go to your school. And where in your program are you getting the wrong results? You should be able …

Member Avatar for BestJewSinceJC
0
187
Member Avatar for bunifrog

You posted much too much code. If your GUI isn't launching it is probably because you didn't call setVisible(true) on the JFrame, but who knows since I didn't manage to find your main method after scrolling through.

Member Avatar for bunifrog
0
140
Member Avatar for weinyeong

Nobody is going to baby you through your projects. Start by asking some specific questions. If you don't know any Java programming I suggest you read a tutorial or three.

Member Avatar for stultuske
0
121
Member Avatar for freaky.pandit

You're doing a project for your major and you expect someone on here to give you the code? Lol.. rearry?

Member Avatar for verruckt24
-1
129
Member Avatar for BestJewSinceJC

In netbeans I added a scroll pane + bar inside one of my JPanels. When I drag enough items into the JPanel, the size of the JPanel increases in netbeans. How do I get it so that it stays at a fixed size, so I can use the scroll bar?

Member Avatar for BestJewSinceJC
0
2K

The End.