0

Here I'm giving you the code written in the constructor of my JFrame . I've used BorderLayout.CENTER to put my JPanel in the center of JFrame but it's not working.

public FrameExamine() {
   initComponents();
   PanelExamine panelExamine=new PanelExamine();
   setLayout(new BorderLayout());
   getContentPane().add(panelExamine , BorderLayout.CENTER);
   // pack();
   setVisible(true);
}
Nick is tired
  • 6,860
  • 20
  • 39
  • 51
  • What part of your code isn't putting the panel in the center of the frame? If you mean that `panelExamine` is been resized when the frame is resized, then wrap `panelExamine` in another panel, which is using a `GridBagLayout` and put that onto the frame instead – MadProgrammer Feb 19 '17 at 06:23
  • It will be best if in addition to 'not working', you would give some details on what does happen. – yakobom Feb 19 '17 at 06:26
  • 1
    I am about to close this as a duplicate, but note that the [best answer](http://stackoverflow.com/a/7181197/418556) on the duplicate question is my own. It's just not the 'accepted' answer. :P – Andrew Thompson Feb 19 '17 at 07:00

0 Answers0