7,116 Posted Topics

Member Avatar for befigard

[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).

Member Avatar for emclondon
0
139
Member Avatar for Eclipse

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.

Member Avatar for JamesCherrill
0
265
Member Avatar for mrabrar09

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).

Member Avatar for JamesCherrill
0
249
Member Avatar for 47pirates
Member Avatar for Shodow

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 …

Member Avatar for DavidKroukamp
0
122
Member Avatar for shotokanpoloto
Member Avatar for Eragah

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 …

Member Avatar for Eragah
0
215
Member Avatar for behrad kiani

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().

Member Avatar for JamesCherrill
0
325
Member Avatar for zerose

"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.

Member Avatar for zerose
0
220
Member Avatar for deathmagnetix

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 …

Member Avatar for deathmagnetix
0
170
Member Avatar for Karlwakim

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, …

Member Avatar for Karlwakim
0
164
Member Avatar for jasonrefan

[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]

Member Avatar for jasonrefan
0
138
Member Avatar for hszforu

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.

Member Avatar for hszforu
0
314
Member Avatar for harinath_2007

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?

Member Avatar for harinath_2007
0
136
Member Avatar for Upoma

Do you mean you want a data type, or do you mean a GUI component that the user can use to select a date?

Member Avatar for JamesCherrill
0
186
Member Avatar for zerose
Member Avatar for Vampiricx3

[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 …

Member Avatar for JamesCherrill
0
149
Member Avatar for dennysimon

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]

Member Avatar for JamesCherrill
0
137
Member Avatar for emclondon

After a VERY quick look, looks like check() disables them then immediately calls resetState which enables them again

Member Avatar for ~s.o.s~
0
637
Member Avatar for Mr.BunyRabit

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 …

Member Avatar for DavidKroukamp
0
195
Member Avatar for sha11e

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 …

Member Avatar for ~s.o.s~
0
146
Member Avatar for xzero1

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?

Member Avatar for xzero1
0
543
Member Avatar for nilay84

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

Member Avatar for DavidKroukamp
0
3K
Member Avatar for skoon

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 …

Member Avatar for NormR1
0
292
Member Avatar for igotaquestion

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.

Member Avatar for DavidKroukamp
0
1K
Member Avatar for jhamill

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

Member Avatar for DavidKroukamp
0
450
Member Avatar for themmings

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 …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Twistar

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 …

Member Avatar for JamesCherrill
0
774
Member Avatar for scheppy

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]

Member Avatar for scheppy
0
306
Member Avatar for 47pirates

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 …

Member Avatar for JamesCherrill
0
191
Member Avatar for Kaderith

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.

Member Avatar for sreearun
0
3K
Member Avatar for suraj_p

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)

Member Avatar for Philippe.Lahaie
0
524
Member Avatar for nijinjose123

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.

Member Avatar for peter_budo
0
127
Member Avatar for clerisy
Member Avatar for scheppy

[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 …

Member Avatar for scheppy
0
278
Member Avatar for Jigs28
Member Avatar for Jigs28
0
124
Member Avatar for riahc3

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 …

Member Avatar for riahc3
0
1K
Member Avatar for creative_m

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.

Member Avatar for creative_m
0
472
Member Avatar for imsinu

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 { …

Member Avatar for JamesCherrill
0
4K
Member Avatar for sam1

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.

Member Avatar for peter_budo
0
163
Member Avatar for 47pirates

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.

Member Avatar for 47pirates
0
143
Member Avatar for mhd_arif123

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.

Member Avatar for JamesCherrill
0
215
Member Avatar for scheppy

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 …

Member Avatar for scheppy
0
372
Member Avatar for sagy26.1991

mybox.volume attempts to find a variable called volume in the Box class. You have no such variable (but you do have a method!).

Member Avatar for sagy26.1991
0
1K
Member Avatar for cadamsjr

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 …

Member Avatar for cadamsjr
0
192
Member Avatar for lordsurya08

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 …

Member Avatar for JamesCherrill
0
359
Member Avatar for stay_alive

The Robot class has a method to click anywhere on the screen. Finding the coordinates of the browser's button may be harder...

Member Avatar for peter_budo
0
2K
Member Avatar for dennysimon

[url]http://docs.oracle.com/javase/1.3/docs/tooldocs/win32/javac.html[/url]

Member Avatar for dmanw100
0
115
Member Avatar for gourav1

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.

Member Avatar for stultuske
0
375
Member Avatar for asif49

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"); …

Member Avatar for asif49
0
217

The End.