Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. class DisplayGraphics1 extends Canvas{  
  2.  
  3.     public void paint(Graphics g) {  
  4.         g.drawString("Hello",40,40);  
  5.         setBackground(Color.WHITE);            
  6.     }
  7. }
  8.  
  9. public class LayeredTest extends Canvas implements GLEventListener{
  10.  
  11.     static DisplayGraphics1 m = new DisplayGraphics1();
  12.     static final JFrame frame = new JFrame ( "Game" );
  13.  
  14.     public static void main( String[] args ) {
  15.  
  16.     //... creating glcanvas
  17.     frame.getContentPane().add( glcanvas );
  18.     frame.setSize( frame.getContentPane().getPreferredSize() );
  19.     frame.setVisible( true );
  20.  
  21.     }
  22.  
  23.     @Override
  24.     public void display( GLAutoDrawable drawable ) {
  25.    
  26.         if(clickedOnHighscore) { frame.getContentPane().add( m ); }
  27.  
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement