7,116 Posted Topics

Member Avatar for Choucas35

[QUOTE=Choucas35;1588213]Same problem that ? the closed thread : [B]Java 6 update 26 - incompatible![/B][/QUOTE] That post was about serialised ImageIcons. So if your file contains a serialised ImageIcon it's the same problem, if not it's a new one. J

Member Avatar for JamesCherrill
0
135
Member Avatar for AnkitKumar

Class methods cannot be overridden in Java. Calls to class methods are resolved using the declared type of the variable (not the actual type of the Object it refers to) - Foo in this case. Instance methods are overridable and are resolved using the actual Object. [url]http://stackoverflow.com/questions/5059051/java-calling-a-super-method-from-a-static-method[/url] PS - if …

Member Avatar for JamesCherrill
0
120
Member Avatar for naffan

I can't see the problem after a quick look. Put lots of print statements into your code so you can see the exact sequence of execution and variable updates that lead to the problem.

Member Avatar for JamesCherrill
0
5K
Member Avatar for JamesCherrill

Just a heads-up guys. I had JRE update 26 pushed onto client machines yesterday and it broke an important client-server app. This point release changes the serialVersionUID for ImageIcon. The app in question sends images from the server to the cients via a simple writeObject/readObject, which fails at the client …

Member Avatar for Don Corley
1
570
Member Avatar for EneilShade

Is the correct answer 142917828921? If so, you may want to compare this with the largest value an int (eg [I]int Total=0[/I]; ) can hold...

Member Avatar for JamesCherrill
0
216
Member Avatar for masterofpuppets

You may still be creating problems by trying to read binary data as if it is character. That will read 1 byte per character from the input stream, but convert to Unicode 2-byte chars to store in a char array, with results that may be unexpected for random binary input. …

Member Avatar for masterofpuppets
0
225
Member Avatar for aiwasen

Like it says at the top of the main page..., [QUOTE]to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.[/QUOTE] And posting …

Member Avatar for aiwasen
0
165
Member Avatar for Jake.20

That kinda works, text is a bit untidy, but that's all. What EXACTLY is the problem you are trying to fix?

Member Avatar for Jake.20
0
157
Member Avatar for masterjohji

It works for me too, but if your classmate (ps that's the correct English spelling) who gave it to you also wrote it then (s)he can explain it. If not then here's a good opportunity for you to hone your Java/NetBeans skills. Use the NetBeans debugger to trace the logic …

Member Avatar for peter_budo
0
158
Member Avatar for marcux

Your copy method looks OK to me too (ie should work). But note the following does not do what you seem to think it does: [QUOTE]If I just copy the entire array it works fine: [CODE] copyOfOriginal = original; return copyOfOriginal;[/CODE][/QUOTE] Array variables (original, copyOfOriginal) do not contain arrays, they …

Member Avatar for JamesCherrill
0
133
Member Avatar for TheVendor

It's exactly what the message says. An inner class cannot use the variables declared in the enclosing method unless they are declared final. If you don't need to change the value of jt just add the "final" keyword to its declaration. (It's because variables declared in the method go out …

Member Avatar for JamesCherrill
0
221
Member Avatar for Feriscool

Have you a method that creates/makes visible the Other window? If not, create one. Then call it from the ActionPerformed of the menu item.

Member Avatar for Feriscool
0
193
Member Avatar for kwins

Post your own answers and somebody may help you with the ones you get wrong.

Member Avatar for masijade
-1
206
Member Avatar for arka.sharma
Member Avatar for stultuske
0
198
Member Avatar for StormHawk

Alternatively... create an array of 26 ints and use it to count the number of 'A', 'B' ... 'Z' directly. No need to sort then.

Member Avatar for JamesCherrill
0
192
Member Avatar for damons

[QUOTE]It gave an error called cannot convert void type into string.[/QUOTE] Have a closer look at that error message - it should give you the exact line number where it happens. Then look at that line and find out which variable is null.

Member Avatar for JamesCherrill
0
176
Member Avatar for jtodd

Line 36 i<length, not i<=length Arrays are zero based, so the last element is index (length-1)

Member Avatar for JamesCherrill
0
2K
Member Avatar for spartanace

I think your solution works because getCodeBase returns the URL the applet was loaded from (ie the server), so your getImage downloads the image file from that location, thus not needing local file access or any special permissions. I believe this is the "correct" way to do it anyway, rather …

Member Avatar for NormR1
0
538
Member Avatar for PBoucher

It looks like you are updating the previous image by writing blank rectangles in various places, so you really don't want to call super.paintComponent (and absolutely not super.paintComponents) if you expect images to persist from one call to the next.

Member Avatar for PBoucher
0
364
Member Avatar for Mr. pen

To ask the user a question and wait for the answer you would not normally use a JFrame, the class JOptionPane is the normal way to do GUI dialog boxes to ask questions. Details are in the API doc in the usual places. You will find instructions for using JTable …

Member Avatar for Mr. pen
0
192
Member Avatar for ajst

Maybe something like... [CODE]SocketAddress addr = new InetSocketAddress("192.168.0.23", 10123); ... Socket socket10123 = new Socket(addr); ... public boolean ConnectToServer() { try { if (!Globals.socket10123.isConnected()) { Globals.socket10123.connect (addr); } return Globals.socket10123.isConnected(); } catch(Exception e) { e.printStackTrace(); return false; } }[/CODE] ... but you will still have to deal with the input/output …

Member Avatar for maninaction
0
211
Member Avatar for mudi12

it draw one sphere but when i enter 2nd.. it gives me error It would help if you told usexactly what the error was.

Member Avatar for mudi12
0
263
Member Avatar for masterofpuppets

Have you seen these? [url]http://download.oracle.com/javase/tutorial/deployment/applet/security.html[/url] [url]http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html[/url] JNLP lets you get around many of the unsigned jar problems by automatically seeking permission from the user

Member Avatar for masterofpuppets
0
290
Member Avatar for stevanity

The code+messages you posted earlier point definitively to multiple versions of your files, regardless of what you may believe. Java requires that public classes are defined in a .java file with the same name as the class, but there is no such requirement for non-public classes as in your code. …

Member Avatar for stevanity
0
441
Member Avatar for Nirmeen Ased

if(s!="no") You can't compare the contents of two Strings with == or != That tests for them being exactly the same Object. To test for two Strings having the same sequence of characters in them use s.equals("no") or s.equalsIgnoreCase("no").. which may be better for testing user-typed input.

Member Avatar for Nirmeen Ased
0
305
Member Avatar for masterofpuppets

ready() [QUOTE]Returns: True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block. [/QUOTE] As far as I can see that means that it will return false when you have read zero or more …

Member Avatar for masterofpuppets
0
258
Member Avatar for amalwit

Stultuske has explained this to you twice. I'll give it one more try. line 7 A b=[B]new A()[/B]; // creates a new instance of A line 2 [B]A a=[/B]new A(); // instance variable a is initialised as part of creating the new instance line 2 A a=[B]new A()[/B]; // new …

Member Avatar for JamesCherrill
0
162
Member Avatar for asterix15

[QUOTE=asterix15;1579698]If i can use public and design a program carefully(although a bit inconvenient) then can i completely avoid using private?[/QUOTE] Apart from all the good reasons stultuske gave, you should also consider that no (real-life) program is ever finished. Requirements change, increase, evolve, operating environments change. Its no enough to …

Member Avatar for stultuske
0
102
Member Avatar for arka.sharma

Do you really [I]have [/I]to do this? Pattern/shape recognition is possibly the hardest thing ever to program. If you must then you have a choice of three main strategies - look for lines/edges, count sides & corners etc OR take the shape as a solid "block", rotate/resize it to some …

Member Avatar for JamesCherrill
0
134
Member Avatar for arka.sharma

How many sets of coordinates? 1, 2, or 3 points there is always a circle that passes thru all of them (except limiting case of 3 points in a line where the "circle" is infinite radius).

Member Avatar for JamesCherrill
0
71
Member Avatar for bangor_boy

break inside a switch breaks out of the switch - ie stops any later cases being executed. So in this case is does NOT break out of the loop, just the switch.

Member Avatar for stultuske
0
180
Member Avatar for sunnynight

We don't actually do people's homework for them here. Have a try, make a start, when you get stuck come back with a specific question and someone will help.

Member Avatar for hfx642
0
199
Member Avatar for winecoding

Absolutely do NOT start with any code that has [CODE]catch (IOException IOE) { }[/CODE] If it doesn't work because of an Exception you'll never be able to debug it. At the very least replace all those with [CODE]catch (IOException e) { e.printStackTrace(); }[/CODE]

Member Avatar for hfx642
0
120
Member Avatar for warlord902

A class with exactly one instance is called a "singleton" class. It is a common pattern in Java applications. Here's a typical implementation: [url]http://www.javabeginner.com/learn-java/java-singleton-design-pattern[/url] I don't understand what you mean by "user stops the function of this package and when he starts it again then the initialization of A,B and …

Member Avatar for warlord902
0
172
Member Avatar for netci

Here's a minimal block of code that shows different arraylists added to a master arraylist [CODE] ArrayList<ArrayList<String>> masterList = new ArrayList<ArrayList<String>>(); ArrayList<String> temp = new ArrayList<String>(); temp.add("A"); temp.add("B"); masterList.add(temp); temp = new ArrayList<String>(); temp.add("C"); temp.add("D"); masterList.add(temp); System.out.println(masterList); String s = masterList.get(0).get(0); s += " etc"; masterList.get(0).set(0, s); System.out.println(masterList);[/CODE] Now how …

Member Avatar for JamesCherrill
0
202
Member Avatar for neutralfox

[url]http://www.coderanch.com/t/411356/Java-General-beginner/java/Public-IP-Address-time-limit[/url]

Member Avatar for kumarprabhug
0
6K
Member Avatar for Knoxx

[QUOTE=johnbucayan;1578183]you can use this code to make it more simple...[/QUOTE] ... unless You want Java code You want the brackets to match You expect to use a loop variable somewhere within its loop You want the test for "equal" Strings to work You know that Strings and arrays are different …

Member Avatar for JamesCherrill
0
3K
Member Avatar for vanzhyme

Eclipse has its own environment, and you can't get at the ordinary console. You can get the same capabilities using a BufferedReader with System.in [CODE] import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; ... try { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Type name: "); String name = reader.readLine(); System.out.println("Hello " + …

Member Avatar for JamesCherrill
0
439
Member Avatar for autorunman22

Standard approach (very short version): Ball class implements a single Ball, including its position, velocity etc, and has a public method to draw the ball on a Graphics that is passed as a parameter. Main class has a window where things are displayed. Creates new Balls on request, and adds …

Member Avatar for JamesCherrill
0
305
Member Avatar for thato21math
Member Avatar for stultuske
0
118
Member Avatar for sumeetdesaeee

[QUOTE=jwenting;1576499] method local variables do go out of scope unless they're declared final, in which case they're preserved between method calls.[/QUOTE] Sorry, I don't think that's quite right. final variables do go out of scope, and a new final variable is definitely assigned for each invocation of the method. The …

Member Avatar for sumeetdesaeee
0
139
Member Avatar for amalwit

A.method() is a static reference - A is a class not an instance. method() is an instance method - hence the error. Contrast that with the following valid code [CODE]class B{ void myMethod(){ A a = new A(); a.method(); } }[/CODE]

Member Avatar for amalwit
0
228
Member Avatar for stevanity

A class variable has one value which is associated with the class itself. An instance variable has zero or more values, one for each instance of the class that has been created. You can only use it by specifying which instance's value you are referring to, as in hello.call() or, …

Member Avatar for masijade
0
28K
Member Avatar for masterofpuppets

getLocalAddress "Gets the local address to which the socket is bound" (API doc). This is address of the machine where the server is running, so of course its always the same, regardless of where the client is. getRemoteSocketAddress() will give you the address where the client is, if that's what …

Member Avatar for masterofpuppets
0
1K
Member Avatar for student.09

[QUOTE=amalwit;1576072]I think this is the answer[/QUOTE] Answer to what? Did you actually test whether this meets the requirement in the original post? Do you think this is clear and well-written code (and look at AhmedGhazey's solution before you answer that)? Do you think you are helping the OP by giving …

Member Avatar for benqus
0
4K
Member Avatar for quinnifir

All swing activity (including action listeners and screen updates) is queued in a single thread called the Event Dispatch Thread. Your action listener is executed on the EDT, and everything else is held up until your method returns. Your first statement IS executed, but the screen won't be repainted until …

Member Avatar for JamesCherrill
0
136
Member Avatar for 9Nimo4

Yes there is. javax.swing.JToolTip [url]http://download.oracle.com/javase/tutorial/uiswing/components/tooltip.html[/url]

Member Avatar for JamesCherrill
0
542
Member Avatar for b0tz

(A guess) this may be a thread problem - text area not being updated until the loop is exited. Does you code above run as part of a GUI - eg in response to a button press or somesuch?

Member Avatar for b0tz
0
224
Member Avatar for ARaza110

Why not keep the port and its in/out streams open? Sounds like you are trying to re-open something, which may not be necessary?

Member Avatar for ARaza110
0
168
Member Avatar for autorunman22

In English: if x is less than zero go right one step if x is greater than 500 go left one step [I]therefore[/I] if x is between 0 and 500 [B]do nothing[/B] ... but it should continue to move in whatever its current direction is. Think about keeping track of …

Member Avatar for autorunman22
0
164

The End.