0

hey m working on a project where i have to centralise my dialog box with respect to its frame .i.e. when I restore down my frame i want the dialog box to get at its center(the frame's center ) give a specific General code how to do it this is what I tried but it aint working

if(u>1)

{
final JFrame frame = new JFrame("multiple pagetable changes!!!");
frame.setLocationByPlatform(true);

final JOptionPane pane1= new JOptionPane(change_log);
final JDialog d1 = pane1.createDialog(frame,"");
d1.pack();
d1.setLocationRelativeTo(null);
d1.setVisible(true);
}
shriya
  • 1
  • 1
    `JOptionPane.showXxx(frame, ...)` would be the simplest solutionm otherwise you're looking for `setLocationRelativeTo` – MadProgrammer Jun 30 '17 at 09:13
  • If this is not a duplicate, please edit your question to include a [mcve] that shows your revised approach. – trashgod Jun 30 '17 at 10:45

0 Answers0