1,678 Posted Topics
Re: [url]http://www.devx.com/tips/Tip/5697[/url] That will help you locate resources using getResource(). Note that when you run a file, you are not running a .java file so it isn't like you can say "where am I?" and get back the location of a .java file. | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html[/url] ^ A useful resource on how to make applets. Besides not needing the main method (if that is the case, which I think it is), you declared your main method incorrectly - you have a ";" after the closing parenthesis, which is going to cause errors. | |
Re: hello world only has [I]10[/I] alphabetic characters, not 11. What exactly do you want your program to do? In any case you can use the Character class's isSpace, isWhitespace methods, etc [url]http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Character.html[/url] | |
Re: [CODE]JOptionPane.showInputDialog(null, "Please enter a song title: " + Song.SENTINEL + " to quit:");[/CODE] should be [CODE]title = JOptionPane.showInputDialog(null, "Please enter a song title: " + Song.SENTINEL + " to quit:");[/CODE] and similar methodologies can fix the rest... | |
Re: Do you think you might be able to use De Morgan's laws? [url]http://en.wikipedia.org/wiki/De_Morgan%27s_laws[/url] | |
Re: Hi Josh, welcome to the forums, looks like you have an array of languages under your belt already - where do you go to school? | |
Re: In your Login class, you have a method called set. It should be called "add" because it adds a String to the ArrayList. And I don't see what line you're talking about. What line number is it on (as far as the line numbers to the left of your code … | |
Re: Since I've heard of Flex and not Tibco I know that my company is interested in Flex, but that doesn't mean [I]yours[/I] is. Why not talk to someone at your company about the pros and cons of each? | |
Re: And they are absolutely right. If you cannot offer services on the internet that are harmless in concept, but subject to abuse, then you cannot offer the same level of service and the same experience to your customers. No one can be reasonably held accountable for something like that when … | |
Re: Use a Scanner. Really, the exact way to do it depends on how your text file is set up, but [URL="http://java.sun.com/docs/books/tutorial/essential/io/scanning.html"]here[/URL] is a general tutorial on Scanner. | |
Re: And what is your formula for monthly payment [I]supposed[/I] to be? I don't have a mortgage currently, and I don't know that information. But I'd think it'd be based on the total amount of time you plan on paying off the mortgage over .. | |
Re: it should be print(total, month); not print(double total, String month); | |
Re: . . And will more than likely look nothing like it would if you wrote it. | |
Re: [QUOTE=Dave Sinkula;1146684] I think Cprog was down and I started searching for other forums. (And later, I was a bit of a Jul groupie.) After a while, I liked the features and things that I could do here that I couldn't on other sites. (Most of these have since been … | |
Re: My worst secret is that I thought this was a serious thread, but then clicked the link and loled at those poor peoples' broken hearts, but I don't want you guys to know I thought the link was mildly funny, so instead, I leave you with this: stop spamming daniweb, … | |
Re: It is hard to help you when you don't use code tags. You can either call the other class's main method using OtherClass.main(args go here) or you can figure out how to use Runtime.getRuntime.exec(). Those are the only two methods I know of but in my ~4 years of Java … | |
Re: Read [URL="http://www.gidnetwork.com/b-66.html"]this[/URL], it was originally posted on Daniweb by WaltP in [URL="http://www.daniweb.com/forums/thread256856.html"]this[/URL] thread. | |
Re: That is because the way you wrote it doesn't save any of the values after they are read in - in this section of code, you ignore the return value of showInputDialog, hence, you never store the value the user entered, and it is lost. [CODE]JOptionPane.showInputDialog(null, "Please enter the grade … | |
Re: Yeah - paste the error message along with the line number. | |
Re: Probably because whatever method repaint() indirectly calls (paint or update, I don't remember which) must be clearing your background. Get rid of the call to repaint() and instead try calling revalidate(). If that doesn't work and you post the rest of your code, I'll play around with it later tonight … | |
Re: Because you don't do your own homework. Or maybe it is because j++ already increments the variable j so storing that result into the variable j is redundant. Take your pick. edit: Oh, goodie. I just learned after reading your other thread that [URL="http://www.daniweb.com/forums/thread264294.html"]WaltP just told you the exact same … | |
Re: ^Haha. You can easily look up the correct way to define a main method on google. Keep in mind that main is the method that runs when you start your program. Read about methods here. [url]http://java.sun.com/docs/books/tutorial/java/javaOO/methods.html[/url] | |
Re: [QUOTE=balmark;1145192]If you want to screw about with crap like 'OuterClassDemo.this.displayText' I'm glad you don't work for me, I assume your code is unreadable you arrogant little fish.[/QUOTE] The Java tutorials make extensive use of anonymous inner classes and there are numerous articles online explaining their advantages. I assume the reason … | |
Re: Object.getClass().getName(); Obviously that won't work on primitive types. But why do you want to do this to begin with? | |
Re: Place it in a JScrollPane to begin with. You should always have it in the Scroll Pane and set the Scroll Pane up so that it sizes how you want to. Don't keep putting it in and taking it out. See [URL="http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html#sizing"]how to size a scroll pane[/URL] | |
Re: Yeah. fileChooser.getSelectedFile() will return a File Object. Then you can use the basic I/O methods provided in the Java libraries to open, read, then write that file to whatever location you want. | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html[/url] JMenuBar, then you add JMenuItems to it if I remember correctly. In any case all the info you need is there. | |
Re: [CODE]String f = firstLabel.getText(); float fi = Float.parseFloat(f);[/CODE] That is the source of your first error. You are trying to parse "Fahrenheit: " as a float. It is a String. And we don't get rewards for helping people here. Besides which, giving away free copies of BioShock is undoubtedly illegal, … | |
Re: I type with two fingers, and I probably type at well over 60 wpm, (over 70 according to some typing thing someone posted here - but who knows how accurate that was). My advice is just to type however you want and to do so more often. Save your money … | |
Re: In your switch statement you put the numbers in "". They can't go in quotes. You also capitalized the word Switch. It should be in lowercase. [url]http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html[/url] Also, again, you did not use code tags. Read the rules stickied at the top of the forum. | |
Re: It's respectable that you posted a code snippet, despite the many reasons one could find not to do so. So respect to you for that. And I typically just up vote or leave a reputation comment (which auto up votes) if I see down votes that appear to be for … | |
Re: Your code only works if args.length >= 2 and if the args can be parsed as integers. In short, it is almost useless. As is upping a thread that is 3 years old. | |
Re: It isn't working because on line 33 you have [CODE] JTextArea textArea = new JTextArea( 5, 10);[/CODE] but you should have [CODE]textArea = new JTextArea(5,10);[/CODE]. If you leave it as the way you have it, then you are creating a completely different JTextArea than the one you are referring to … | |
Re: When peter says 'run random...' he means to generate a random number that is between 0 and the length of your array - 1. The reason for this is because if an array can store 5 numbers, then array[0], array[1], array[2], array[3], and array[4] are the storage spots. Hence the … | |
Re: It is called an if statement, not an if loop. Only structures which repeat are called loops, such as for loops, do while loops, and while loops. If you can't use a return; or a break; statement, you could simply have a boolean variable (actually an int in C) and … | |
Re: It ends the program. [url]http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#exit%28int%29[/url] | |
Re: Kvass is right, but that isn't all you need to know to be able to do your program. Since the user is entering two words separated by a space, you will need to be able to get those two words into two separate Strings before you can follow Kvass's advice. … | |
Re: It is called deleting an element from an array, not deleting the array. Just a little terminology thing - you sounded like you were saying you wanted to delete the entire array. Anyway, you can do this by moving each element back one like you suggested. So you'd need to … | |
Re: I'm not really sure what that means, as the previous poster suggested, perhaps you should elaborate. [URL="http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html"]JOptionPane ?[/URL] | |
Re: [URL="http://java.sun.com/docs/books/tutorial/uiswing/events/focuslistener.html"]Focus Listener Tutorial[/URL] And changing the background color is just a question of looking up the methods in the JTextField API. | |
Re: We don't get anything for helping you, so when you ask questions that waste our time, you usually get mean or sarcastic responses. If you get a response at all. See [url]http://lmgtfy.com/?q=draw+a+diamond+java[/url] | |
Re: You can't use doubles with switch statements. You can only use ints or chars. So it is saying possible loss of precision probably because it is automatically downcasting the double to an int. | |
Re: You're misunderstanding the concept of a for each loop. Change the code to this: [CODE]final int[] message = {60, 80, 100...} for(int i: message) { System.out.print((char)i); }[/CODE] | |
Re: It sounds like pretty much any Scripting Language could do this task easily. I just started learning scripting languages though, so. . I digress. Either way though, this question would be better suited for the Computer Science forum, or you could go ahead and post it in one of the … | |
Re: If you want to read all of the ints from a File one by one then use Scanner and use the nextInt method. If you want to read an int using RandomAccessFile, it has a readInt method. | |
Re: The major is more than likely called Computer Science, it is impossible to say what programmers "generally" work on - jobs in computer science vary greatly, pay scale also varies greatly depending on area and individual but right now I think 50K would be considered low for a starting salary. … | |
Re: Yeah, there are plenty of other forums, why don't you go get help there? |
The End.