Bugzilla – Attachment 39 Details for
Bug 135
GLCanvas should interact better with lightweights
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test case from JOGL forums including commented-out workaround
Test.java (text/plain), 1.61 KB, created by
Sven Gothel
on 2005-05-01 13:13:00 CEST
(
hide
)
Description:
Test case from JOGL forums including commented-out workaround
Filename:
MIME Type:
Creator:
Sven Gothel
Created:
2005-05-01 13:13:00 CEST
Size:
1.61 KB
patch
obsolete
> import net.java.games.jogl.*; >import java.awt.*; >import javax.swing.*; > >public class Test >{ > public static void main(String[] args) { > JFrame f = new JFrame(); > f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > JPanel c = new JPanel(); > c.setPreferredSize(new Dimension(400,400)); > f.getContentPane().add(c); > c.setLayout(new GridBagLayout()); > GridBagConstraints gbc = new GridBagConstraints(); > gbc.gridwidth = GridBagConstraints.REMAINDER; > gbc.gridheight = 1; > gbc.weightx = gbc.weighty = 1; > gbc.fill = GridBagConstraints.BOTH; > > JPanel p = new JPanel(); > p.setBackground(Color.RED); > p.add(new JLabel("don't squeeze me!")); > c.add(p,gbc); > /* > JPanel p2 = new JPanel(); > p2.setBackground(Color.BLUE); > p2.add(new JLabel("me neither!")); > c.add(p2,gbc); > */ > GLCanvas glc = GLDrawableFactory.getFactory().createGLCanvas( > new GLCapabilities()); > glc.addGLEventListener( > new GLEventListener() { > public void init(GLDrawable drawable) {} > public void display(GLDrawable drawable) { > GL gl = drawable.getGL(); > gl.glClear(GL.GL_COLOR_BUFFER_BIT); > } > public void displayChanged(GLDrawable d,boolean b,boolean c){} > public void reshape(GLDrawable d,int a,int b,int c,int e){} > } > ); > c.add(glc,gbc); > // NOTE: the code below solves the problem > // > // JPanel cont = new JPanel(); > // cont.setLayout(new BorderLayout()); > // cont.add(glc, BorderLayout.CENTER); > // cont.setPreferredSize(new Dimension(0, 0)); > // c.add(cont, gbc); > > f.pack(); > f.setVisible(true); > } >}
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 135
:
38
| 39 |
40