public void openWindow() throws IOException {
		openedWindows++;
		if (frame != null)
			return;
		frame = new JFrame(EditorPanel.WINDOW_NAME);
		frame.setIconImage(U.getAppIcon());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		Point p = U.Config.readFrameSize();
		U.setFrameSize(frame, p.x, p.y);
		frame.getContentPane().add(this);
		frame.setTransferHandler(new U.TH(this));
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
		frame.addWindowListener(new WindowAdapter() {
			private long lastWarning;

			@Override
			public void windowActivated(WindowEvent e) {
				for (PlainPage pp : pageSet) {
					if (U.changedOutside(pp)) {
						long t = new File(pp.pageData.getFn()).lastModified();
						if (t > lastWarning) {
							lastWarning = t;
							if (!pp.changedOutside) {
								pp.changedOutside = true;
								if (pp.pageData.history.size() == 0) {
									U.readFile(pp.pageData, pp.pageData.getFn());// reload
									U.showSelfDispMessage(pp, "File changed outside.(reloaded)", 4000);
									pp.changedOutside = false;
								} else {
									U.showSelfDispMessage(pp, "File changed outside.", 4000);
								}
								// break;
							}
						}

					}
				}
				// EditPanel.this.requestFocus();
			}

			public void windowClosed(WindowEvent e) {
				System.out.println("closed");
				openedWindows--;
			}

			@Override
			public void windowClosing(WindowEvent e) {
				for (PlainPage pp : pageSet) {
					if (pp.pageData.getFn() != null) {
						try {
							U.saveFileHistory(pp.pageData.getFn(), pp.cy + 1);
						} catch (IOException e1) {
							e1.printStackTrace();
						}
					}
				}
				System.out.println("exit");
			}
		});
		// frame.addWindowFocusListener(new WindowAdapter() {
		// public void windowGainedFocus(WindowEvent e) {
		// EditPanel.this.requestFocusInWindow();
		// }
		// });

		changeTitle();
		repaint();
	}