Program: 161953
Project: 161953
Buggy source:
public void init() throws Exception {
  choosedir=new JFileChooser("String_Node_Str");
  choosedemo=new JFileChooser("String_Node_Str");
  choosemovie=new JFileChooser("String_Node_Str");
  cl=new CLInterface();
  File dirfile=new File("String_Node_Str");
  tfdir="String_Node_Str";
  moviedir="String_Node_Str";
  currentdemo="String_Node_Str";
  try {
    version=this.getClass().getPackage().getImplementationVersion().split("String_Node_Str")[0];
  }
 catch (  Exception e) {
    version="String_Node_Str";
  }
  steampath=cl.regQuery("String_Node_Str","String_Node_Str",1);
  choosedir.setDialogTitle("String_Node_Str");
  choosedir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  choosedir.setCurrentDirectory(new File(steampath));
  choosemovie.setDialogTitle("String_Node_Str");
  choosemovie.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  if (dirfile.exists()) {
    BufferedReader br=new BufferedReader(new FileReader(dirfile));
    tfdir=br.readLine();
    moviedir=br.readLine();
    br.close();
  }
  while (!dirfile.exists() || !Files.exists(Paths.get(tfdir)) || !Paths.get(tfdir).toFile().getName().toString().equals("String_Node_Str")) {
    int returnVal=choosedir.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      tfdir=choosedir.getSelectedFile().getPath();
      PrintWriter pw=new PrintWriter(new FileWriter("String_Node_Str"));
      pw.println(tfdir);
      pw.close();
    }
 else {
      dispose();
      System.exit(0);
    }
  }
  while (moviedir == null || moviedir.isEmpty() || !Files.exists(Paths.get(moviedir))) {
    int returnVal=choosemovie.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      moviedir=choosemovie.getSelectedFile().getPath();
      PrintWriter pw=new PrintWriter(new FileWriter("String_Node_Str",true));
      pw.println(moviedir);
      pw.close();
    }
 else {
      dispose();
      System.exit(0);
    }
  }
  choosedemo.setDialogTitle("String_Node_Str");
  choosedemo.setFileSelectionMode(JFileChooser.FILES_ONLY);
  choosedemo.setFileFilter(new FileNameExtensionFilter("String_Node_Str",new String[]{"String_Node_Str"}));
  choosedemo.setCurrentDirectory(new File(tfdir));
  settings=new SettingsManager("String_Node_Str");
  movies=new MovieManager(moviedir);
  files=new FileManager(tfdir);
  files.restoreAll();
  oDxlevel=cl.regQuery("String_Node_Str","String_Node_Str",0);
  tabbedpane=new JTabbedPane();
  settingspanel=new JPanel();
  vdmpanel=new JPanel();
  settingspanel.setLayout(new GridLayout(10,2));
  vdmpanel.setLayout(new GridLayout(4,1));
  FilenameFilter filter=new FilenameFilter(){
    public boolean accept(    File dir,    String name){
      return name.endsWith("String_Node_Str");
    }
  }
;
  String[] skyboxfiles=new File("String_Node_Str").list(filter);
  int skyboxlength;
  if (skyboxfiles == null) {
    skyboxlength=0;
  }
 else {
    skyboxlength=skyboxfiles.length;
  }
  String[] skyboxes=new String[skyboxlength + 1];
  for (int i=1; i < skyboxlength + 1; ++i) {
    cl.generatePreview(skyboxfiles[i - 1]);
    skyboxes[i]=skyboxfiles[i - 1].substring(0,skyboxfiles[i - 1].indexOf("String_Node_Str"));
  }
  skyboxes[0]="String_Node_Str";
  String[] resolutions={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] framerates={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] huds={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] viewmodeloptions={"String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] dxleveloptions={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] columnames={"String_Node_Str","String_Node_Str","String_Node_Str"};
  Object[][] tickdata={};
  model=new DefaultTableModel(tickdata,columnames);
  height=new JTextField(4);
  width=new JTextField(4);
  fps=new JTextField(4);
  selecteddemo=new JTextField(40);
  tick1=new JTextField(6);
  tick2=new JTextField(6);
  ticks=new JTable(model);
  ticks.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  int vColIndex=0;
  TableColumn col=ticks.getColumnModel().getColumn(vColIndex);
  int columnwidth=400;
  col.setPreferredWidth(columnwidth);
  ticks.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
  ticks.setFillsViewportHeight(true);
  resolution=new JComboBox<>(resolutions);
  framerate=new JComboBox<>(framerates);
  viewmodelswitch=new JComboBox<>(viewmodeloptions);
  dxlevel=new JComboBox<>(dxleveloptions);
  skybox=new JComboBox<>(skyboxes);
  hud=new JComboBox<>(huds);
  resolution.setSelectedIndex(resChoice(settings.getWidth(),settings.getHeight()));
  ticksscrollpane=new JScrollPane(ticks);
  if (resChoice(settings.getWidth(),settings.getHeight()) == 4) {
    width.setText("String_Node_Str" + settings.getWidth());
    height.setText("String_Node_Str" + settings.getHeight());
  }
  framerate.setSelectedIndex(frameChoice(settings.getFramerate()));
  if (frameChoice(settings.getFramerate()) == 7) {
    fps.setText("String_Node_Str" + settings.getFramerate());
  }
  hud.setSelectedIndex(hudChoice(settings.getHud()));
  viewmodelswitch.setSelectedIndex(viewmodelChoice(settings.getViewmodelSwitch()));
  dxlevel.setSelectedIndex(dxlevelChoice(settings.getDxlevel()));
  viewmodelfov=new JSlider(JSlider.HORIZONTAL,55,70,settings.getViewmodelFov());
  viewmodelfov.setMajorTickSpacing(5);
  viewmodelfov.setMinorTickSpacing(1);
  viewmodelfov.setPaintTicks(true);
  viewmodelfov.setPaintLabels(true);
  motionblur=new JCheckBox("String_Node_Str",settings.getMotionBlur());
  crosshairswitch=new JCheckBox("String_Node_Str",!settings.getCrosshairSwitch());
  crosshair=new JCheckBox("String_Node_Str",!settings.getCrosshair());
  combattext=new JCheckBox("String_Node_Str",!settings.getCombattext());
  announcer=new JCheckBox("String_Node_Str",!settings.getAnnouncer());
  domination=new JCheckBox("String_Node_Str",!settings.getDomination());
  hitsounds=new JCheckBox("String_Node_Str",!settings.getHitsounds());
  voice=new JCheckBox("String_Node_Str",!settings.getVoice());
  steamcloud=new JCheckBox("String_Node_Str",!settings.getSteamCloud());
  save=new JButton("String_Node_Str");
  start=new JButton("String_Node_Str");
  browsedemos=new JButton("String_Node_Str");
  addticks=new JButton("String_Node_Str");
  createvdm=new JButton("String_Node_Str");
  deletemovies=new JButton("String_Node_Str");
  clearticks=new JButton("String_Node_Str");
  clearvdm=new JButton("String_Node_Str");
  skyboxpreview=new JButton("String_Node_Str");
  height.setEditable(resolution.getSelectedIndex() == 4);
  width.setEditable(resolution.getSelectedIndex() == 4);
  fps.setEditable(framerate.getSelectedIndex() == 7);
  save.addActionListener(this);
  start.addActionListener(this);
  deletemovies.addActionListener(this);
  resolution.addActionListener(this);
  framerate.addActionListener(this);
  browsedemos.addActionListener(this);
  addticks.addActionListener(this);
  clearticks.addActionListener(this);
  createvdm.addActionListener(this);
  clearvdm.addActionListener(this);
  skyboxpreview.addActionListener(this);
  addWindowListener(new LwrtWindowListener());
  respanel=new JPanel();
  respanel2=new JPanel();
  fpspanel=new JPanel();
  fpspanel2=new JPanel();
  hudpanel=new JPanel();
  skyboxpanel=new JPanel();
  viewmodelfovpanel=new JPanel();
  viewmodelswitchpanel=new JPanel();
  dxlevelpanel=new JPanel();
  savedeletepanel=new JPanel();
  tickpanel=new JPanel();
  demopanel=new JPanel();
  createvdmpanel=new JPanel();
  respanel.add(new JLabel("String_Node_Str"));
  respanel.add(resolution);
  respanel2.add(new JLabel("String_Node_Str"));
  respanel2.add(width);
  respanel2.add(new JLabel("String_Node_Str"));
  respanel2.add(height);
  fpspanel.add(new JLabel("String_Node_Str"));
  fpspanel.add(framerate);
  fpspanel2.add(new JLabel("String_Node_Str"));
  fpspanel2.add(fps);
  hudpanel.add(new JLabel("String_Node_Str"));
  hudpanel.add(hud);
  viewmodelfovpanel.add(new JLabel("String_Node_Str"));
  viewmodelfovpanel.add(viewmodelfov);
  savedeletepanel.add(save);
  savedeletepanel.add(deletemovies);
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(tick1);
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(tick2);
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(addticks);
  demopanel.add(new JLabel("String_Node_Str"));
  demopanel.add(selecteddemo);
  demopanel.add(browsedemos);
  createvdmpanel.add(clearticks);
  createvdmpanel.add(createvdm);
  createvdmpanel.add(clearvdm);
  viewmodelswitchpanel.add(new JLabel("String_Node_Str"));
  viewmodelswitchpanel.add(viewmodelswitch);
  dxlevelpanel.add(new JLabel("String_Node_Str"));
  dxlevelpanel.add(dxlevel);
  skyboxpanel.add(new JLabel("String_Node_Str"));
  skyboxpanel.add(skybox);
  skyboxpanel.add(skyboxpreview);
  settingspanel.add(respanel);
  settingspanel.add(respanel2);
  settingspanel.add(fpspanel);
  settingspanel.add(fpspanel2);
  settingspanel.add(dxlevelpanel);
  settingspanel.add(hudpanel);
  settingspanel.add(viewmodelfovpanel);
  settingspanel.add(skyboxpanel);
  settingspanel.add(motionblur);
  settingspanel.add(viewmodelswitchpanel);
  settingspanel.add(crosshairswitch);
  settingspanel.add(crosshair);
  settingspanel.add(combattext);
  settingspanel.add(announcer);
  settingspanel.add(domination);
  settingspanel.add(hitsounds);
  settingspanel.add(voice);
  settingspanel.add(steamcloud);
  settingspanel.add(savedeletepanel);
  settingspanel.add(start);
  vdmpanel.add(demopanel);
  vdmpanel.add(tickpanel);
  vdmpanel.add(createvdmpanel);
  vdmpanel.add(ticksscrollpane);
  tabbedpane.addTab("String_Node_Str",settingspanel);
  tabbedpane.addTab("String_Node_Str",vdmpanel);
  add(tabbedpane);
  setTitle("String_Node_Str" + version);
  try {
    setIconImage(new ImageIcon(LwrtGUI.class.getClassLoader().getResource("String_Node_Str")).getImage());
  }
 catch (  Exception e) {
    log.info("String_Node_Str" + e);
  }
  pack();
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  setSize(dim.width / 2,dim.height / 2);
  int w=getSize().width;
  int h=getSize().height;
  int x=(dim.width - w) / 2;
  int y=(dim.height - h) / 2;
  setLocation(x,y);
  setResizable(false);
}

Fixed version (ground truth):
public void init() throws Exception {
  choosedir=new JFileChooser("String_Node_Str");
  choosedemo=new JFileChooser("String_Node_Str");
  choosemovie=new JFileChooser("String_Node_Str");
  cl=new CLInterface();
  File dirfile=new File("String_Node_Str");
  tfdir="String_Node_Str";
  moviedir="String_Node_Str";
  currentdemo="String_Node_Str";
  try {
    version=this.getClass().getPackage().getImplementationVersion().split("String_Node_Str")[0];
  }
 catch (  Exception e) {
    version="String_Node_Str";
  }
  steampath=cl.regQuery("String_Node_Str","String_Node_Str",1);
  choosedir.setDialogTitle("String_Node_Str");
  choosedir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  choosedir.setCurrentDirectory(new File(steampath));
  choosemovie.setDialogTitle("String_Node_Str");
  choosemovie.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  if (dirfile.exists()) {
    BufferedReader br=new BufferedReader(new FileReader(dirfile));
    tfdir=br.readLine();
    moviedir=br.readLine();
    br.close();
  }
  while (!dirfile.exists() || !Files.exists(Paths.get(tfdir)) || !Paths.get(tfdir).toFile().getName().toString().equals("String_Node_Str")) {
    int returnVal=choosedir.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      tfdir=choosedir.getSelectedFile().getPath();
      PrintWriter pw=new PrintWriter(new FileWriter("String_Node_Str"));
      pw.println(tfdir);
      pw.close();
    }
 else {
      dispose();
      System.exit(0);
    }
  }
  while (moviedir == null || moviedir.isEmpty() || !Files.exists(Paths.get(moviedir))) {
    int returnVal=choosemovie.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      moviedir=choosemovie.getSelectedFile().getPath();
      PrintWriter pw=new PrintWriter(new FileWriter("String_Node_Str",true));
      pw.println(moviedir);
      pw.close();
    }
 else {
      dispose();
      System.exit(0);
    }
  }
  choosedemo.setDialogTitle("String_Node_Str");
  choosedemo.setFileSelectionMode(JFileChooser.FILES_ONLY);
  choosedemo.setFileFilter(new FileNameExtensionFilter("String_Node_Str",new String[]{"String_Node_Str"}));
  choosedemo.setCurrentDirectory(new File(tfdir));
  settings=new SettingsManager("String_Node_Str");
  movies=new MovieManager(moviedir);
  files=new FileManager(tfdir);
  files.restoreAll();
  oDxlevel=cl.regQuery("String_Node_Str","String_Node_Str",0);
  tabbedpane=new JTabbedPane();
  settingspanel=new JPanel();
  vdmpanel=new JPanel();
  settingspanel.setLayout(new GridLayout(10,2));
  vdmpanel.setLayout(new GridLayout(4,1));
  FilenameFilter filter=new FilenameFilter(){
    public boolean accept(    File dir,    String name){
      return name.endsWith("String_Node_Str");
    }
  }
;
  String[] skyboxfiles=new File("String_Node_Str").list(filter);
  int skyboxlength;
  if (skyboxfiles == null) {
    skyboxlength=0;
  }
 else {
    skyboxlength=skyboxfiles.length;
  }
  String[] skyboxes=new String[skyboxlength + 1];
  for (int i=1; i < skyboxlength + 1; ++i) {
    cl.generatePreview(skyboxfiles[i - 1]);
    skyboxes[i]=skyboxfiles[i - 1].substring(0,skyboxfiles[i - 1].indexOf("String_Node_Str"));
  }
  skyboxes[0]="String_Node_Str";
  String[] resolutions={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] framerates={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] huds={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] viewmodeloptions={"String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] dxleveloptions={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] columnames={"String_Node_Str","String_Node_Str","String_Node_Str"};
  Object[][] tickdata={};
  model=new DefaultTableModel(tickdata,columnames);
  height=new JTextField(4);
  width=new JTextField(4);
  fps=new JTextField(4);
  selecteddemo=new JTextField(40);
  tick1=new JTextField(6);
  tick2=new JTextField(6);
  ticks=new JTable(model);
  ticks.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  int vColIndex=0;
  TableColumn col=ticks.getColumnModel().getColumn(vColIndex);
  int columnwidth=400;
  col.setPreferredWidth(columnwidth);
  ticks.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
  ticks.setFillsViewportHeight(true);
  resolution=new JComboBox<>(resolutions);
  framerate=new JComboBox<>(framerates);
  viewmodelswitch=new JComboBox<>(viewmodeloptions);
  dxlevel=new JComboBox<>(dxleveloptions);
  skybox=new JComboBox<>(skyboxes);
  hud=new JComboBox<>(huds);
  resolution.setSelectedIndex(resChoice(settings.getWidth(),settings.getHeight()));
  ticksscrollpane=new JScrollPane(ticks);
  if (resChoice(settings.getWidth(),settings.getHeight()) == 4) {
    width.setText("String_Node_Str" + settings.getWidth());
    height.setText("String_Node_Str" + settings.getHeight());
  }
  framerate.setSelectedIndex(frameChoice(settings.getFramerate()));
  if (frameChoice(settings.getFramerate()) == 7) {
    fps.setText("String_Node_Str" + settings.getFramerate());
  }
  hud.setSelectedIndex(hudChoice(settings.getHud()));
  viewmodelswitch.setSelectedIndex(viewmodelChoice(settings.getViewmodelSwitch()));
  dxlevel.setSelectedIndex(dxlevelChoice(settings.getDxlevel()));
  viewmodelfov=new JSlider(JSlider.HORIZONTAL,55,70,settings.getViewmodelFov());
  viewmodelfov.setMajorTickSpacing(5);
  viewmodelfov.setMinorTickSpacing(1);
  viewmodelfov.setPaintTicks(true);
  viewmodelfov.setPaintLabels(true);
  motionblur=new JCheckBox("String_Node_Str",settings.getMotionBlur());
  crosshairswitch=new JCheckBox("String_Node_Str",!settings.getCrosshairSwitch());
  crosshair=new JCheckBox("String_Node_Str",!settings.getCrosshair());
  combattext=new JCheckBox("String_Node_Str",!settings.getCombattext());
  announcer=new JCheckBox("String_Node_Str",!settings.getAnnouncer());
  domination=new JCheckBox("String_Node_Str",!settings.getDomination());
  hitsounds=new JCheckBox("String_Node_Str",!settings.getHitsounds());
  voice=new JCheckBox("String_Node_Str",!settings.getVoice());
  steamcloud=new JCheckBox("String_Node_Str",!settings.getSteamCloud());
  save=new JButton("String_Node_Str");
  start=new JButton("String_Node_Str");
  browsedemos=new JButton("String_Node_Str");
  addticks=new JButton("String_Node_Str");
  createvdm=new JButton("String_Node_Str");
  deletemovies=new JButton("String_Node_Str");
  clearticks=new JButton("String_Node_Str");
  clearvdm=new JButton("String_Node_Str");
  skyboxpreview=new JButton("String_Node_Str");
  height.setEditable(resolution.getSelectedIndex() == 4);
  width.setEditable(resolution.getSelectedIndex() == 4);
  fps.setEditable(framerate.getSelectedIndex() == 7);
  save.addActionListener(this);
  start.addActionListener(this);
  deletemovies.addActionListener(this);
  resolution.addActionListener(this);
  framerate.addActionListener(this);
  browsedemos.addActionListener(this);
  addticks.addActionListener(this);
  clearticks.addActionListener(this);
  createvdm.addActionListener(this);
  clearvdm.addActionListener(this);
  skyboxpreview.addActionListener(this);
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      files.restoreAll();
      System.exit(0);
    }
  }
);
  respanel=new JPanel();
  respanel2=new JPanel();
  fpspanel=new JPanel();
  fpspanel2=new JPanel();
  hudpanel=new JPanel();
  skyboxpanel=new JPanel();
  viewmodelfovpanel=new JPanel();
  viewmodelswitchpanel=new JPanel();
  dxlevelpanel=new JPanel();
  savedeletepanel=new JPanel();
  tickpanel=new JPanel();
  demopanel=new JPanel();
  createvdmpanel=new JPanel();
  respanel.add(new JLabel("String_Node_Str"));
  respanel.add(resolution);
  respanel2.add(new JLabel("String_Node_Str"));
  respanel2.add(width);
  respanel2.add(new JLabel("String_Node_Str"));
  respanel2.add(height);
  fpspanel.add(new JLabel("String_Node_Str"));
  fpspanel.add(framerate);
  fpspanel2.add(new JLabel("String_Node_Str"));
  fpspanel2.add(fps);
  hudpanel.add(new JLabel("String_Node_Str"));
  hudpanel.add(hud);
  viewmodelfovpanel.add(new JLabel("String_Node_Str"));
  viewmodelfovpanel.add(viewmodelfov);
  savedeletepanel.add(save);
  savedeletepanel.add(deletemovies);
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(tick1);
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(tick2);
  tickpanel.add(new JLabel("String_Node_Str"));
  tickpanel.add(addticks);
  demopanel.add(new JLabel("String_Node_Str"));
  demopanel.add(selecteddemo);
  demopanel.add(browsedemos);
  createvdmpanel.add(clearticks);
  createvdmpanel.add(createvdm);
  createvdmpanel.add(clearvdm);
  viewmodelswitchpanel.add(new JLabel("String_Node_Str"));
  viewmodelswitchpanel.add(viewmodelswitch);
  dxlevelpanel.add(new JLabel("String_Node_Str"));
  dxlevelpanel.add(dxlevel);
  skyboxpanel.add(new JLabel("String_Node_Str"));
  skyboxpanel.add(skybox);
  skyboxpanel.add(skyboxpreview);
  settingspanel.add(respanel);
  settingspanel.add(respanel2);
  settingspanel.add(fpspanel);
  settingspanel.add(fpspanel2);
  settingspanel.add(dxlevelpanel);
  settingspanel.add(hudpanel);
  settingspanel.add(viewmodelfovpanel);
  settingspanel.add(skyboxpanel);
  settingspanel.add(motionblur);
  settingspanel.add(viewmodelswitchpanel);
  settingspanel.add(crosshairswitch);
  settingspanel.add(crosshair);
  settingspanel.add(combattext);
  settingspanel.add(announcer);
  settingspanel.add(domination);
  settingspanel.add(hitsounds);
  settingspanel.add(voice);
  settingspanel.add(steamcloud);
  settingspanel.add(savedeletepanel);
  settingspanel.add(start);
  vdmpanel.add(demopanel);
  vdmpanel.add(tickpanel);
  vdmpanel.add(createvdmpanel);
  vdmpanel.add(ticksscrollpane);
  tabbedpane.addTab("String_Node_Str",settingspanel);
  tabbedpane.addTab("String_Node_Str",vdmpanel);
  add(tabbedpane);
  setTitle("String_Node_Str" + version);
  try {
    setIconImage(new ImageIcon(LwrtGUI.class.getClassLoader().getResource("String_Node_Str")).getImage());
  }
 catch (  Exception e) {
    log.info("String_Node_Str" + e);
  }
  pack();
  Dimension dim=Toolkit.getDefaultToolkit().getScreenSize();
  setSize(dim.width / 2,dim.height / 2);
  int w=getSize().width;
  int h=getSize().height;
  int x=(dim.width - w) / 2;
  int y=(dim.height - h) / 2;
  setLocation(x,y);
  setResizable(false);
}