Hello,

I have a JPanel (inside of a JFrame). I have a picture(.jpg), a JTextArea (with scroller) and a JTextField. On the JPanel, I want the picture left justified , the JTextArea right justified and the JTextField just below the JTextArea. What kind of layout would be appropriate?

Thank you!
sciprog1

GridBagLayout would be best.

Use a JLabel to display the picture.

Hello Ezzaral,

Thank you for the reply!

The program will be continually redrawing the picture depending on user input. If I use a JLabel to display the picture, can the redrawing be done?

Thank you!
sciprog1

You mentioned that it was a jpg. Will it be loading other jpg files based on input or actually altering the image in real time?

If you're loading from files, then JLabel is probably still an easy solution. If you're altering an in memory image and displaying it with Graphics.draw() then you could use any custom component (extend JPanel, JLabel, or JComponent) with an overridden paintComponent() method.

Hello Ezzaral,

Thank you! I plan on overriding the paintComponent() method. If I have any issues with doing that, I hope you don't mind if I ask you specific questions about it?

Thank you!
sciprog1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.