I would like to have the JList and JTextArea resize with the window, but the JPanel stays in the center.
http://pastebin.com/VaaTRsuf I would like to have the JList and JTextArea resize with the window,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your LogView class extends JPanel and thus unless you change it, it uses JPanel’s default layout, FlowLayout. Components held in a FlowLayout-using container do not change size when the container changes size, and so if you want this behavior, you don’t need a component Listener — you just need to change the layout manager for the LogView JPanel to BorderLayout or something similar that allows its held component to expand, that’s it. One line of code:
Another option is to get rid of mainPanel as it doesn’t appear to be necessary at all, to set the layout of your LogView object to be GridBagLayout and to add your components directly to the LogView object.