Hej alle sammen jeg prøver at mixe LWJGL og Swing. Men får denne fejl som jeg ikke rigtigt kan fixe
- /**
- *
- */
- public static TSudioQE TSudio;
- private static final long serialVersionUID = -8495077485468477943L;
-
- public static void main(String[] args) {
- try {
- TSudioQE tsudio = new TSudioQE();
- } catch (LWJGLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- public TSudioQE() throws LWJGLException {
- setTitle("TSudio Quall Engine 1X");
- JPanel p = new JPanel();
-
- Canvas c = new Canvas();
-
- Display.create();
- Display.setParent(c);
-
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-
- // set the color of the quad (R,G,B,A)
- GL11.glColor3f(0.5f, 0.5f, 1.0f);
-
- // draw quad
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glVertex2f(100, 100);
- GL11.glVertex2f(100 + 200, 100);
- GL11.glVertex2f(100 + 200, 100 + 200);
- GL11.glVertex2f(100, 100 + 200);
- GL11.glEnd();
- add(p);
- setSize(800, 460);
- setExtendedState(JFrame.MAXIMIZED_BOTH);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
-
- @Override
- public void windowOpened(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void windowClosing(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void windowClosed(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void windowIconified(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void windowDeiconified(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void windowActivated(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void windowDeactivated(WindowEvent e) {
- // TODO Auto-generated method stub
-
- }
Fejl:
org.lwjgl.LWJGLException: Parent.isDisplayable() must be true
at org.lwjgl.opengl.Display.createWindow(Display.java:301)
at org.lwjgl.opengl.Display.setParent(Display.java:451)
at qq.application.TSudioQE.<init>(TSudioQE.java:47)
at qq.application.TSudioQE.main(TSudioQE.java:33)
Tak på forhånd og håber i vil hjælpe.
Ha'en god dag