124 Posted Topics

Member Avatar for oldezwe

My suggestion: When te button is clicked: - disable the button. - Make a new thread, with a while loop in it. - Check whether the startTime - currentTime is bigger then the needed time. - If it is, enable the button. You should pass the button as a parameter …

Member Avatar for JamesCherrill
0
241
Member Avatar for Joey_Brown

My idea: make a jPanel for each card, and use an Affine Transform object to: - Reduce the width of the panel to 0 - Paint the other image - Enlarge the width of the panel to the previous width Like James said, you'll need to some some timing.

Member Avatar for hiddepolen
0
111
Member Avatar for km2011

Well, you make a for loop, just like you suggested. Loop through all the data, and add/subtract the value from a value that you return. Start making some code, if you run into problems, we can help you. We wont do your homework.

Member Avatar for hiddepolen
0
187
Member Avatar for lele07060

There is no 'printf()' in Java. This is C++ syntax. Use [CODE]System.out.println("Sum is " + sum);[/CODE] or [CODE]System.out.println(String.format("Sum is %f", sum));[/CODE] is you want to format. Also, be careful using (i-2)/i. i is an Integer, and (i-2)/i will always result in 0 if you don't explicitly tell Java to use …

Member Avatar for JamesCherrill
0
527
Member Avatar for jackmaverick1

[CODE]pbT.directory(new File("/"));[/CODE] Try: [CODE]pbT.directory(new File("/text.txt"));[/CODE]

Member Avatar for hiddepolen
0
247
Member Avatar for digan

Why would you make two classes? Just make one, and draw the entire drawing with it?

Member Avatar for hiddepolen
0
388
Member Avatar for C++newbie chick

[CODE]if (stdIDComp(stdIDInput, stdRec[j].studentID))[/CODE] As far as I can tell, you are using the variable 'j', but it has not been initialised yet. You are not in the for loop, so 'j' has no value.

Member Avatar for C++newbie chick
0
325
Member Avatar for mike2828

(You can just call on colour: new Colour(255,0,255). I think it is easier using RGB then what you are trying now.) You initialize drawLine as false. Every time the Applet redraws, and the drawLine variable is still false, the oval will paint. Everytime you do something with the applet, repaint() …

Member Avatar for mKorbel
0
146
Member Avatar for ckwolfe

With calling repaint, the GUI should call on paintComponent(Graphics g). Have you overridden that? Put a console output there to check if it is called.

Member Avatar for mKorbel
0
7K
Member Avatar for amture101
Member Avatar for kelvin924

You can do two things: - Get the user input as a string (probably the easiest). - Get the user input as an integer. When you take the string: - make substrungs - parse the integer - put the four integers in the array. When you use the integer - …

Member Avatar for hiddepolen
0
97
Member Avatar for lele07060

[CODE]double fedwithHolding = "FedTax * GrossPay";[/CODE] There and probably with the other one too: You are declaring a double (a number with decimal points). Then, you assign a Strkng to it. Double and String are two types, and you must make variables which the type that marches with the content. …

Member Avatar for hiddepolen
0
148
Member Avatar for StephNicolaou

Make sure you take the width and the height of the panel, when the panel have been initialized. In the constructor of the panel, both the width and the height are 0.

Member Avatar for StephNicolaou
0
245
Member Avatar for code 117

I think Java is a good solution on combining a program and SQL. There is a large SQL library, that is very usable for SQL queries. I would definately not say that this is a bad idea, the question would me more like 'Can I make a usable GUI, with …

Member Avatar for Slimmy
0
515
Member Avatar for ITHope
Member Avatar for anand01

1. Simple: yes! 2: Not that I know of. The methods you make are just as they are on runtime, only compiled.

Member Avatar for anand01
0
184
Member Avatar for gahhon

I think it would help to start programming classes with Capital Letters. This makes reading the code so much easier: [CODE]Film[] films = new Film[100]; static int numberFilm = 0; Film[] arrFilms = new Film[numberFilm]; //... new Film();[/CODE] instead of: [CODE]film[] films = new film[100]; static int numberFilm = 0; …

Member Avatar for gahhon
0
351
Member Avatar for caswimmer2011

Write a small program, implementing keyListener. On the key pressed method, you print out te character.

Member Avatar for caswimmer2011
0
210
Member Avatar for Joey_Brown

One question from my side: Do you want to save 1 digit after the comma, or you you want to remove the last digit of the number? Assuming you want to remove one digit: - Make a string out of the double, adding - Copy the string, but without the …

Member Avatar for Joey_Brown
0
161
Member Avatar for lovelyrockrchic

If you post all your code, we can help you with the errors. Usually, the errors have a long explanation what they are, and on what line they occur. Check that.

Member Avatar for hiddepolen
0
278
Member Avatar for cgen

I think it would help if you let the LinkedBinaryTree class implement Iterable<E>. Then, you should be able to iterate in a for loop.

Member Avatar for hiddepolen
0
490
Member Avatar for deep1

What is your question exactly? You have posted this in the java forum, not in C#, why? Please use capital letters and normal sentences, I cannot help here...

Member Avatar for hiddepolen
0
57
Member Avatar for djmonster

What exactly is wrong with the method you have in your piece of code? It searches for the string that starts with K, and has a length of 4. What output is the method generating, that is wrong?

Member Avatar for hiddepolen
0
589
Member Avatar for mrjillberth

Are you seriously using goto (or something similar using labels)? That is the worst thing you can ever do in java. I suggest the following: - Lose any labels and goto you have (I think that is solvable by using more methods than you are now) - Make more methods, …

Member Avatar for JamesCherrill
0
157
Member Avatar for rajeshredy

Please reduce the code. What methods are called when you do what? And what methods should be called when you click or select? Use a debugger and use the results to improve your code. Then, if you know all that information, you can ask here, and I'll try to help …

Member Avatar for JamesCherrill
0
484
Member Avatar for friendskhaled

Did you search on Google on Linked List? Look at the class, at the functions, and what you need to make yourself. Linked List is a great Java class, use it, like the assignment says!

Member Avatar for masijade
0
270
Member Avatar for cecsFTL

Taywin is right here. You don't want to check is a+b > c, that is valid for any triangle. You should check for a+b < c. Make sure that your isValid method includes: a+b < c, a+c < b and b+c < a. If any of them are true, you …

Member Avatar for hiddepolen
0
1K
Member Avatar for Lendaanx

I think you messed up the position variable in the button handler a bit. I changed the code to this, and it works: [CODE]public void actionPerformed(ActionEvent event) { if (event.getSource () == nextButton) { if (position < productArray.length - 1) position++; else position = 0; } else if (event.getSource () …

Member Avatar for hiddepolen
0
184
Member Avatar for xiangzhuang

I think it would be better to return null instead of "". That way, the rest of the methods can check easier if there was any 'real' return.

Member Avatar for JamesCherrill
0
292
Member Avatar for gahhon

Nice program :) The problem is the use of static. When you use static, the value of the variable is class dependent, and not object dependent. Example: [CODE]class A { A(int a) { this.a = a; } public static int a; // Note: STATIC } class B { void doSomething …

Member Avatar for gahhon
0
123
Member Avatar for Dwillich87

Does this even compile? Errors like parenthesis should fail to compile.

Member Avatar for Akill10
0
138
Member Avatar for moonL!ght

You can do anything there. It's just a method like any other method you want. You can also name it differently if you want!

Member Avatar for hiddepolen
0
209
Member Avatar for pikalife
Member Avatar for sha11e

1. The way you do it in your piece of code will work. I like FileOutputSteam better: [CODE]public class MyFirstFileWritingApp { // Main method public static void main (String args[]) { // Stream to write file FileOutputStream fout; try { // Open an output stream fout = new FileOutputStream ("myfile.txt"); …

Member Avatar for JamesCherrill
0
129
Member Avatar for Forte1292

It may seem stupid, but I learned all my Java from the internet. I used YouTube to follow tutorials, and found out the rest myself (just looking on Google). Maybe a thing to try, and see if you like it :).

Member Avatar for hiddepolen
0
93
Member Avatar for ilovejava

You can also use an ArrayList<Deck>, or an ArrayList<ArrayList<Card>>. I like arrayLists because of the easy manipulation and editing of the contents. [CODE]ArrayList<Deck> deckAL= new ArrayList<Deck>(); for (int i = 0; i < 8; i++) { deckAL.add(new Deck(...)); }[/CODE] Or: [CODE]ArrayList<ArrayList<Card>> cardAL= new ArrayList<ArrayList<Card>>(); for (int i = 0; i …

Member Avatar for JamesCherrill
0
273
Member Avatar for ilovejava

Please use normal sentences, and capital letters. Do you have Eclipse as your IDE? Even when you don't, you should debug. Make a breakpoint at the method you want to analyze, and check all your variables when the program is running at that point. Most likely some method will show …

Member Avatar for ilovejava
0
2K
Member Avatar for hhheng

The problem is in the last few lines I think. When I look at your code, you are trying to make a panel. Use a JPanel instead, if you want to use a panel. I think you don't need any panel, just add the JTextArea to your applet straight away, …

Member Avatar for hiddepolen
0
416
Member Avatar for sunn shine

Please use Capital Letters. Also don't ask anyone to do your homework. If you have any specific question, or errors you do not understand, don't hesitate to ask, I'd love to help you!

Member Avatar for sunn shine
0
124
Member Avatar for Laxman2809

A null pointer exception means you are trying to access a variable, which has not been initialized. The line number is also displayed with the error, so you know which variable the error is about. Try fixing that, and if you run into trouble, ask me.

Member Avatar for hiddepolen
0
293
Member Avatar for lwisnas

Use a do {} while (); loop. Pseudo-code: [CODE] String input; do { input = getInputFromUser(); } while (input != 'n' && input != 'y' && input != 'Y' && input != 'N'); doWhatEverYouWant(); [/CODE]

Member Avatar for hiddepolen
0
108
Member Avatar for heybunny

First point: you don't have Java at home? Then it makes no sense trying to learn programming. You got to compile, watch the errors flow, recompile, and improve. That's where you learn. My tips: download Java and Eclipse (the program you write java in), and 90% of the errors currently …

Member Avatar for ilovejava
0
2K
Member Avatar for UNDER-18 FG

[QUOTE]And it's due tomorrow too! BUMMER. Please! Please! Please! S.O.S p/s: I'm waiting patiently for a reply thread here ASAP. Thanks in advance.[/QUOTE] Please use code tags, and don't beg people for doing your homework... As you say, there are 6 errors. What do these errors say? Often there are …

Member Avatar for hiddepolen
0
384
Member Avatar for digital_signage

A class is a collection of properties, which can be initialised into any amount of objects. An object is an instance of a class, which has all the properties defined in the class. To use a class: [CODE]public class MyName { private: int myInt; float myFloat; bool myBool; public: int …

Member Avatar for hiddepolen
0
54
Member Avatar for programing

I'll answer for him: First of all, please write with normal sentences, and capital letters, like me. It makes your text a lot more humanly readable. Your constructor is right. You copy something by saying [CODE]Triangle triangle2 = triangle.copy();[/CODE] So, make a copy method, that returns a Triangle object, as …

Member Avatar for hiddepolen
0
136
Member Avatar for cse.avinash

That sentence in the book is indeed confusing. You should assume that Java will always use the type as you declare it. If you say int i = 0, Java will use an integer for that, and when you say short s = 0, Java will use a short for …

Member Avatar for JamesCherrill
0
114
Member Avatar for rezial
Re: Help

First of all: get a better title. Help is what all threads are about. Could you tell me what exactly is wrong? Does the code compile? It looks fine to me. Try to describe the things that I wrong , and I might be able to help you.

Member Avatar for hiddepolen
0
148
Member Avatar for j23

You should except any number of variables as input in your method, like this: [CODE]public static double sum(double... numbers) { double add_num; for (double d: numbers) add_num += d; return add_num; }[/CODE] [CODE]public static double average(double... numbers) { double avg_num; avg_num = sum(numbers)/ numbers.length; return avg_num; } }[/CODE] Also …

Member Avatar for hiddepolen
0
166
Member Avatar for Algorithms

Hi It looks like you have missed a few points. First of all, look at the facts. There are two inputs: the starting amount and the timespan. Ask those two numbers from the user. Also, every five days there is a growing, not every day. Add that to your function. …

Member Avatar for hiddepolen
0
942
Member Avatar for vijaykavin10

You can use those classes when you want to capture mouse clicks, mouse scrolls, drags, enterings, leaves, keyboard klicks, keyboard typing etc. Most of these classes are used with GUIs, to let the user have more interaction with the program. As far as I know, mostly games will use these …

Member Avatar for hiddepolen
0
84

The End.