Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!

Kemal Sokolovic

Bartender
+ Follow
since Jun 19, 2010
Kemal likes ...
Java Python Ruby
Novi Sad, Serbia
Cows and Likes
Cows
Total received
5
In last 30 days
0
Total given
1
Likes
Total received
119
Received in last 30 days
0
Total given
50
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kemal Sokolovic

...and added a JPanel as a variable...


No, you are using java.awt.Panel, hence you should override the paint() method.

And welcome to the Ranch!

EDIT: Well, I guess you typed it faster.
4 years ago
This can be a good place to start with. Plenty of resources over there.
5 years ago
Generally it's a logarithm of base 2, which usually means that the problem is divided in half in each step of the algorithm (divide and conquer).
5 years ago
I didn't really understand your request. Can you please post some code to demonstrate the problem? What's wrong with the approach of using JTabbedPane, if you want a "button that acts like a tab"?
5 years ago
ItDoesntWorkIsUseless (<- click), please be more specific. The general principle proposed above should do the trick. Though, I would suggest you never have more than one JFrame per application; use JDialog instead.
5 years ago
Factory method pattern is a good place to start, also with some examples and comments on them. I am sure that you can find a lot of other resources by searching the internet a bit.
5 years ago
How to Use HTML in Swing Components and How to Use Editor Panes and Text Panes would be a good place to start. These both contain examples that you can use as a reference.
5 years ago
Welcome to the Ranch!

Keep in mind that the division operator denotes integer division if both operands are integers, and floating-point division otherwise. Yours is the first case - both of your operands are integers (e.g. 1/2 = 0 by integer division), hence the results you get.
5 years ago
And I hope this link will provide enough details for you about the question.
5 years ago
Even when the img is null an exception won't be thrown.
5 years ago
The code works fine with me, I can't see a problem (besides the fact that you are using show() method which is deprecated).
5 years ago
Welcome to the Ranch!

In order to get the most out of this community you need to ShowSomeEffort and TellTheDetails. However, you cannot expect to be provided with full solution since this forum is NotACodeMill.
5 years ago
If they are all in the same package, there won't be a problem with that; otherwise you would use import statement for other classes.
Though it's a question for another topic, I would suggest you read a Java tutorial, specifically the Packages section, to get more details. I'm posting from phone now so I can't provide a link, but if you Google for it you'll find it easily.
5 years ago