@Override
	public void saveImage() {
		BufferedImage image = new BufferedImage(800, 500,
				BufferedImage.TYPE_INT_RGB);
		Graphics g = image.getGraphics();
		int r = 255;
		int g1 = 255;
		int b = 255;
		int col = (r << 16) | (g1 << 8) | b;
		//background
		for (int i = 0; i < 800; i++)
			for (int j = 0; j < 500; j++)
				image.setRGB(i, j, col);

		g.setColor(Color.BLACK);
		((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
				RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
		((Graphics2D) g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
				RenderingHints.VALUE_FRACTIONALMETRICS_ON);

		for (GraphicsObject go : lineLayer.children) {
			LabeledLine ll = (LabeledLine) go;

			g.drawLine(ll.getX(), ll.getY(), ll.getX2(), ll.getY2());
		}
		
		for (GraphicsObject go : nodeLayer.children) {
			g.setColor(Color.WHITE);
			g.fillOval(go.x, go.y, 12, 12);
			g.setColor(Color.BLACK);
			g.drawOval(go.x, go.y, 12, 12);
		}

		g.setColor(Color.BLACK);
		g.setFont(Window.getFeltTip().deriveFont((float)11.0).deriveFont(Font.BOLD));

		for (GraphicsObject go : nodeLayer.children) {

			CenteredLabel cl = ((Node) go).getLabel();
			GlyphVector gv = g.getFont().createGlyphVector(
					((Graphics2D) g).getFontRenderContext(), cl.text);
			java.awt.Rectangle r1 = gv.getPixelBounds(null, cl.x, cl.y);
			g.drawString(cl.text, cl.x - r1.width / 2, cl.y);
		}

		try {
			JFileChooser fc = new JFileChooser();
			int returnVal = fc.showSaveDialog(null);
			if (returnVal == JFileChooser.APPROVE_OPTION) {
				File f = fc.getSelectedFile();
				if (!f.getAbsolutePath().endsWith(".jpg") && !f.getAbsolutePath().endsWith(".jpeg"))
					f = new File(f.getAbsolutePath() + ".jpeg");
				ImageIO.write(image, "jpg", f);
		}} catch (IOException e) {
			e.printStackTrace();
		}
	}