JPanel with setPreferredSize and Dimension

To set the preferred size for each JPanel object, you call its setPreferredSize() method. The argument is a Dimension object that specifies the width and height. Program       Program Source import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.BorderFactory; import java.awt.Dimension; import java.awt.FlowLayout; class Frame extends JFrame { Frame() { setTitle(“setPreferredSize”); setLayout(new FlowLayout()); setJPanelOne(); … Read more…