Top "Jpanel" questions

JPanel is a container in the Java Swing Framework that allows custom rendering using layout managers.

Java add a Dashed or dotted border to a JPanel

I am having problems with this thing: can I, in some way, add a dashed (or dotted, no matter) border …

java jpanel border dotted-line
Repainting a JPanel in a JScrollPane

The project that I am working on is an inter-computer utility for playing table top games, and a key part …

java swing jpanel jscrollpane paintcomponent
Can't a Swing component be added to multiple containers?

I'm trying (testing something else) to add one JButton reference into two JPanels to test it, and it disappears from …

java swing jpanel jbutton jcomponent
Aligning JComponents to left- and right-hand sides of a JPanel

I have a JPanel that contains two JComponents, say two JButtons, btnLeft and btnRight. I want these two buttons aligned …

java swing layout jpanel jcomponent
Check whether a JPanel contains a JButton

I have added a button to a JPanel. I want to remove the button if the JPanel contains the button. …

java swing jpanel jbutton jcomponent
JFrame getHeight() and getWidth() return 0

I'm making a simple pong game; and part of the collision mechanics require getting the width and height of the …

java swing jpanel paint thread-sleep
IntelliJ gui creator: JPanel gives runtime null pointer exception upon adding any component

I am having a problem with IntelliJ's java gui creation. Most of the code behind the panel is unfortunately hidden …

java swing intellij-idea jpanel
Replacing JPanel with JPanel in a JFrame

I have a class that extends JFrame, and it has a BorderLayout. It has two private instance variables of type …

java swing jpanel add
drawing a line in Java - line is not visible

I am learning Java on my own. Trying to create a frame with a line in it. It seemed pretty …

java swing jpanel paintcomponent graphics2d