Jbuttons won't organize in a grid layout until i click on another window?

I am making a chess game and I'm somewhat new at java so forgive me if this ends up being a result of my own stupidi...

How to draw a line on a existing jPanel in Swing (Java)??

I want to draw a simple line on my existing jPanel called mypanel. I want to do it like this: mypanel.drawLine(...

Negative coordinates of JPanels (and lack of cooperation with Timer)?

Please note that this is a more theoretical question about problems with this approach, as I'm trying to understand ...

How to call a function when I click on a jPanel (Java)??

I'm working with Netbeans IDE in Java. I've a form with one JPanel. Each JPanel has a gridLayout 3x3 and in each pl...

JPane inside JFrame?

I'm trying to make simple app in Java but I have problem with inserting JPane (pasy) inside JFrame(frame). For now m...

How do i draw a triangle in java??

Ok so first of all i know how to draw a rectangle and circles and ect with g.drawRect or g.drawOval but there is no ...

Adding JPanel to JFrame?

I have a program in which a JPanel is added to a JFrame: public class Test{ Test2 test = new Test2(); JFra...

How does addNotify() and requestFocus() work in Java with JPanel??

I have not got a clear idea how does super.addNotify() and requestFocus() methods of JPanel work in general and with...

How do i draw a triangle in java??

Ok so first of all i know how to draw a rectangle and circles and ect with g.drawRect or g.drawOval but there is no ...

How to repaint a JPanel after have drawn on it??

I have a component that inherits from JPanel, I draw a grid on it. Now I have a JComboBox and I want the user to be ...

Java: Difference between the setPreferredSize() and setSize() methods in components?

What is the main difference between setSize() and setPreferredSize(). Sometimes I used setSize(), sometimes setPrefe...

How do I draw an image to a JPanel or JFrame??

How do I draw an Image to a JPanel or JFrame, I have already read oracle's tutorial on this but I can't seem to get ...

How to draw a circle with given X and Y coordinates as the middle spot of the circle??

I have developed a telecommunication application for locating signal strengths from the towers. I have used java swi...