Bugzilla – Attachment 813 Details for
Bug 1379
NewtCanvasAWT in JSplitPane on macOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test program showing the problem.
Main.java (text/plain), 2.37 KB, created by
Bogdan Nicula
on 2019-04-25 10:11:35 CEST
(
hide
)
Description:
Test program showing the problem.
Filename:
MIME Type:
Creator:
Bogdan Nicula
Created:
2019-04-25 10:11:35 CEST
Size:
2.37 KB
patch
obsolete
>package abc; > >import java.awt.BorderLayout; >import java.awt.Dimension; > >import javax.swing.JButton; >import javax.swing.JFrame; >import javax.swing.JPanel; >import javax.swing.JSplitPane; >import javax.swing.SwingUtilities; > >import com.jogamp.newt.awt.NewtCanvasAWT; >import com.jogamp.newt.opengl.GLWindow; >import com.jogamp.opengl.GL; >import com.jogamp.opengl.GLAutoDrawable; >import com.jogamp.opengl.GLCapabilities; >import com.jogamp.opengl.GLEventListener; >import com.jogamp.opengl.GLProfile; > >public class Main { > > public static void main(String[] args) { > SwingUtilities.invokeLater(() -> { > MainWindow w = new MainWindow(); > w.setPreferredSize(new Dimension(640, 480)); > w.pack(); > w.setVisible(true); > }); > } > > private static class MainWindow extends JFrame { > private static final long serialVersionUID = -1; > > MainWindow() { > GLProfile profile = GLProfile.getDefault(); > GLCapabilities caps = new GLCapabilities(profile); > > GLWindow glWindow = GLWindow.create(caps); > glWindow.addGLEventListener(new MainGLEventListener()); > > NewtCanvasAWT canvas = new NewtCanvasAWT(glWindow); > > JPanel canvasPanel = new JPanel(new BorderLayout()); > canvasPanel.setMinimumSize(new Dimension(1, 1)); > canvasPanel.add(canvas); > > JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); > pane.setBottomComponent(new JButton("Button")); > pane.setTopComponent(canvasPanel); > > getContentPane().add(pane); > } > > private class MainGLEventListener implements GLEventListener { > private double time; > > public void init(GLAutoDrawable drawable) { > } > > public void dispose(GLAutoDrawable drawable) { > } > > public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { > } > > public void display(GLAutoDrawable drawable) { > GL gl = drawable.getGL(); > float r = (float) Math.abs(Math.sin(time)); > float g = (float) Math.abs(Math.sin(time + 0.3)); > float b = (float) Math.abs(Math.sin(time + 0.6)); > gl.glClearColor(0, 0.3f, 0.6f, 1); > gl.glClear(GL.GL_COLOR_BUFFER_BIT); > time += 0.01; > } > } > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1379
: 813 |
814