Hack Forums
[Java] Frame layout help - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Frame layout help (/showthread.php?tid=5857692)



Frame layout help - Prock - Jul 4, 2018

Hi I'd like to create a frame with a grid panel to the right and an info panel to the left.
Currently it looks like this:
i.imgur.com/N3myyka.png

But those labels are too spread out vertically and horizontally.
I want them to be right next to eachother.
And I want the grid to take up the rest of the space.

In my Jframe I used BorderLayout.WEST for the info panel and BorderLayout.CENTER for the grid.
For my info panel I used GridLayout(4,4);
And my grid panel I used GridLayout(16,16);

But it just doesn't come together well.

Ideally, I'd want it to look like this.
i.imgur.com/q5WXViR.png (A bit of ugly picture editing)

Does anyone know how to do it?


RE: Frame layout help - Aussie - Jul 4, 2018

Perhaps show us your code surrounding the jtextfields. Use a loop and set their borders to nothing (to eliminate the padding).

Code
field.setBorder(BorderFactory.createCompoundBorder(
        field.getBorder(),
        BorderFactory.createEmptyBorder(5, 5, 5, 5)));