Results 1 to 4 of 4
- 12-19-2010, 04:54 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 45
- Rep Power
- 0
How do you set insets on a panel?
I have a very simple program using Swing. It creates a JFrame, and within that frame I create a panel using BorderLayout. The panel contains a ComboBox and a Label that changes depending on the selected item in the combo box. I was wondering, can I create insets for the panel without using a grid bag layout and setting constraints? Thank you for taking the time to read this and for any help you can give me!
-Derek Raimann
-
You can set the JPanel's border via the setBorder method and use an EmptyBorder with appropriate parameters.
e.g.,
Java Code:myPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
- 12-19-2010, 08:50 AM #3
Member
- Join Date
- Dec 2010
- Posts
- 45
- Rep Power
- 0
You hit the nail on the head, thank you so much! :)
-
Similar Threads
-
Add panel to parent panel
By LovJava in forum AWT / SwingReplies: 10Last Post: 09-02-2010, 08:43 PM -
Panel in a panel?
By pahiker in forum AWT / SwingReplies: 1Last Post: 07-05-2010, 11:42 AM -
Adding a panel to a panel
By rclausing in forum New To JavaReplies: 7Last Post: 02-02-2010, 05:56 AM -
weird insets change in JFrame subclass
By sowilo in forum AWT / SwingReplies: 4Last Post: 11-18-2009, 12:27 AM -
[SOLVED] How to set insets for JComboBox.......?
By prabhurangan in forum AWT / SwingReplies: 3Last Post: 07-01-2008, 06:25 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks