7,116 Posted Topics
Re: Have a look at JTable (google it for examples) | |
Re: Sounds like you may be running your loop on Swing's thread (eg in a listener method). When swing calls one of your methods it doesn't do anything else until your method returns. | |
Re: Why all that messing about with the path? Why not go straight through like this file = chooser.getSelectedFile(); image = ImageIO.read(file); | |
Re: The JVM provides a standard environment for Java programs to run on, independent of the platform. However, the JVM itself needs to interface with the OS, so there is a different version of the JVM for every OS. | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: That is the kind of thing that Eclipse plug-ins do, so I expect its not too hard (although I've never actually done it myself). There's loads of technical info for plugin developers on the Eclipse web site, plus you can look at the source code for existing plugins. It's nothing … | |
Re: Means what it says. The compiler attempts to check all the paths through your code to make sure you always initialise variables before you try to use their values. It has seen that there are some combinations of the if tests where this may be a problem. You fix it … | |
Re: Yes, it would make sense for the readFile method to return the data it has read. A 2D array is one sensible option. It's straightforward to create a table that displays a 2D array - all you need is a second array that has the column names. Post what you … | |
Re: "inner class" means you have declared one class inside another (bull2Game is declared inside Main). In this case that's probably a mixup with the matching of the { and } | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: Java images are RGB, so you would need to convert, but that doesn't seem too easy... http://en.wikipedia.org/wiki/Lab_color_space#RGB_and_CMYK_conversions | |
Re: Please post the actual code that gives the error - the mish-mash above won't do anything - and then post the exact complete content of all error messages - including compiler errors - and line numbers | |
Re: That's a very general question. There are many good tutorials and examples around this subject, so google for suitable tutorials on the web, then come back here if you have specific questions | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: How many integer values were there before and after you added more integer values? | |
Re: Other people will have the same problem, and will find this article, so please share yur solution with the rest of the DaniWeb community. | |
Re: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Have you tried Google or Bing? | |
Re: leeana. This is a long dead thread. DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question | |
Re: I think that's just a work-in-progress framework, so he can test that part of the code before moving on to doing more exciting things for each char (in which case I thing he is doing *exactly* the right thing). | |
Re: You create the file inside your loop, so each row of the results creates a new file and replaces the previous one. Create the file and the Writer before entering the loop and that should work better. | |
Re: The easiest way is probably to use Sockets to establish a 2-way communication between the running apps. That also has the advantage that it works exactly the same if one of the apps is moved to a different computer. There are "better" solutions, eg RMI, but they come with a … | |
Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules include: "Do provide evidence of having done some … | |
Re: Sorry, this is not a personal valet service. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: All you need is is to see how long that time is from now, then create a java.util.Timer that will call you back after that time has elapsed. In your callback you can pop up an alert or whatever else. | |
Re: Why 1.5? - that is also an obsolete version (replaced in 2006). Only the current version (1.7) will protect you with all the latest security updates. class files compiled under earlier versions should execute unmodified under 1.7 | |
Re: @joejo From here there's no way to know if the church story is true, or just an attempt to get sympathy for homework help, but assuming it's true: You have no choice but to go to the church, admit that you were hopelessly optimistic when you agreed to do this … | |
Re: Serious suggestion: work a couple of examples on a sheet of paper writing down everything you do. Then write code to do the same thing. | |
Re: Just this once I'll do your Googling for you http://docs.oracle.com/javase/tutorial/java/concepts/index.html Next time do some work yourself before asking for help. | |
Re: Hello yogita. Welcome to DaniWeb, but please read the DaniWeb member rules before posting http://www.daniweb.com/community/rules In particular: Do not hijack old forum threads by posting a new question as a reply to an old one and Do provide evidence of having done some work yourself if posting questions from school … | |
Re: Date objects don't have a format, they just hold a date. The SimpleDateFormat class has easy methods to parse strings like yours into Dates, and to display Dates in yopuir desired format. | |
Re: Not sure what your point is here. Is there a question? | |
Re: Let's assume that you are going to put the file reading code into a method, eg readDataFrom(File f). In that method all you need to to do is to read the file, split the lines (as Norm said) and add that data to a 2D array. Finally you return the … | |
Re: `if(e.getSource()==change.getSelectedIndex())` `e.getSource()` is the object where the event happened `change.getSelectedIndex()` is the line that's currently selected these are two quite different things, and will never be equal. You probabaly want something more like: if(e.getSource()==change) { // use clicked in the change object int selectedLine = change.getSelectedIndex(); // this is the … | |
Re: You should think about using a jar file to distribute your application. Jars can be "signed" which guarantees that they have not been tampered with. You can check in your program that the signature is OK - it's a little messy, but this discussion has solutions: http://stackoverflow.com/questions/1374170/how-to-verify-a-jar-signed-with-jarsigner-programmatically | |
Re: You are re-using tempArray. When you add tempArray to data you are adding a reference to tempArray. Because you re-use the same array, every entry in data refers to the same array. Then you reset the contents of tempArray and overwrite with the next row's data. You need to allocate … | |
Re: "Later" as in "later in the same run of the program" or "when the program is run again some time later"? | |
Re: If you don't show us your code we cannot tell you what's wrong with it. | |
Re: What's the variable "a" for? You use it but never give it a value. What's the boolean "addTicket" for? - What are you saying when you say "addTicket is true"? When/where do you ever update isSuspended? Finally if you are getting a compiler diagnostic about return statements then post the … | |
Re: Do you mean `string1.equals(string2)` ? (returns true only if both strings contain exactly the same sequence of characters) | |
Re: I say "do a project". It almost doesn't matter what it is as long as it's not too simplistic. Now you have the essential concepts you will learn best by doing. | |
Re: In your loop (starting line 43) you use ctr to index the % values, increasing it at the end of the loop, but you set it back to zero at the start of every pass thru the loop (line 44), so you only ever use index 0. The newPresident is … | |
Re: This question makes no sense. Float values are held in binary, not decimal, and adding a trailing zero after the decimal point makes no difference to any numeric values. | |
Re: 1. use the String matches(Regex) method with a regular expression for whatever you consider to be a letter in whatever languages you need to support. 2. check each char in the String one at a time using Character's isLetter(char) method which knows about non-english characters. | |
Re: > Should I have Credit class with the attributes date, amount and source? yes | |
Re: For that size of data there's no reason why you would not keep it all in memory - about a megabyte should be enough. You can simply read a text file with all the words into an array of Strings. Searching in memory will be orders of magnitude faster than … | |
Re: There are a load of answers in this 2004 zombie thread using Runtime.exec to run an external process, but this was superseded in Java 5 (JDK 1.5) with ProcessBuilder, which is now preferred to Runtime.exec [url]http://www.java-tips.org/java-se-tips/java.util/from-runtime.exec-to-processbuilder.html[/url] | |
Re: 1. Put all the strings with the fortunes ("yes" etc) into an array. Use a random number as an index into the array to pick one of the strings. 2. Create a boolean tha tells you whether you are currently displaying the 8 or a fortune. Test that in the … | |
Re: > The reason why you are getting errors is because you are trying to return a single integer when in your function def you are saying it will return a pointer to an integer (unless Java can actually return arrays, in which case that would be an array). This is … | |
Re: You could use two arrays, but that's a pretty messy solution. Java has a HashMap class that lets you create pairs of key/value and it will look up the value from the key for you. This example creates a map with Strings for the key and value, adds a couple … |
The End.