7,116 Posted Topics

Member Avatar for Tierra

Maybe the code isn't of the highest professional standard, but honestly it's not particularly messy either. Good enough for an early-stage learner. So what EXACTLY do you need help with?

Member Avatar for Tierra
0
300
Member Avatar for Violet_82

The AIC approach gives you a separate handler for each event, which is typically what you want. You use a "normal" inner class when you want to pass parameters into the handler when setting it up - that's something you do when you create dynamiclally changing layouts for example. Using …

Member Avatar for Violet_82
0
361
Member Avatar for Bartosz

You are having problems because you are using an OO language as if it was purely procedural. The big clues are all those static members and classes whose names are verbs not nouns. If you make a ClientRequest class to encapsulate a client request, and RequestGUI class to encapsulate an …

Member Avatar for Bartosz
0
2K
Member Avatar for SpottyBlue
Member Avatar for jwenting
0
246
Member Avatar for Violet_82

Yes, you can put components directly into a JFrame (well, actually there are some panels that are part of every JFrame, and one of those is where your components are placed, but that's hidden from you so you don't need to worry about it unless you have some special requirement. …

Member Avatar for Violet_82
0
304
Member Avatar for jemdev03

It would help if you gave some better info than "it wont let me". If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the …

Member Avatar for jemdev03
0
295
Member Avatar for prakash2813

Create a Memento before each time you add or remove. Use the latest Memento to roll back the latest change. The WikiPedia article on memento design pattern has an example in Java.

Member Avatar for JamesCherrill
0
332
Member Avatar for nadiam

When you have the month number as a String you can convert that to an Integer using the `Integer.parseInt `method (see API doc for details). Then you can use that Integer as an index to get the correct element from you month name array. There is a `SimpleDateFormat` class that …

Member Avatar for JamesCherrill
0
137
Member Avatar for Doogledude123

Why? Canvas is an old AWT component that you would use in an old AWT Frame. Forget it, and use a JPanel.

Member Avatar for JamesCherrill
0
479
Member Avatar for Leonard_3

Before going any further I urge you to look at David W's post again ... creating a full deck, shuffling it, and taking cards from it. His approach is going to work for dealing one hand, n hands, discard piles, hidden and face-up hands... Any card game, and scales trivially …

Member Avatar for tinstaafl
0
3K
Member Avatar for Vinolia

That's a good question. All the definitions of mediant that I found in a quick google had no use or meaning for such a parameter. Are you sure that method signature is right? Is there any supporting documentation?

Member Avatar for Vinolia
0
255
Member Avatar for new_developer

I'm not c++ buff, but it looks to me like you have set the precision for printing numbers, but that has no effect on the numbers themselves. fx could still be 0.000001, you are just printing it to 4 decimal places

Member Avatar for rubberman
0
12K
Member Avatar for divinity02

1: You get an exception (null pointer, zero divide etc) or the program behaves in a way didnlt expect (wrong output etc) 2: Trace the execution one step at a time, using a debugger or lots of print statements until you find where its going wrong 3: Design top-down - …

Member Avatar for ddanbe
0
240
Member Avatar for katie6580

Tag this with `Java` so it shows up in the best place to get an answer. That looks like a decent piece of code - what do you want it yo do that it doesn't do now?

Member Avatar for JamesCherrill
0
412
Member Avatar for Doogledude123

Make the superclass default constructor private and provide a public constructor that takes a parameter ?

Member Avatar for JamesCherrill
0
329
Member Avatar for Violet_82

Every class in Java has a toString method. It's defined in the Object class so everyone inherits it if they don't override it. It returns the name of the class followed by the instance's hash (that's the garbage you referred to). You are right, print always calls the toString method …

Member Avatar for jwenting
0
3K
Member Avatar for Cory_1

Looking at the print method, where the error is generated, I see 2*i+1 etc in a loop where I goes up to the list size, so the out of bounds is inevitable

Member Avatar for Taywin
0
244
Member Avatar for 76342ck

I looked at your code on GitHub. Seems pretty complete. Nothing nasty sprang to my notice. What exactly is your question?

Member Avatar for JamesCherrill
-1
2K
Member Avatar for laguardian

That's not exactly what I would think of as MVC either. But it does look like good architecture, regardless of what you call it.

Member Avatar for JamesCherrill
0
191
Member Avatar for Cory_1

How about replacing all those difficult characters with blanks befor splitting the sentence?

Member Avatar for JamesCherrill
0
597
Member Avatar for katie6580

This appears to be a continuation of Katie's previous thread that was missing the `Java` tag https://www.daniweb.com/programming/computer-science/threads/500517/crossing-english-words-in-java the new `crossesAt` method just duplicates the single line at 19 for some reason the new `printCross` method seems inspired by a suggestion I posted while ignoring the content of my suggestion

Member Avatar for JamesCherrill
0
163
Member Avatar for SirMahlon

Are you saying that you want the database retrieval to be three records at a time, rather than getting them all them you processing them 3 at a a time? Why? Do you have shares in a server hardware company?

Member Avatar for SirMahlon
0
218
Member Avatar for JoseL7

You probably want to print the average, and amy other results you calculate. You can put all that inside a `while` loop so it will keep repeating the input and calculations until thr user types false.

Member Avatar for jwenting
0
253
Member Avatar for compuser

Please post the compiler error messages (including the line numbers). There's no way you have reached a limit on the number of nested if's etc, so it's not that.

Member Avatar for happygeek
0
820
Member Avatar for LibraryCode

Just use ` setEnabled(true); ` or `setEnabled(false);` for your buttons in the appropriate listeners

Member Avatar for JamesCherrill
1
758
Member Avatar for scheppy

new ImageIcon(...) is famous for not throwing any exceptions when it fails to find the file; it just returns null. JLabel is happy to accept null for its image icon, so the final result is no image and no error messages. We see that quite often in DaniWeb "help!" posts. …

Member Avatar for JamesCherrill
0
4K
Member Avatar for alaad

If you get that information from the user then you have to store that in a configuration file (or equivalent) somewhere so you can find it next time the program is run. So your startup code can look something like: p s v main(etc) { get config file if file …

Member Avatar for alaad
0
319
Member Avatar for EarhawkPH

I noticed lines 487/488 yourMoney=Integer.parseInt(jTextField1.getText()); yourMoney=hold; // overwrites the value you just set in the previous line

Member Avatar for JamesCherrill
0
436
Member Avatar for shayan_doust

The common factor on those two lines is the `contacts` variable You declare it on line 23, but you never initailse it, so it's null. And before you refer me to line 153... that creates and initialises a second variable, also called contacts, that is local to the main method, …

Member Avatar for Traevel
0
491
Member Avatar for samuelmathews

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 …

Member Avatar for jwenting
-4
213
Member Avatar for James_43

Could it be because you are closing the window while the transition animation is still in progress? Maybe try stopping the animations before closing the window?

Member Avatar for James_43
0
1K
Member Avatar for shayan_doust

You have written the array of data to a text file, so loading it is a question of Reading each line from the text file (see any tutorial for reading lines from a text file) Splitting that line into fields using the tabs as separators (see String's `split` method) Storing …

Member Avatar for JamesCherrill
0
563
Member Avatar for Doogledude123

Have you checked owner.getAppWidth/Height? Maybe those values have not yet been initialised when the panel is painted for the very first time?

Member Avatar for JamesCherrill
0
427
Member Avatar for divinity02

Starting at the beginning... line 2 starts a loop using the value of various count variables, but these are never changed in the loop. So either it will execute zero times, or it will loop forever. Similarly the next loop (line 25), except because it has an unconditional break in …

Member Avatar for JamesCherrill
0
277
Member Avatar for Muwanguzi
Re: java

Hi Muwanguzi Lynda 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 (which you agreed to when you signed up) include: …

Member Avatar for JamesCherrill
0
130
Member Avatar for JordanAMAN

the problem is with the variable you call "total". Your loop sets total to 15/15 then 15/14, then 5/13 etc - which in integer arithmetic keeps giving you 1's I don't undersatnd what that variable is for anyway. In pseudo-code all you need is for possible = 2 to (number-1) …

Member Avatar for Taywin
0
261
Member Avatar for RikTelner

So much in life depends on luck, but you can make yourself sa lucky person by: 1. Giving yourself chances to be lucky - eg it's wondeful luck to meet the person who will be your soul-mate. But you won't have much luck if you stay at home. So meet …

Member Avatar for diafol
0
431
Member Avatar for adu benjamin

It's often a much higher level description of a process or algorithm, eg rubberman's example could be Do <stuff> for each whole number between 1 and 10 In general you can take pseudo-code and turn it into a program in a language of your choice - the pseudo code will …

Member Avatar for JamesCherrill
0
167
Member Avatar for JordanAMAN

You have 3 while loops using columncounter, and in each case you forgot to initialise/reinitialise columncounter before entering the loop(s).

Member Avatar for JamesCherrill
0
965
Member Avatar for Aditya0025

That question doesn't seem to make any sense. Pleae explain exactly what you want to do.

Member Avatar for jwenting
-1
145
Member Avatar for laguardian

It's impossible to give a definitive answer without complete info, but at first sight my gut feel is: Customer and CustomerEnquiry are clearly different things, witha clear "has-a" relationship. There's no doubt that you would model these as different classes. Maybe there would be technical reasons to combine them at …

Member Avatar for JamesCherrill
0
232
Member Avatar for GOMEZ_1
Re: Java

There's no definitive "best" when the question is so wide open. Do you mean develop your own compression code, or use existing compression libraries as part of your own app? Do you have a particular OS platform or platforms in mind?

Member Avatar for JamesCherrill
0
218
Member Avatar for Aditya0025

LInes 46,47 The only place you can draw to the Graphics is inside the `paint` method (or `paintComponent`, which would be better). Swing is double-buffered and anything you draw in other methods is most likely never going to de used. f.getContentPane().add(ok); you haven't needed to do this for about 10 …

Member Avatar for Aditya0025
0
450
Member Avatar for kunal135

If you search DaniWeb for Java Chat you will find lots of discussions abou this topic, including the kinds of problems people encounter and how they can be solved. But the one thing you are certain to need is a multi-threaded server using Sockets. This tutorial is excellent... http://www.oracle.com/technetwork/java/socket-140484.html

Member Avatar for stultuske
0
204
Member Avatar for Elliander_1

You say you have a "Non-Static Method Cannot be referenced from static context.", but you forgot to tell us which line that was referring to. But then you say you have incorrect output - which is impossible if you have the "Non-Static Method Cannot be referenced from static context." because …

Member Avatar for Elliander_1
0
626
Member Avatar for Ghost0s

Although algorithms in general are used outside programming (eg in maths), in this context an algorithm is a way of solving a programming problem. If you don't have some knowledge of programming then the algorithms will make little or no sense to you. I'm 100% voting for learning at least …

Member Avatar for vegaseat
0
311
Member Avatar for zachattack05

Agree Coding `<some boolean expression> == true` is a novice mistake. However the name of the method should include a verb and clearly express some assertion with obvious meanings for true/false, eg ItemExists, IsValid, HasMore, MeetsEPARegulations, WasAchievedByCheating etc

Member Avatar for JOSheaIV
0
573
Member Avatar for Sahrish_1

Are you sure you mean RAM and not hard disk? Windows 8 occupies that much disk storage, but will run in a far smaller amount of RAM. Any machine that really has 20 gig of RAM should be able to run MySQL with ease.

Member Avatar for JamesCherrill
0
210
Member Avatar for James_43

That is ok for a simple case. If you have multiple windows that may be called in various sequences, and complex data to be shared, then the standard approach is to create a new class that holds all the data and make that class available to all windows.

Member Avatar for ddanbe
0
287
Member Avatar for Tierra

Maybe your teacher didn't explain it because (s)he probably wanted you to go through the process of working it out for yourself. Give it your best shot before askiing for more help here.

Member Avatar for JamesCherrill
0
208

The End.