drawRoundRect(int x, int y, int eni, int balandligi, int arcWidth, int arcHeight) - chizadi yaxlitlangan to'rtburchaklar ;
drawOval(int x, int y, int eni, int balandligi) - chizadi oval ;
drawPolygon(int[] xPoints, int[] yPoints, int nPoints) - chizadi ko'pburchak ( ko'pburchak ) berilgan massivlar koordinatalar x va y;
chizishKo'pburchak ( Poligon p ) - Polygon ob'ekti tomonidan belgilangan ko'pburchakni chizadi ;
drawPolyline ( int [] xPoints , int [] yPoints , int nPoints ) - x massivlar orqali berilgan bog'langan chiziqlar ketma-ketligini chizadi va y ;
drawArc(int x, int y, int eni, int balandligi, int startAngle, int arcAngle) - chizadi yoy doiralar ;
drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) - qo'shimchalar tasvir ;
drawString(String str, int x, int y) - chizadi ip ;
setColor ( rang c ) , getColor () - joriy rangni o'rnatadi va qaytaradi;
getFont () - joriy shriftni qaytaradi;
setFont ( shrift shrift ) - yangi shriftni o'rnatadi. Quyidagi 2-4-misollar Grafika sinfidagi usullardan foydalanishni ko'rsatadi. applet oynasida grafiklarni ko'rsatish uchun.
// № 11.2 misol: ko'pburchak displey: DrawPoly . java Import java . applet .*; Import java . awt .*;
x, y, kenglik - 1, balandlik - 1, ko'tarilgan); g.draw3DRect(
x + 1, y + 1, kenglik - 3, balandlik - 3, ko'tarilgan); g.draw3DRect(
x + 2, y + 2, kengligi - 5, balandligi - 5, ko'tarilgan);
}
public void fill3DRect(Grafika g, int x, int y, int eni, int balandligi, mantiqiy ko'tarilgan){ g.draw3DRect(x, y, width-1, balandlik-1, ko'tarilgan); g.draw3DRect(
x + 1, y + 1, kenglik - 3, balandlik - 3, ko'tarilgan); g.draw3DRect( x + 2, y + 2, kenglik - 5, balandlik - 5, ko'tarilgan); g.fillRect(x + 3, y + 3, kenglik - 6, balandlik - 6); }
ommaviy boʻshliq boʻyoq(Grafiklar g){ g.setColor(Color.gray); draw3DRect(g, 10, 5, 80, 40, rost); draw3DRect(g, 130, 5, 80, 40, yolgʻon); fill3DRect(g, 10, 55, 80, 40, rost); fill3DRect(g, 130, 55, 80, 40, noto'g'ri);
Do'stlaringiz bilan baham: |