Computer Science Canada Customizing Layouts of JComponents |
Author: | Krocker [ Fri Feb 14, 2014 2:35 pm ] | ||
Post subject: | Customizing Layouts of JComponents | ||
Hi, so im trying to create a gui that looks like this the image attached. I made the buttons, and the gui itself, but im hacing trouble positioning the text area and making the scroll bar. Can someone please show me how i can do this. This is what i have so far in terms of the creating the gui:
|
Author: | Krocker [ Sat Feb 15, 2014 10:38 pm ] |
Post subject: | RE:Customizing Layouts of JComponents |
Anyone? I know it might be a basic concept, but this is my 1st time using guis in java. Please someone help? |
Author: | Zren [ Sun Feb 16, 2014 2:29 pm ] | ||
Post subject: | Re: Customizing Layouts of JComponents | ||
Designing GUIs is one of the reasons I love the Netbeans IDE. It comes with a fairly awesome swing editor. I find that looking at the code it generates instils good coding practice, even though it's probably going to throw a lot of stuff at you on first glance. To solve your problem though, I made a quick GUI in the editor. I used an actual menu instead of buttons though, so you can't copy it exactly ;]. It looks like what it generated wrapped the TextArea in a ScrollPane. For the layouts, it seems to use a GroupLayout. In order to get the title + boder thing it's got going on, you need to put the ScrollPane inside a Panel. Then set the border of the Panel to something like BorderFactory.createTitledBorder("Blarg"). What this code looks like: ![]()
|