7,116 Posted Topics
Re: [QUOTE=emclondon;1744927]this should work 99.99%[/QUOTE] Well, it might if it compiled more than 0% (uses method from original solution but not included in your 99.99% code). | |
Re: I bet the OP has been waiting impatiently for the 7 1/2 years since he posted and then solved this problem, just in case you would come along with another solution. That's great. He can hand his homework in now. | |
Re: You seem to have a [I][B]very [/B][/I]old version of Java lying around. Just uninstall it then install the latest JDK (1.7.x). | |
Re: That's not enough info! Please explain what you need in a bit more detail. | |
Re: You can use the SimpleDateFormat class to parse a time in format "hh:mm" and convert that to a Date object. You can convert two date objects to millisecs and subtract one from the other to get the time difference. You can finally use that to create a new Date object … | |
Re: Google [B]Java ProcessBuilder [/B] for examples and tutorials | |
Re: I think you may be confused about how many classes there are? public void paint(Graphics g){... is just an ordinary method in your Eyes class. Like any other method it can simply use the variables of that class, including the ints red, green and blue that were initialised in the … | |
Re: That code was to get you started, it wasn't intended to be a complete solution. Nobody here will just give you the complete solution. You will find that it's very useful if you understand what it is doing, and how that differs from your use of nextByte(). | |
Re: "exercise" is not equal to "Exercise" It's probably a good idea to convert everything to a single case (eg toLowerCase()) to avoid this kind of problem. | |
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 doing your homework for you. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting … | |
Re: Java has: [B]AWT [/B]the original GUI class library from Java 1, obsolete except to the extent that it was the basis for [B]Swing [/B]the updated and improved version of AWT that's current [B]SWT [/B]a Windows-specific class library that gives direct access to the Windows GUI environment. Much loved by IBM, … | |
Re: [I]if (propertyID.length < 1)[/I] propertyID is an array, so you are just testing its declared number of elements. I guess you intended to test the length of the String [I]propertyID[numberOfPropertiesInArray][/I] | |
Re: Normally you would have a stack where you can push values and operators as you parse them, and pop them when it's time time to execute each operator. | |
Re: Just set a java.util.Timer to run your method after an initial delay of 30 minutes or whatever. @stultuske: what are you smoking? Did you miss something out of that code, or was it pure Monty Python? | |
Re: Do you mean you want a data type, or do you mean a GUI component that the user can use to select a date? | |
Re: Put them all in an array so you can do things with them in a simple small loop. | |
Re: [QUOTE]cannot find symbol symbol : constructor JComboBox(java.lang.String)[/QUOTE] Check the API doc: JComboBox does not have a constaructor that takes a String as a parameter. [QUOTE]location: employeesCB = new JComboBox(getEmployees());[/QUOTE] Now [I]getEmployees [/I]sounds like it should return an array or collection of Employees - which would make perfect sense as a … | |
Re: You don't say why you wan to do that, but if you're after local language, number formats etc, Java provides a Locale class with many pre-defined instances for such purposes [url]http://java.sun.com/developer/technicalArticles/J2SE/locale/[/url] [url]http://blog.ej-technologies.com/2011/12/default-locale-changes-in-java-7.html[/url] | |
Re: After a VERY quick look, looks like check() disables them then immediately calls resetState which enables them again | |
Re: Hide keeps your whole form with all its components and other variables live in memory - it just hides it on the screen. If you want to re-open it with the existing data etc still there, hide is appropriate. If you want to re-open it with its contents/state reset to … | |
Re: Variables come in 2 flavours - primitives like int, boolean, float and reference variables that hold a reference (pointer) to an Object. They are all so small that you rarely, if ever, need to worry about their memory. Local variables are allocated/deallocated when they come into scope / leave scope … | |
Re: I don't want to discourage you, but if you are a beginner you will probably find custom renderers and custom editors pretty challenging. Do you really have to use check boxes? Perhaps you can just use an ordinary multiple-selection JList for now? | |
Re: What does "only characters... not strings" mean? but whatever, here's one way [url]http://www.devx.com/tips/Tip/14311[/url] and the intro to the JavaDoc for JTextField shows another way - this one is an officially-approved approach | |
Re: You're never going to debug code that complex by just looking at the final result. Put a load of print statements into your code, printing the values of the key variables at each stage so you cen see where it's going wrong. Especially print everything that's pushed or popped on … | |
Re: The exception also tells you the line number where that happened -- essential info! But... normally you'll get that from [I] s.nextInt()[/I] when the next thing in the scanner isn't recognised as an integer. | |
Re: For each word: int nextVowel = 0; Loop through the word look for vowel[nextVowel]. If you find it, nextVowel++ and continue looping thru the word If nextVowel gets to 5 the word has all 5 vowels in order | |
Re: clientData[] firstClient = new clientData[0]; .... defines an array of size 0, not big enough to be useful! You may prefer something like clientData[] manyClients = new clientData[100]; // array to hold up to 100 clients Then you can simply do stuff like manyClients[0] = new Client(...) // create new … | |
Re: When you ddisplay an Object in Java, it calls its toString method. Every Object has a toString method because they inherit one from the class Object. That inherited method prints the name of the class and the Object's hash code (probably, but not necessarily its address). To display something more … | |
Re: Space is decimal 32, yes, but far better to use a char literal to avoid any possible confusion or error (remember that char is a numeric type): [CODE]if (key == ' ') ...[/CODE] | |
Re: If both panels are running on the same machine,, then why not just have Chatpanel 1 call an update method in Chatpanel2? If they are on different machines, then the standard solution is to implement a Listener interface for the receiver socket code. The code for Chatpanel2 should register itself … | |
Re: You have to create an instance of one of its concrete subclasses, as in Loan loan = new PersonalLoan(...) or loan = new BusinessLoan (...) You can use the same Loan variable for either type because they are both a "kind of" Loan. | |
Re: You can open an output file in append mode. If you append one byte to the file each time you create an instance, then the length of the file will be the same as the number of instances created. (You'll have to synchronize the relevant code to avoid thread-related problems) | |
Re: You know that Java 1.4.x was replaced in 2004 by Java 1.5, which contains major enhancements to the language. We are now on Java 1.7 Your bug fixes and security patches are about 8 years out of date, it really is time to update. | |
Re: [url]http://www.daniweb.com/software-development/java/threads/407757[/url] | |
Re: [QUOTE=scheppy;1740877]I'm using a version of java that doesn't have method overloading for putClentProperty...[/QUOTE] just for the record (many people read these posts) it's not putClientProperty that has changed. Before Java 1.5 you had to convert between int and Integer explicitly (ditto boolean and Boolean etc). From 1.5 Java introduced "auto … | |
Re: It would help if you posted an exact complete copy of the error message(s). | |
Re: Seems very unlikely that that code fragment, on its own, would run out of heap (unless you're using JavaME?). Maybe it's something in the rest of your code - can you post it all - if it's big a small runnable demo of the part that fails would be even … | |
Re: One reason is to prevent anyone else from instantiating members that class by just using "new", eg if it needs to be instantiated by some special "factory" method. If you want to quote a couple of example classes that have private constructors we can give more specific answers for those. | |
Re: You can pass a String containing any valid JavaScript expression or program and get it evaluated, returning the result to your Java program. This works because JavaScript is a dynamic language, compiled and evaluated at runtime. Requires Java 1.6 or later. Eg: [CODE] ScriptEngine js = new ScriptEngineManager().getEngineByName("JavaScript"); try { … | |
Re: Like jwenting, I found that once you have created a Swing GUI or two it's easier to get exactly what you want by coding it yourself. | |
Re: Create a public method in class1 that accepts the text as a parameter and updates the test area as required. From class2, just call that method. | |
Re: If you have an array arr that's int[m][n] then you can get the size as follows m = arr.length; n = arr[0].length; now you know how to get m1,n1,m2,n2 the rest is just if tests and other stuff you already know how to do. | |
Re: use putClientProperty to associate the row and column numbers with each button when you create them. In your ActionListener just use getSource().getClientProperty to get the row/col numbers for the button that was clicked. The documentation for these methods is, as always, in the Java API JavaDoc, and can also be … | |
Re: mybox.volume attempts to find a variable called volume in the Box class. You have no such variable (but you do have a method!). | |
Re: There are two fundamentally different approaches to this: 1. You run the program, then display the yes/no buttons. When the user clicks the "yes" button your event handler runs the program again. When he clicks "no" you exit. This approach doe NOT have an explicit loop 2. You start a … | |
Re: Maybe you can do that then fill the inner triangle with a transparent color (alpha = 0)? OR Maybe you can convert that shape into a single line so swing can understand inside/outside properly? - ie path round the outside, path a connecting line to the inner shape, path the … | |
Re: The Robot class has a method to click anywhere on the screen. Finding the coordinates of the browser's button may be harder... | |
Re: [url]http://docs.oracle.com/javase/1.3/docs/tooldocs/win32/javac.html[/url] | |
Re: The Desktop API (Java 1.6 and later) includes sending emails via your system's default email application [url]http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/[/url] It's a LOT simpler than the old javamail api. | |
Re: You need to keep clear in your mind the distinction between a Java object and a Java reference. The only way to create an object is via the "new" keyword*. The things that go in variables and ArrayLists are [I]references [/I]top objects. If I say [CODE]Item i = new Item("Cabbage"); … |
The End.