7,116 Posted Topics

Member Avatar for Dmiller071

newMaze contains a copy of a reference (pointer) to the maze array in the instance of Maze, so yo can just use that as in [ICODE]newMaze[i][j][/ICODE] which will reference exactly the same memory location as the original [ICODE]maze[i][j][/ICODE]

Member Avatar for Dmiller071
0
293
Member Avatar for sha11e

Encryption: there's no reason to go further than the API classes that are included with every Java installation. [url]http://download.oracle.com/javase/6/docs/technotes/guides/security/[/url]

Member Avatar for ~s.o.s~
0
107
Member Avatar for greenq

Line 45 you are relying on good luck with your >1. The JavaDoc says [QUOTE]Returns: a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this String, ignoring case considerations.[/QUOTE] The actual source code shows that it returns either the …

Member Avatar for Taywin
0
2K
Member Avatar for sanzhar
Member Avatar for jackmaverick1

You can specify a full path from the root (eg c:) to the file, check out the API doc for File. You can also get useful directories like the user's home dir or a temp directory from System.getProperty, eg System.getProperty("user.home") and use that to locate a file.

Member Avatar for JamesCherrill
0
106
Member Avatar for TigerTeck

Your use of && looks OK to me. That isn't the neatest/shortest way to code it, but as far as I can see it should work as you intended, apart from some marginal cases where the ranges don't quite meet up, eg 3.05, which isn't a B+ or a B …

Member Avatar for TigerTeck
0
145
Member Avatar for StephNicolaou

If you have the image, and are drawing it in a paintComponent method, then you can cast the Graphics g parameter to Graphics2D and use its [I]rotate [/I]method. (which is an easier cover method for a rotational AffineTransform)

Member Avatar for mKorbel
1
4K
Member Avatar for danthevan

Java only makes sense if you are thinking in an object-oriented way, which VB gives you no preparation for. In VB you just write code and it does what you expect, and the reward is instant. In Java you spend much more time thinking about the object structure and the …

Member Avatar for JamesCherrill
0
206
Member Avatar for sk8ergirl

[QUOTE]question 1: what do you mean by, find mode?[/QUOTE] In statistics, the mode is the value that occurs most frequently in a data set or a probability distribution. If the distribution is a nice curve that's low at both ends and highest in the middle (like most are) it's the …

Member Avatar for sk8ergirl
0
344
Member Avatar for siddiqui_1985

What do you men by "find a vowel"? Maybe you can give a sample input and output to illustrate what you mean? In you existing code the array vowel is a complete mystery - you fill it full of vowels, but then you just use its last element to hold …

Member Avatar for stultuske
0
717
Member Avatar for ckwolfe

On line 3 you update a variable gameBoardGUI to refer to the new char[][], but that won't change any Swing components. It seems you are missing a line or two of code here to update some Swing component with that new data.

Member Avatar for mKorbel
0
7K
Member Avatar for greatcornholio

I'm sure there are many of us here who would like to help you, but its really hard to debug 900 lines of completely uncommented code with variable and method names in a language that few of us speak. Unless you can create a smaller simpler version that displays the …

Member Avatar for mKorbel
0
242
Member Avatar for StephNicolaou

I assume you are drawing the grid in an overridden paintComponent? After moving the label you should just call repaint() to let Swing know that the container's paintComponent needs to be called a.s.a.p.

Member Avatar for StephNicolaou
0
154
Member Avatar for Lendaanx

You can start by adding those buttons to the elseifs in you actionPerformed method - have them just call methods add(), save() etc, then write those methods, one at a time, testing each small step with lots of print statements as you go.

Member Avatar for JamesCherrill
0
158
Member Avatar for overrated

You are correctly getting a wins value from your game instance [ICODE]10 int wins = game.getWins();[/ICODE] BUT you do that before starting the game, and you never update it, so it remains zero. If you just move that line to somewhere after the game is finished that should give you …

Member Avatar for JamesCherrill
0
120
Member Avatar for pikalife

.. or simply [CODE]double d = .... while (condition) { d = d/2; }[/CODE] ps. Watch out for capitalisation. It's while, not While, and we always give variables names that begin with a lower case letter.

Member Avatar for JamesCherrill
0
162
Member Avatar for StephNicolaou

somewhere in the [I]... and so on[/I] it gives details of the lines in your program that it was executing when it overflowed. This is essential info. Anyway, it looks like it's in the middle of creating a window, so your loop is probably in the creation of the new …

Member Avatar for JamesCherrill
0
207
Member Avatar for ttamilvanan81

DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" [url]http://www.daniweb.com/forums/faq.php?faq=daniweb_policies[/url] Post your question in a new thread of your own, but also remember this: DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if …

Member Avatar for stultuske
0
539
Member Avatar for hannah shrn j

Your { and } are not matched up. Somewhere you have an extra } that closes the definition of a class, so the following line cannot be compiled. It will help if you indent your code properly.

Member Avatar for JeffGrigg
-1
262
Member Avatar for rotten69

The secret of understanding this is to remember that list1, list2, list, and result are [I]references [/I](llike pointers) to an Object of type ArrayList<String>. The only way an actual ArrayList<String> object can be created is with the [I]new [/I]keyword (line 3). If you follow the code 1 step at a …

Member Avatar for JamesCherrill
0
193
Member Avatar for vidhya33

Create a Socket connection between two programs running on different machines on the LAN. Send a lot of data (megabytes) from one to the other and record how long it takes. You'll find all the info you need on Java Sockets by searching the web. Come back here if you …

Member Avatar for JamesCherrill
0
98
Member Avatar for StephNicolaou

Can we please see more of the code - those two lines don't show enough to create or diagnose a problem. Ideally, post a small runnable program that demonstrates your problem.

Member Avatar for StephNicolaou
0
78
Member Avatar for looklikeasfine

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 coding your homework for you. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting …

Member Avatar for stultuske
0
115
Member Avatar for jwala

UDP is a connectionless protocol. What exactly do you mean by "disconnect the client" when there is no connection? ps Are you thinking of the connect method in DatagramSocket? - that just simplifies the syntax for sending messages by pre-determining the addresses. From the server end you can ignore that. …

Member Avatar for jwala
0
269
Member Avatar for woodmaj

You can define a tautology as a logical expression whose value is true for all possible combinations of input values. Since this exercise is limited to three input symbols you can construct a complete truth table - it only has 8 rows. So maybe the approach is to parse the …

Member Avatar for JamesCherrill
0
537
Member Avatar for sarathsshanker

No, it's not valid. The method currenttemp() must either have a body in {} or be declared abstract, in which case the class must also be declared abstract. Without the () currenttemp becomes a float variable, not a method, and the code is valid. We can only guess what the …

Member Avatar for JamesCherrill
0
108
Member Avatar for pikalife

It's not so much that it "violates encapsulation laws", it's more that it creates design problems and bugs that are really hard to fix. Declaring a constant as public is safe, but declaring a variable public means that anyone, anywhere, executing in any thread, may change its value at any …

Member Avatar for stevanity
0
131
Member Avatar for rajeshredy

Looks like you are trying to add new versions of your components over the top of the previous versions? If so, it would be safer to to remove the previous ones explicitly, or to re-use them

Member Avatar for JamesCherrill
0
77
Member Avatar for corliss

This is a standard problem with a standard solution: Change the NewJFrame constructor to take an instance of Watcher as a parameter and store it. So your main now looks like [CODE]Watcher beholder = new Watcher(); NewJFrame GUI = new NewJFrame(beholder); // pass Watcher instance to GUI[/CODE] now in NewJFrame …

Member Avatar for StephNicolaou
0
169
Member Avatar for powerdink

That's almost certainly a good idea. The code for GUIs with lots of controls like this gets out of hand very quickly; it's very long, horrible to debug, and incomprehensible for anyone else. Splitting it into separate classes for each panel helps enormously. One hint: Keep a class for the …

Member Avatar for JamesCherrill
0
194
Member Avatar for moonL!ght

I doubt it very much. Why don't you want to use the one class that was designed for exactly that kind of thing? ps: If you want to look for sample code etc on Google, the normal spelling is "pie chart" You will also find packages and products for drawing …

Member Avatar for hfx642
0
185
Member Avatar for Labdabeta

Not possible using "ordinary" Java, but possible using the "reflection" classes - have a look at the class [ICODE]java.lang.reflect.Method[/ICODE] to get a quick flavour of what its all about. I can give you a lot more info on reflection if this looks like a direction you wan to go in.

Member Avatar for JamesCherrill
0
362
Member Avatar for Labdabeta

Taywin's right - the Math trig functions work in radians, not degrees (2*Pi radians = 360 degrees). Also I think zero angle is pure "East" (is along the x axis), not North.

Member Avatar for Labdabeta
0
413
Member Avatar for anand01

[QUOTE=anand01;1677614]1)Is Method Overloading considered as polymorphism? 2)Is there two types of polymorphism(run time and compile time ) available?[/QUOTE] 1. According to Oracle's web site - yes. 2. Given that Q1 answer is yes, then yes. Overridden methods are resolved at run time based on the target's run-time type. Overloaded methods …

Member Avatar for anand01
0
178
Member Avatar for gahhon

I'm a bit baffled by the number of arrays in this program. I would expect to see the collection class containing just one array of films, not two, and I would not expect to see any other class having any arrays of films or arrays of collections at all. With …

Member Avatar for gahhon
0
351
Member Avatar for caswimmer2011

The list of VK_... key codes can be found in the JavaDoc for KeyEvent. eg the control key is VK_CONTROL. I don't know about how the Mac Command key is coded, maybe its its the same as VK_WINDOWS? (easy to try!), but you could write a very small program with …

Member Avatar for caswimmer2011
0
210
Member Avatar for glamourhits

A queue is almost identical to a stack. The only difference is the stacks are LIFO (last in, first out), but queues are FIFO (first in, first out)

Member Avatar for Taywin
0
589
Member Avatar for quartaela

A simple solution may be to create a blank icon of exactly the same size, and just switch the icons when you want to show/hide the real one.

Member Avatar for mKorbel
0
292
Member Avatar for nasimalotaibi
Member Avatar for nasimalotaibi
0
151
Member Avatar for Goyle

Having a variable called "count" is confusing - is it left over from a previous exercise? To find the largest you need a variable called "largest" which is initialised to a small value. Then as you process each input you ask "is this bigger than largest" and if so, save …

Member Avatar for Goyle
0
189
Member Avatar for mrjillberth

This program demonstrates one of the almost-acceptable uses of labels in Java - that is to label a loop then use that label in a break statement to make explicit the loop that is being broken out of. It can even be useful where you have nested loops and want …

Member Avatar for JamesCherrill
0
157
Member Avatar for rajeshredy

listItemListener implements ItemListener, so that code is perfectly valid and normal.

Member Avatar for JamesCherrill
0
484
Member Avatar for Lendaanx

First looks OK to me - what is it doing that's wrong? Last sets position to -1, that's not valid. Shouldn't it be productArray.length - 1? Previous is testing for position at the end of the array (it's a copy of the logic for next), shouldn't this be testing for …

Member Avatar for hiddepolen
0
183
Member Avatar for xiangzhuang

Your problem is that although you know that one of those if tests must be true, the compiler isn't quite that smart, so it worries about the case where all 3 if tests are false and execution drops out of the last elseif. In that case it gets to the …

Member Avatar for JamesCherrill
0
292
Member Avatar for soham.m17

You can add labels to a null layout - you need to call setBounds to specify both the position and size, and request a repaint afterwards. For ultimate control over layouts while retaining all the advantages of a layout manager use GridBagLayout. The learning curve is a bit steep, but …

Member Avatar for JamesCherrill
0
122
Member Avatar for jklasd

Line 3 you create new log, then ask that to getUser, so of course its empty. Instead of a new log class, B needs a reference to the real log instance that you created and interacted with. How that happens depends on the code where log and B are created, …

Member Avatar for Anyday
0
3K
Member Avatar for Dwillich87

You never call your circleInfo method, so it doesn't get executed, so there's no user input.

Member Avatar for Akill10
0
138
Member Avatar for Syrne

Yes, just add them one at a time and forget the second array. You already have code to find an element and flag/unflag it - so what's the problem you are asking in bold above?

Member Avatar for Syrne
0
229
Member Avatar for gahhon

What's the question about the speed var? What you are doing now is good. Also your default value is good. No problemo. ps: Those 3 speeds should ideally be an enum. If you have not covered enums in your course then ignore this comment!

Member Avatar for gahhon
0
228
Member Avatar for soham.m17

Yes, you can use your image to make an [I]ImageIcon [/I]and put that in your JLabel. Documentation is in the usual places.

Member Avatar for soham.m17
0
105

The End.