I have written a simple program. I use a JSplitPane
in center of JFrame
and I want to show two picture in it's two sides so I use two JLabel
components and I put them in a JPanel
. but divder does not move when I run the code.
public class A extends JFrame
{
private static final long serialVersionUID = 1L;
public A() throws IOException
{
getContentPane().setLayout(new BorderLayout(0, 0));
JSplitPane splitPane = new JSplitPane();
getContentPane().add(splitPane, BorderLayout.CENTER);
JPanel left = new JPanel();
BufferedImage myPicture = ImageIO.read(new File("a.jpg"));
JLabel lblNewLabel = new JLabel(new ImageIcon(myPicture));
left.add(lblNewLabel);
splitPane.setLeftComponent(left);
JPanel right = new JPanel();
JLabel label = new JLabel(new ImageIcon(myPicture));
right.add(label);
splitPane.setRightComponent(right);
}
public static void main(String[] args) throws IOException
{
A a = new A();
a.setSize(700, 700);
a.show();
}
}