Margin « JPanel « Java Swing Q&A





1. How do I get hold of the margins of the Paper when using java printing?    stackoverflow.com

I'm trying to print a JPanel with some painted graphics on it (overriding paintComponent). The graphics is so big that they wont fit on a single page and therefor I'm letting ...

2. 0 top margin on JPanel    stackoverflow.com

Is there any way to add 0 margin/padding to a JPanel so it fits the WHOLE screen it's suppose? Here is what I am talking about: (see the little space above the ...

3. setting horizontal and verical margins    stackoverflow.com

What is the method to set horizontal and vertical margins in a panel? (The same we have in html style="margins:30px")

4. Adjust border margins/size for JPanel    coderanch.com

Hi Alex, Yes you are correct. The titledBorder adds an insets value of 2 to the normal border on the non title edges. You could place your panels into a GridBagLayout and set the insets to 2 to the untitled panel. The code below shows a simple example. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; public class BorderPanels extends JFrame ...

5. Unable to draw shapes beyond the margins of a JPanel    coderanch.com

In our MSc class we had an exercise to draw a ball (g.drawOval()) which flies around inside a container and bounces off whenever it hits the margins of the container. So I did it. My ball bounced off the right-side and bottom of the container, going approx half its width beyond the margin of the container, then bouncing back. Since I ...