Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zadanie2linie;
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Graphics;
- /**
- *
- * @author Let
- */
- public class Plotno extends Canvas {
- protected void paint(Graphics g) {
- g.setColor(255,255,255);
- g.fillRect(0, 0, this.getWidth(), this.getHeight());
- int x1 = 0;
- int x2=this.getWidth();
- int y1 = 0;
- int y2= this.getHeight();
- for (int i = 0;i<=(this.getHeight()/20);i++){
- g.setColor(0,0,0);
- g.drawLine(x1, y1, x2, y2);
- y1=y1+20;
- y2=y2-20;
- }
- x2=0;
- x1 = 0;
- y1 = 0;
- y2= this.getHeight();
- for (int i = 0;i<=this.getHeight()/10;i++){
- g.setColor(0,0,0);
- g.drawLine(x1, y1, x2 ,y2 );
- x2=x2+10;
- y1=y1+10;
- }
- x2=0;
- x1 = this.getWidth();
- y1 = 0;
- y2= 0;
- for (int i = 0;i<=this.getHeight()/10;i++){
- g.setColor(0,0,0);
- g.drawLine(x1, y1, x2 ,y2 );
- y1=y1+10;
- x2=x2+10;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement