Ajuda na Classe Drawpanel

1 resposta
W

Alguem Pode me ajudar com este algoritimo ,Não estou conseguindo Resolver e não entendi muito Bem…

import java.awt.Graphics;
import javax.swing.JPanel;

public class Drawpanel extends JPanel 
{
   
   public void paintComponent( Graphics g )
   {
   
     super.paintComponent( g );
     
     int pass = 15;
     
     int width = getWidth();
     int height = getHeight();
   
     for( int y = 0; y <= 50; y++ )
       g.drawLine( y  , y * pass, width, height );
        
      
    
      
      
   }
     
}

1 Resposta

W
import javax.swing.JFrame;

public class DrawpanelTest
{
    
    public static void main( String [] args )
    {
    
      Drawpanel panel = new Drawpanel();
    
      JFrame application = new JFrame();
    
      application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    
      application.add( panel );
      application.setSize( 250,250 );
      application.setVisible( true );
    
    
    
    }
    
}
Criado 27 de dezembro de 2013
Ultima resposta 27 de dez. de 2013
Respostas 1
Participantes 1