LWJGL does not render on Canvas properly

Started by Sadret, March 26, 2015, 14:27:58

Previous topic - Next topic

Sadret

Hi,

this is my first project where i want to render with LWJGL on a canvas inside a Swing window.

Everything worked fine in a test window (only the jFrame + one jPanel and a custom canvas in it). Then i put the canvas inside a bigger window. Now it renders only the background (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) call). Everything i want to do after that is not rendered. If i change the clearColor on runtime, it will rendered so. But nothing else.

I tried some things with my swing window, and odd things happen: The more components there are, the more likely it is that OpenGL renders nothing. The oddest thing: With a medium amount of components, it renders sometimes. Like 50% of the time it works, 50% not. If i take more components, it is 20%/80%, if i take less, it is 80%/20%.

Why is that and how can i fix it?

GL initialisation:
public static void initGL() {

		// init OpenGL
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
		glFrustum(-0.01, 0.01, -0.01 / aspectRatio, 0.01 / aspectRatio, 0.01, 100000);
		glMatrixMode(GL_MODELVIEW);

		glClearColor(0.5f, 0.5f, 0.5f, 0.5f);

		// General
		glEnable(GL_DEPTH_TEST);
		glEnable(GL_CULL_FACE);

		// Light
		// various light configs
	}


render method:
public static void render() {
		float f = 0;
		// used to check clear color is really working
		// f = new Random().nextFloat();
		glClearColor(f, f, f, 1);

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glLight(GL_LIGHT0, GL_POSITION, lightPosition);
		glLoadIdentity();

		glTranslatef(0, 0, -2);

		glColor3f(0.5f, 0.5f, 0.5f);

		glBegin(GL_QUADS);
		GL11.glNormal3i(0, 0, 1);
		glVertex3i(-1, -100, 0);
		glVertex3i(1, -100, 0);
		glVertex3i(1, 100, 0);
		glVertex3i(-1, 100, 0);
		glEnd();
	}


MyCanvas.java:
package opengl;

import java.awt.Canvas;
import java.awt.Dimension;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;

public class MyCanvas extends Canvas {
	private static final long serialVersionUID = 1L;

	public static final MyCanvas instance = new MyCanvas();

	private Thread thread;
	private boolean running = false;

	private MyCanvas() {
		super();
		setIgnoreRepaint(true);
		setPreferredSize(new Dimension(720, 512));
	}

	private void startLWJGL() {
		thread = new Thread() {
			public void run() {
				running = true;
				// Create display
				try {
					Display.setParent(instance);
					Display.create();
				} catch (LWJGLException lwjgle) {
					lwjgle.printStackTrace();
					System.exit(0);
				}

				// Initialize GL
				GLHelper.initGL();

				// Game loop
				while (running) {
					GLHelper.render();
					Display.update();
				}

				// Destroy window
				Display.destroy();
			}
		};
		thread.start();
	}

	private void stopLWJGL() {
		running = false;
		try {
			thread.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	@Override
	public final void addNotify() {
		super.addNotify();
		startLWJGL();
	}

	@Override
	public final void removeNotify() {
		stopLWJGL();
		super.removeNotify();
	}
	
	@Override
	public void repaint() {
		super.repaint();
		GLHelper.render();
		Display.update();
	}
}


Window made by windowBuilder:
public class Display {
	public static void main(String[] args) throws IOException, LWJGLException {
		// not working
		new Display();

		// working
		// MyCanvas mc = MyCanvas.instance;
		//
		// JFrame jf = new JFrame("test");
		// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		// jf.getContentPane().add(mc);
		// jf.setVisible(true);
		// jf.pack();
	}

	public Display() {
		JFrame jFrame = new JFrame();
		jFrame.setResizable(false);
		jFrame.setVisible(true);
		jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] { 0, 512, 0, 0 };
		gridBagLayout.rowHeights = new int[] { 512, 0 };
		gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		jFrame.getContentPane().setLayout(gridBagLayout);

		JPanel leftMenu = new JPanel();
		GridBagConstraints gbc_leftMenu = new GridBagConstraints();
		gbc_leftMenu.anchor = GridBagConstraints.WEST;
		gbc_leftMenu.fill = GridBagConstraints.VERTICAL;
		gbc_leftMenu.insets = new Insets(0, 0, 0, 5);
		gbc_leftMenu.gridx = 0;
		gbc_leftMenu.gridy = 0;
		jFrame.getContentPane().add(leftMenu, gbc_leftMenu);
		GridBagLayout gbl_leftMenu = new GridBagLayout();
		gbl_leftMenu.columnWidths = new int[] { 196, 0 };
		gbl_leftMenu.rowHeights = new int[] { 10, 0, 10, 0, 0, 0 };
		gbl_leftMenu.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_leftMenu.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		leftMenu.setLayout(gbl_leftMenu);

		JPanel pSize = new JPanel();
		pSize.setBorder(new TitledBorder(null, "Size", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		GridBagConstraints gbc_pSize = new GridBagConstraints();
		gbc_pSize.insets = new Insets(0, 0, 5, 0);
		gbc_pSize.fill = GridBagConstraints.BOTH;
		gbc_pSize.gridx = 0;
		gbc_pSize.gridy = 0;
		leftMenu.add(pSize, gbc_pSize);
		GridBagLayout gbl_pSize = new GridBagLayout();
		gbl_pSize.columnWidths = new int[] { 25, 50, 25, 50, 25, 50, 0 };
		gbl_pSize.rowHeights = new int[] { 0, 0 };
		gbl_pSize.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gbl_pSize.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		pSize.setLayout(gbl_pSize);

		JLabel lblX = new JLabel("X:");
		GridBagConstraints gbc_lblX = new GridBagConstraints();
		gbc_lblX.insets = new Insets(0, 0, 0, 5);
		gbc_lblX.gridx = 0;
		gbc_lblX.gridy = 0;
		pSize.add(lblX, gbc_lblX);

		JSpinner spinner = new JSpinner();
		GridBagConstraints gbc_spinner = new GridBagConstraints();
		gbc_spinner.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner.insets = new Insets(0, 0, 0, 5);
		gbc_spinner.gridx = 1;
		gbc_spinner.gridy = 0;
		pSize.add(spinner, gbc_spinner);

		JLabel label = new JLabel("Y:");
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.insets = new Insets(0, 0, 0, 5);
		gbc_label.gridx = 2;
		gbc_label.gridy = 0;
		pSize.add(label, gbc_label);

		JSpinner spinner_1 = new JSpinner();
		GridBagConstraints gbc_spinner_1 = new GridBagConstraints();
		gbc_spinner_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_1.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_1.gridx = 3;
		gbc_spinner_1.gridy = 0;
		pSize.add(spinner_1, gbc_spinner_1);

		JLabel label_1 = new JLabel("Z:");
		GridBagConstraints gbc_label_1 = new GridBagConstraints();
		gbc_label_1.insets = new Insets(0, 0, 0, 5);
		gbc_label_1.gridx = 4;
		gbc_label_1.gridy = 0;
		pSize.add(label_1, gbc_label_1);

		JSpinner spinner_2 = new JSpinner();
		GridBagConstraints gbc_spinner_2 = new GridBagConstraints();
		gbc_spinner_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_2.gridx = 5;
		gbc_spinner_2.gridy = 0;
		pSize.add(spinner_2, gbc_spinner_2);

		JPanel pRotPoint = new JPanel();
		pRotPoint.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "RotationPoint", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		GridBagConstraints gbc_pRotPoint = new GridBagConstraints();
		gbc_pRotPoint.insets = new Insets(0, 0, 5, 0);
		gbc_pRotPoint.fill = GridBagConstraints.BOTH;
		gbc_pRotPoint.gridx = 0;
		gbc_pRotPoint.gridy = 1;
		leftMenu.add(pRotPoint, gbc_pRotPoint);
		GridBagLayout gbl_pRotPoint = new GridBagLayout();
		gbl_pRotPoint.columnWidths = new int[] { 25, 50, 25, 50, 25, 50, 0 };
		gbl_pRotPoint.rowHeights = new int[] { 0, 0 };
		gbl_pRotPoint.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gbl_pRotPoint.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		pRotPoint.setLayout(gbl_pRotPoint);

		JLabel label_2 = new JLabel("X:");
		GridBagConstraints gbc_label_2 = new GridBagConstraints();
		gbc_label_2.insets = new Insets(0, 0, 0, 5);
		gbc_label_2.gridx = 0;
		gbc_label_2.gridy = 0;
		pRotPoint.add(label_2, gbc_label_2);

		JSpinner spinner_3 = new JSpinner();
		GridBagConstraints gbc_spinner_3 = new GridBagConstraints();
		gbc_spinner_3.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_3.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_3.gridx = 1;
		gbc_spinner_3.gridy = 0;
		pRotPoint.add(spinner_3, gbc_spinner_3);

		JLabel label_3 = new JLabel("Y:");
		GridBagConstraints gbc_label_3 = new GridBagConstraints();
		gbc_label_3.insets = new Insets(0, 0, 0, 5);
		gbc_label_3.gridx = 2;
		gbc_label_3.gridy = 0;
		pRotPoint.add(label_3, gbc_label_3);

		JSpinner spinner_4 = new JSpinner();
		GridBagConstraints gbc_spinner_4 = new GridBagConstraints();
		gbc_spinner_4.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_4.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_4.gridx = 3;
		gbc_spinner_4.gridy = 0;
		pRotPoint.add(spinner_4, gbc_spinner_4);

		JLabel label_4 = new JLabel("Z:");
		GridBagConstraints gbc_label_4 = new GridBagConstraints();
		gbc_label_4.insets = new Insets(0, 0, 0, 5);
		gbc_label_4.gridx = 4;
		gbc_label_4.gridy = 0;
		pRotPoint.add(label_4, gbc_label_4);

		JSpinner spinner_5 = new JSpinner();
		GridBagConstraints gbc_spinner_5 = new GridBagConstraints();
		gbc_spinner_5.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_5.gridx = 5;
		gbc_spinner_5.gridy = 0;
		pRotPoint.add(spinner_5, gbc_spinner_5);

		JPanel pRot = new JPanel();
		pRot.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Rotation", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		GridBagConstraints gbc_pRot = new GridBagConstraints();
		gbc_pRot.insets = new Insets(0, 0, 5, 0);
		gbc_pRot.fill = GridBagConstraints.BOTH;
		gbc_pRot.gridx = 0;
		gbc_pRot.gridy = 2;
		leftMenu.add(pRot, gbc_pRot);
		GridBagLayout gbl_pRot = new GridBagLayout();
		gbl_pRot.columnWidths = new int[] { 25, 50, 25, 50, 25, 50, 0 };
		gbl_pRot.rowHeights = new int[] { 0, 0 };
		gbl_pRot.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gbl_pRot.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		pRot.setLayout(gbl_pRot);

		JLabel label_5 = new JLabel("X:");
		GridBagConstraints gbc_label_5 = new GridBagConstraints();
		gbc_label_5.insets = new Insets(0, 0, 0, 5);
		gbc_label_5.gridx = 0;
		gbc_label_5.gridy = 0;
		pRot.add(label_5, gbc_label_5);

		JSpinner spinner_6 = new JSpinner();
		GridBagConstraints gbc_spinner_6 = new GridBagConstraints();
		gbc_spinner_6.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_6.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_6.gridx = 1;
		gbc_spinner_6.gridy = 0;
		pRot.add(spinner_6, gbc_spinner_6);

		JLabel label_6 = new JLabel("Y:");
		GridBagConstraints gbc_label_6 = new GridBagConstraints();
		gbc_label_6.insets = new Insets(0, 0, 0, 5);
		gbc_label_6.gridx = 2;
		gbc_label_6.gridy = 0;
		pRot.add(label_6, gbc_label_6);

		JSpinner spinner_7 = new JSpinner();
		GridBagConstraints gbc_spinner_7 = new GridBagConstraints();
		gbc_spinner_7.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_7.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_7.gridx = 3;
		gbc_spinner_7.gridy = 0;
		pRot.add(spinner_7, gbc_spinner_7);

		JLabel label_7 = new JLabel("Z:");
		GridBagConstraints gbc_label_7 = new GridBagConstraints();
		gbc_label_7.insets = new Insets(0, 0, 0, 5);
		gbc_label_7.gridx = 4;
		gbc_label_7.gridy = 0;
		pRot.add(label_7, gbc_label_7);

		JSpinner spinner_8 = new JSpinner();
		GridBagConstraints gbc_spinner_8 = new GridBagConstraints();
		gbc_spinner_8.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_8.gridx = 5;
		gbc_spinner_8.gridy = 0;
		pRot.add(spinner_8, gbc_spinner_8);

		JPanel pOffset = new JPanel();
		pOffset.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Offset", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		GridBagConstraints gbc_pOffset = new GridBagConstraints();
		gbc_pOffset.insets = new Insets(0, 0, 5, 0);
		gbc_pOffset.fill = GridBagConstraints.BOTH;
		gbc_pOffset.gridx = 0;
		gbc_pOffset.gridy = 3;
		leftMenu.add(pOffset, gbc_pOffset);
		GridBagLayout gbl_pOffset = new GridBagLayout();
		gbl_pOffset.columnWidths = new int[] { 25, 50, 25, 50, 25, 50, 0 };
		gbl_pOffset.rowHeights = new int[] { 0, 0 };
		gbl_pOffset.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gbl_pOffset.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		pOffset.setLayout(gbl_pOffset);

		JLabel label_11 = new JLabel("X:");
		GridBagConstraints gbc_label_11 = new GridBagConstraints();
		gbc_label_11.insets = new Insets(0, 0, 0, 5);
		gbc_label_11.gridx = 0;
		gbc_label_11.gridy = 0;
		pOffset.add(label_11, gbc_label_11);

		JSpinner spinner_12 = new JSpinner();
		GridBagConstraints gbc_spinner_12 = new GridBagConstraints();
		gbc_spinner_12.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_12.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_12.gridx = 1;
		gbc_spinner_12.gridy = 0;
		pOffset.add(spinner_12, gbc_spinner_12);

		JLabel label_12 = new JLabel("Y:");
		GridBagConstraints gbc_label_12 = new GridBagConstraints();
		gbc_label_12.insets = new Insets(0, 0, 0, 5);
		gbc_label_12.gridx = 2;
		gbc_label_12.gridy = 0;
		pOffset.add(label_12, gbc_label_12);

		JSpinner spinner_13 = new JSpinner();
		GridBagConstraints gbc_spinner_13 = new GridBagConstraints();
		gbc_spinner_13.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_13.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_13.gridx = 3;
		gbc_spinner_13.gridy = 0;
		pOffset.add(spinner_13, gbc_spinner_13);

		JLabel label_13 = new JLabel("Z:");
		GridBagConstraints gbc_label_13 = new GridBagConstraints();
		gbc_label_13.insets = new Insets(0, 0, 0, 5);
		gbc_label_13.gridx = 4;
		gbc_label_13.gridy = 0;
		pOffset.add(label_13, gbc_label_13);

		JSpinner spinner_14 = new JSpinner();
		GridBagConstraints gbc_spinner_14 = new GridBagConstraints();
		gbc_spinner_14.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_14.gridx = 5;
		gbc_spinner_14.gridy = 0;
		pOffset.add(spinner_14, gbc_spinner_14);

		JPanel pTexOffset = new JPanel();
		pTexOffset.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "TextureOffset", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		GridBagConstraints gbc_pTexOffset = new GridBagConstraints();
		gbc_pTexOffset.fill = GridBagConstraints.BOTH;
		gbc_pTexOffset.gridx = 0;
		gbc_pTexOffset.gridy = 4;
		leftMenu.add(pTexOffset, gbc_pTexOffset);
		GridBagLayout gbl_pTexOffset = new GridBagLayout();
		gbl_pTexOffset.columnWidths = new int[] { 25, 50, 25, 50, 25, 50, 0 };
		gbl_pTexOffset.rowHeights = new int[] { 0, 0 };
		gbl_pTexOffset.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gbl_pTexOffset.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
		pTexOffset.setLayout(gbl_pTexOffset);

		JLabel label_8 = new JLabel("X:");
		GridBagConstraints gbc_label_8 = new GridBagConstraints();
		gbc_label_8.insets = new Insets(0, 0, 0, 5);
		gbc_label_8.gridx = 0;
		gbc_label_8.gridy = 0;
		pTexOffset.add(label_8, gbc_label_8);

		JSpinner spinner_9 = new JSpinner();
		GridBagConstraints gbc_spinner_9 = new GridBagConstraints();
		gbc_spinner_9.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_9.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_9.gridx = 1;
		gbc_spinner_9.gridy = 0;
		pTexOffset.add(spinner_9, gbc_spinner_9);

		JLabel label_9 = new JLabel("Y:");
		GridBagConstraints gbc_label_9 = new GridBagConstraints();
		gbc_label_9.insets = new Insets(0, 0, 0, 5);
		gbc_label_9.gridx = 2;
		gbc_label_9.gridy = 0;
		pTexOffset.add(label_9, gbc_label_9);

		JSpinner spinner_10 = new JSpinner();
		GridBagConstraints gbc_spinner_10 = new GridBagConstraints();
		gbc_spinner_10.fill = GridBagConstraints.HORIZONTAL;
		gbc_spinner_10.insets = new Insets(0, 0, 0, 5);
		gbc_spinner_10.gridx = 3;
		gbc_spinner_10.gridy = 0;
		pTexOffset.add(spinner_10, gbc_spinner_10);

		JPanel pCanvas = new JPanel();
		GridBagConstraints gbc_pCanvas = new GridBagConstraints();
		gbc_pCanvas.fill = GridBagConstraints.BOTH;
		gbc_pCanvas.insets = new Insets(0, 0, 0, 5);
		gbc_pCanvas.gridx = 1;
		gbc_pCanvas.gridy = 0;
		jFrame.getContentPane().add(pCanvas, gbc_pCanvas);

		MyCanvas myCanvas = MyCanvas.instance;
		pCanvas.add(myCanvas);

		JPanel rightMenu = new JPanel();
		GridBagConstraints gbc_rightMenu = new GridBagConstraints();
		gbc_rightMenu.anchor = GridBagConstraints.NORTHEAST;
		gbc_rightMenu.gridx = 2;
		gbc_rightMenu.gridy = 0;
		jFrame.getContentPane().add(rightMenu, gbc_rightMenu);
		GridBagLayout gbl_rightMenu = new GridBagLayout();
		gbl_rightMenu.columnWidths = new int[] { 0, 0 };
		gbl_rightMenu.rowHeights = new int[] { 0, 0, 0, 0 };
		gbl_rightMenu.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
		gbl_rightMenu.rowWeights = new double[] { 1.0, 0.0, 1.0, Double.MIN_VALUE };
		rightMenu.setLayout(gbl_rightMenu);

		JPanel pTree = new JPanel();
		GridBagConstraints gbc_pTree = new GridBagConstraints();
		gbc_pTree.insets = new Insets(0, 0, 5, 0);
		gbc_pTree.fill = GridBagConstraints.BOTH;
		gbc_pTree.gridx = 0;
		gbc_pTree.gridy = 0;
		rightMenu.add(pTree, gbc_pTree);

		JTree tree = new JTree();
		pTree.add(tree);
		tree.setEditable(true);

		JPanel buttonsTree = new JPanel();
		GridBagConstraints gbc_buttonsTree = new GridBagConstraints();
		gbc_buttonsTree.insets = new Insets(0, 0, 5, 0);
		gbc_buttonsTree.anchor = GridBagConstraints.WEST;
		gbc_buttonsTree.gridx = 0;
		gbc_buttonsTree.gridy = 1;
		rightMenu.add(buttonsTree, gbc_buttonsTree);

		JButton btnAddQuad = new JButton("add quad");
		btnAddQuad.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
			}
		});
		buttonsTree.add(btnAddQuad);

		JButton btnAddFolder = new JButton("add folder");
		btnAddFolder.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			}
		});
		buttonsTree.add(btnAddFolder);

		JButton btnExtractToFolder = new JButton("extract to folder");
		btnExtractToFolder.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			}
		});
		buttonsTree.add(btnExtractToFolder);

		JButton btnRemove = new JButton("remove");
		btnRemove.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			}
		});
		buttonsTree.add(btnRemove);

		JButton btnExportJava = new JButton("export Java");
		btnExportJava.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			}
		});

		JButton btnExportJson = new JButton("export JSON");
		btnExportJson.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			}
		});
		buttonsTree.add(btnExportJson);
		buttonsTree.add(btnExportJava);

		JMenuBar menuBar = new JMenuBar();
		jFrame.setJMenuBar(menuBar);

		JMenu mnFile = new JMenu("File");
		menuBar.add(mnFile);

		JMenuItem mntmLoadJson = new JMenuItem("Load JSON");
		mnFile.add(mntmLoadJson);

		jFrame.pack();
	}
}