<commit_before>package go.graphics.swing;

import go.graphics.GLDrawContext;
import go.graphics.RedrawListener;
import go.graphics.area.Area;
import go.graphics.event.GOEvent;
import go.graphics.event.GOEventHandlerProvoder;
import go.graphics.swing.event.swingInterpreter.GOSwingEventConverter;
import go.graphics.swing.opengl.JOGLDrawContext;

import java.awt.BorderLayout;

import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.swing.JPanel;

/**
 * This class lets you embed areas into swing components.
 * 
 * @author michael
 */
public class AreaContainer extends JPanel implements RedrawListener,
        GOEventHandlerProvoder {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8204496712425576430L;
	private final Area area;

	private GLCanvas canvas;
	private JOGLDrawContext context;

	/**
	 * creates a new area conaainer
	 * 
	 * @param area
	 *            The area to display
	 */
	public AreaContainer(Area area) {
		this.area = area;
		this.setLayout(new BorderLayout());

		GLProfile profile = GLProfile.getDefault();
		GLCapabilities cap = new GLCapabilities(profile);
		cap.setStencilBits(1);
		canvas = new GLCanvas(cap);

		new GOSwingEventConverter(canvas, this);

		canvas.addGLEventListener(new GLEventListener() {

			@Override
			public void reshape(GLAutoDrawable gl, int x, int y, int width,
			        int height) {
				resizeArea(gl.getGL().getGL2(), x, y, width, height);
			}

			@Override
			public void init(GLAutoDrawable arg0) {
				arg0.getGL().setSwapInterval(0);
			}

			@Override
			public void dispose(GLAutoDrawable arg0) {
			}

			@Override
			public void display(GLAutoDrawable glDrawable) {
				draw(glDrawable.getGL().getGL2());
			}
		});

		this.add(canvas);
		area.addRedrawListener(this);
	}

	/**<commit_msg>- completely removed ISPosition2D and replaced it with ShortPoint2D - further work on new movable<commit_after>package go.graphics.swing;

import go.graphics.RedrawListener;
import go.graphics.area.Area;
import go.graphics.event.GOEvent;
import go.graphics.event.GOEventHandlerProvoder;
import go.graphics.swing.event.swingInterpreter.GOSwingEventConverter;
import go.graphics.swing.opengl.JOGLDrawContext;

import java.awt.BorderLayout;

import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.swing.JPanel;

/**
 * This class lets you embed areas into swing components.
 * 
 * @author michael
 */
public class AreaContainer extends JPanel implements RedrawListener, GOEventHandlerProvoder {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8204496712425576430L;
	private final Area area;

	private GLCanvas canvas;
	private JOGLDrawContext context;

	/**
	 * creates a new area conaainer
	 * 
	 * @param area
	 *            The area to display
	 */
	public AreaContainer(Area area) {
		this.area = area;
		this.setLayout(new BorderLayout());

		GLProfile profile = GLProfile.getDefault();
		GLCapabilities cap = new GLCapabilities(profile);
		cap.setStencilBits(1);
		canvas = new GLCanvas(cap);

		new GOSwingEventConverter(canvas, this);

		canvas.addGLEventListener(new GLEventListener() {

			@Override
			public void reshape(GLAutoDrawable gl, int x, int y, int width, int height) {
				resizeArea(gl.getGL().getGL2(), x, y, width, height);
			}

			@Override
			public void init(GLAutoDrawable arg0) {
				arg0.getGL().setSwapInterval(0);
			}

			@Override
			public void dispose(GLAutoDrawable arg0) {
			}

			@Override
			public void display(GLAutoDrawable glDrawable) {
				draw(glDrawable.getGL().getGL2());
			}
		});

		this.add(canvas);
		area.addRedrawListener(this);
	}

	/**
{'fraction_non_alphanumeric': 0.10378994302700024, 'fraction_numerical': 0.013871686896210057, 'mean_word_length': 4.217054263565892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1775226', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1291, 'n_words': 291}