H
hust6
Is it possible to set the parent compenent of a JFrame to another
JFrame? Here is a sample of my code:
JScrollPane scrollPane = new JScrollPane()
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Title");
frame.getContentPane().add(scrollPane);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setSize(wid, hgt);
frame.setVisible(true);
frame.toFront();
This is how I want the frame to be, but I can't set the parent frame.
I tried adding:
JOptionPane.showMessageDialog(MyParentJFrame,frame.getContentPane());
as the last line. This set the parent component to the other JFrame,
but I lost the ability to have my message be scrollable.
Any help would be greatly appreciate.
Thanks!
JFrame? Here is a sample of my code:
JScrollPane scrollPane = new JScrollPane()
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Title");
frame.getContentPane().add(scrollPane);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setSize(wid, hgt);
frame.setVisible(true);
frame.toFront();
This is how I want the frame to be, but I can't set the parent frame.
I tried adding:
JOptionPane.showMessageDialog(MyParentJFrame,frame.getContentPane());
as the last line. This set the parent component to the other JFrame,
but I lost the ability to have my message be scrollable.
Any help would be greatly appreciate.
Thanks!