7,116 Posted Topics
Re: This is a Swing context, so never use sleep etc. It looks like this code is the "model", so best to use a Java.util.Timer (runs in its own thread) | |
Re: Do you have the spreadsheet as a file, or do you have all the data in arrays or some other data structure. If it's the latter then you can use ordinary SQL commands via JDBC to update the database. | |
Re: I sense a non-argument here! If the goal is to write the simplest Java code then use a set. If this is a beginners exercise in arrays and algorithms then Slavi's algorithm with stultuske's addendum. My guess is that it's the beginner's version. | |
Re: In the same vein... Unicode also has characters for displaying chess pieces, starting at u2654 | |
Re: Without seeing what you have done, and because you hae not asked any specific questions, how can anyone help? | |
Re: The dot refers to the current working directory. | |
Re: That's the compiler being a bit smart. It's checking that you always return a value as specified in the method signature. Suppose your data is such that none of the cases is true... In that case it will drop through the switch and hit the end of the method without … | |
Re: (year % 100 != 0) && (year % 400 == 0 ) something wrong there... if (year % 100 != 0) then (year % 400 cannot be == 0 ) ps: I guess you know that the current (Gregorian) calendar is only valid from 1752? | |
Re: [Here's](http://docs.oracle.com/javase/tutorial/networking/sockets/index.html) a good tutorial on using input and putput streams over Sockets, but instead of using print streams, you can use ObjectOutputStream and ObjectInputStream to transfer your image object. | |
Re: You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java … | |
Re: "but to no avail", while very poetic, tells us nothing. What was wrong with it? Did you set a mono-spaced font eg Courier? | |
Re: How short is "short"? If the string/file is less than 2^16 characters long then there will be at least one UniCode character that's not in the string, and which will therefore meet your requirement. ;) | |
Re: Where is the centre of rotation (is it the top left corner?) | |
Re: `Integer.parseInt(...` takes the string that the user entered and converts it to an int. You can put that into an array of doubles, but you will have lost everything after the decimal point. If you want to parse a string for a double value it's a very similar method... `Double.parseDouble(...` | |
Re: Even after you fix that... When your method reaches the return statement it will immediatley return to the caller, and any remaining statements will not be executed. That's what your error message means - lines 43-49 can never be reached because line 41 will exit the method. | |
Re: You are using + to concatenate stuff for printing, OK, but you have left some out. You need a + between every expression.. "there are " + weeks + " in " + (etc) | |
![]() | Re: You can do this by using JDBC to read the data and a JTable to display it. It's a fairly common thing to do, so you'll find many examples and tutorials on the web - just Google `JDBC` and `JTable` together |
Re: So what is it about making your jar that you need help with... How to make a jar in NetBeans? How to embed images in a jar? How to embed a database in a jar? Sonething else? | |
Re: I don't know, but you could try printing the contents of firstLine to see what's happening. Maybe it's something that's not displayed, like "<html>" ??? | |
Re: ? Splitting the declaration onto 3 lines will have zero effect. This is not a "null" problem, it's an undefined symbol. The problem is that the Preference class is not known when compiling that code. Where is the Preferences enum defined? | |
Re: You must try to answer this question. Show us your answer and we will help you to get it right. | |
| |
Re: SQL isn't going to loom large in a Game. Java hasn't been used much in the past for games, but modern Java and JavaFX is no worse than c#/.NET, and lot more portable. However, the big question is "where does IOS fit (if anywhere) in your target gaming market?". IOS … | |
Re: Lines 43-51 you set the same data for all 3 cats, using the data from the third/last pass of you input loop, so when you print them of course you see the same data You need to set cat1 *during* the first pass of your loop, cat2 in the second … | |
Re: The thing that immediately jumps out is that on line 44 you comment *end of for loop*, but theres no closing bracket to implement that, so the for loop is not going to end where you think, and subsequesnt loops and blocks will also be suspect. If you are using … | |
Re: YOU can use Java Sockets to connect to a web site, send an HTLM request, and read the response. The hard part is usually parsing the web page to extract the right data. The first half of [this tutorial](http://www.binarytides.com/java-socket-programming-tutorial/) shows you how to get the web page's HTML. The parsing … | |
Re: Nobody will send you the code. Sending you the code will only help you to cheat. Either do the work or drop the class. If you want to take this seriously, post what you have done so far and someone will hel you from there | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there. | |
Re: The check is obviously done in your isInteger method, so you need to change that. Edit: djjeavons makes a good point. My advice above is bad. Don't change isInteger - maybe create a new isAlphanumeric method to parallel isInteger but with the tests you need. | |
Re: I suggest you post this in the Java forum, but first check the DaniWeb Member Rules and "provide evidence of having done some work yourself if posting questions from school or work assignments" | |
Re: Sending mouse and keyboard events depends on the language you use, but the real problem is how to send and update the real-time screen image across a limited bandwith. It all comes down to how you compress the screen images. We had a long thread on this in the Java … | |
Re: You input two mileage figures (`exmile`, `retmile`), but your if tests use `mileage`, which you never set. Typically you would have a do....while loop that keeps processing user input until the user enters a "stop" value (eg a car ID number of <= 0), or you ask if there's more … | |
Re: Obviously you can use bitwize operations to separate out the two bytes of each short and store them into consecutive elements of a byte array (and vice-versa), but does anyone know a smarter solution? | |
Re: There's no one absolute definition of "Object Oriented", so different people will give diferent answers to those questions. Here are my first attempts: All Java OO programs are Java programs All Java programs are OO to some degree because that's how the API is designed. Some people write Java programs … | |
Re: That's his opinion - my opinion is opposite. The "resource deprived hardware" phones he talks about have more memory and compute power than the mainframes I learned on. Every new verison of a phone is faster and more powerful than the previous. Hardware isn't the problem. More functional, more intelligent, … | |
Re: [This web page ](https://crackstation.net/hashing-security.htm)has an excellent discussion of how to do it (and how not to do it) | |
Re: It's creating a grid to display one month's calendar, one week per row x 7 columns. It loops through all the days, divides by 7 to get the week (row), and modulos by 7 to get the day (col). The "som" variable contains the day (Mon, Tues etc) corresponding to … | |
![]() | Re: Since you mention Mac OSX... Your sizes and positions seem to be in pixels(?). How do you deal with the difference between "retina" displays and older ones with pixels more than twice the size? ![]() |
Re: After 5 years either he will have got the answer or have given up. Please don't re-awaken old dead threads without a good reason. | |
Re: You obviously need to re-initialise your booleans each time the user enters a new password (ie around lines 19 to 31) | |
Re: http://docs.oracle.com/javase/tutorial/jdbc/index.html | |
Re: You seem to be ignoring the end-of-line char(s). What did you intend wih the two calls to readLine? | |
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 (which you agreed to when you signed up) … | |
![]() | Re: Use String's `split` method http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String) |
Re: Java EE is a superset of Java SE that has tools for Enterprise-scale application development and deployment. Java SE includes all you need to perform transactions on popular SQL databases. See the Java SE tutorials for JDBC: http://docs.oracle.com/javase/tutorial/jdbc/index.html | |
Re: Line 16 you create a new array of ints. You don't provide any initialisation, so all the elements are 0. Lines 17-25 are only executed if the array elements are not 0 - so they are never executed. | |
Re: Look at your line 11. What do you think that does? | |
Re: Soiunds like a homework question to me! Read the [DaniWeb Rules](https://www.daniweb.com/community/rules) What do **you** think the answer is? ![]() | |
Re: Just think of the number in in its binary representation. What question will tell you the value of the first bit? Knowing that, what question will tell you the value of the next bit? How many questions will you need to know the values of all the bits? |
The End.