Bugzilla – Attachment 790 Details for
Bug 1324
GLCanvas is always on top when using JInternalFrame
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test case.
TestInternalFrameCanvas.java (text/plain), 3.36 KB, created by
Laurent Renard
on 2016-09-28 12:08:41 CEST
(
hide
)
Description:
Test case.
Filename:
MIME Type:
Creator:
Laurent Renard
Created:
2016-09-28 12:08:41 CEST
Size:
3.36 KB
patch
obsolete
>import java.awt.BorderLayout; >import java.awt.Canvas; >import java.awt.Color; >import java.awt.MenuItem; >import java.awt.MouseInfo; >import java.awt.PopupMenu; >import java.awt.event.ActionEvent; >import java.beans.PropertyVetoException; > >import javax.swing.AbstractAction; >import javax.swing.JDesktopPane; >import javax.swing.JFrame; >import javax.swing.JInternalFrame; >import javax.swing.JMenuItem; >import javax.swing.JPanel; >import javax.swing.JPopupMenu; >import javax.swing.JToolBar; >import javax.swing.LookAndFeel; >import javax.swing.SwingUtilities; >import javax.swing.UIManager; > >import com.jogamp.opengl.awt.GLCanvas; >import com.jogamp.opengl.awt.GLJPanel; > >public class TestInternalFrameCanvas { > > public static void main(String[] args) { > SwingUtilities.invokeLater(new Runnable() { > > @Override > public void run() { > showUI(); > } > }); > > } > > private static void showUI() { > > // put metal look and feel to avoid shadows effects and custom OSX > // behavior. > try { > UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); > } catch (Exception e1) { > // TODO Auto-generated catch block > e1.printStackTrace(); > } > > JFrame frame = new JFrame(); > > frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > > // desktop pane > JDesktopPane pane = new JDesktopPane(); > frame.getContentPane().setLayout(new BorderLayout()); > frame.getContentPane().add(pane, BorderLayout.CENTER); > > // simple toolbar > JToolBar tb = new JToolBar(); > tb.add(new AbstractAction("Test") { > > private static final long serialVersionUID = 1L; > > @Override > public void actionPerformed(ActionEvent e) { > PopupMenu menu = new PopupMenu(); > pane.add(menu); > menu.add(new MenuItem("Just a heavy popup test menu")); > > menu.show(pane, 200,400); > } > }); > frame.getContentPane().add(tb, BorderLayout.WEST); > > // first internal frame contains a single JPanel (yellow bg) > JInternalFrame iframe0 = new JInternalFrame("Test jpanel", true, true, true, true); > iframe0.setSize(400, 400); > iframe0.setLocation(0, 0); > JPanel p = new JPanel(); > p.setBackground(Color.yellow); > iframe0.getContentPane().add(p); > iframe0.setVisible(true); > > // second internal frame contains a GLCanvas > JInternalFrame iframe1 = new JInternalFrame("Test GLCanvas", true, true, true, true); > iframe1.setSize(400, 400); > iframe1.setLocation(450, 0); > GLCanvas c = new GLCanvas(); > iframe1.getContentPane().add(c); > > // third internal frame contains a standard AWT Canvas. > JInternalFrame iframe2 = new JInternalFrame("Test AWT Canvas", true, true, true, true); > iframe2.setSize(400, 400); > iframe2.setLocation(0, 450); > Canvas c2 = new Canvas(); > c2.setBackground(Color.pink); > iframe2.getContentPane().add(c2); > > // last internal frame contains a GLJPanel. > JInternalFrame iframe3 = new JInternalFrame("Test GLJPanel", true, true, true, true); > iframe3.setSize(400, 400); > iframe3.setLocation(450, 450); > GLJPanel p2 = new GLJPanel(); > p2.setBackground(Color.green); > iframe3.getContentPane().add(p2); > > try { > iframe0.setVisible(true); > iframe1.setVisible(true); > iframe2.setVisible(true); > iframe3.setVisible(true); > iframe1.setSelected(true); > pane.add(iframe0); > pane.add(iframe1); > pane.add(iframe2); > pane.add(iframe3); > } catch (PropertyVetoException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > frame.setSize(800, 800); > frame.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 1324
: 790 |
791