Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
I would like to know how to get rid of those annoying colour patches
why is the error appearing regardless of what is in the input
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
All things are lawful, but not all things are profitable.
Tony Docherty wrote:Well done for fixing your problems.
Some comments on the code.
That's a lot of magic numbers, why not use layout managers and avoid the need to hard code loads of numbers?
You might want to consider formatting the answer so it only displays the appropriate number of decimal places for the currency you are converting to.
You might also want to limit the input to the appropriate number of decimal places for the input currency.
BTW shouldn't the converted value automatically change when you select a different currency radio button without having to then select the input field and press Enter again.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
Knute Snortum wrote:This kind of line: is usually written like this:
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
Tony Docherty wrote:Well done for fixing your problems.
Some comments on the code.
That's a lot of magic numbers, why not use layout managers and avoid the need to hard code loads of numbers?
You might want to consider formatting the answer so it only displays the appropriate number of decimal places for the currency you are converting to.
You might also want to limit the input to the appropriate number of decimal places for the input currency.
BTW shouldn't the converted value automatically change when you select a different currency radio button without having to then select the input field and press Enter again.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
managed to fix my issues and completed the app. My issue with the patches was due to swing inability to deal with custom opacity. So I had to paint teh background with the following code first.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
When I turn my application into a runnable Jar file the icon representing my app does not appear on the desktop icon. How do I replace the default java icon with mine?
All things are lawful, but not all things are profitable.
I think Yosuf means the icon that is displayed on the desktop for his jar not the one that is displayed on his JFrame.Knute Snortum wrote:
When I turn my application into a runnable Jar file the icon representing my app does not appear on the desktop icon. How do I replace the default java icon with mine?
The answer is a little different depending on how you created your runnable jar, but basically you want to put your icon into a resource folder in the jar. In your code you should use .getClass().getResource(filename);
Tony Docherty wrote:
I think Yosef means the icon that is displayed on the desktop for his jar, not the one that is displayed on his JFrame.Knute Snortum wrote:
When I turn my application into a runnable Jar file the icon representing my app does not appear on the desktop icon. How do I replace the default java icon with mine?
The answer is a little different depending on how you created your runnable jar, but basically, you want to put your icon into a resource folder in the jar. In your code you should use .getClass().getResource(filename);
If so, this is an OS issue and not a Java one. The problem is discussed here https://coderanch.com/t/513237/java/change-icon-jar-file.
The problem is as a jar is not an executable file you can't set individual icons for individual jars. The easy approach is to create a batch file to run the jar (ie .bat or .cmd on Windows) and set the icon on that.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|