0
Лекц №3 график горимд дүрс зурах, дүрслэх.<br />Д. Энхжаргал<br />
Хялбар дүрсүүдийг зурах<br />g2.setColor(new Color(255,0,0));<br />Зурах өнгийг өөрчлөх<br />g2.fillRect(10,10,200,50);<br...
Canvas –д шулуун шугам зурах<br />...<br />public class MyCanvas extends Canvas<br />{<br />    ...<br />    public void p...
Тэгш өнцөгтийг Canvas-т зурах<br />...<br />public class MyCanvas extends Canvas<br />{<br />    ...<br />    public void ...
Өнгө өөрчлөх<br />public void paint(Graphics graphics)<br />    {<br />graphics.setColor(Color.red);<br />graphics.drawRec...
Тойрог зурах<br />public void paint(Graphics graphics)<br />    {<br />graphics.setColor(Color.white);<br />graphics.fillO...
Дугуй булант тэгш өнцөгт зурах<br />public void paint(Graphics graphics)<br />    {<br />graphics.setColor(Color.pink);<br...
График програмын жишээ<br />public class MyPanelextends JPanel{<br />	public void paintComponent(Graphics g){<br />super.p...
Даалгавар<br />Smile зурах програм бич<br />
Upcoming SlideShare
Loading in...5
×

Java лекц№3

982

Published on

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
982
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Java лекц№3"

  1. 1. Лекц №3 график горимд дүрс зурах, дүрслэх.<br />Д. Энхжаргал<br />
  2. 2. Хялбар дүрсүүдийг зурах<br />g2.setColor(new Color(255,0,0));<br />Зурах өнгийг өөрчлөх<br />g2.fillRect(10,10,200,50);<br />10, 10 координатаас эхлэн 200 өргөнтэй 50 өндөртэй тэгш өнцөгтийг дүүргэж будах<br />g2.drawString("Hello World", 10, 10);<br />Hello World үгийг 10, 10 координатаас зурах<br />
  3. 3. Canvas –д шулуун шугам зурах<br />...<br />public class MyCanvas extends Canvas<br />{<br /> ...<br /> public void paint(Graphics graphics)<br /> {<br />graphics.drawLine(10, 20, 300, 310);<br /> }<br /> ...<br />}<br />
  4. 4. Тэгш өнцөгтийг Canvas-т зурах<br />...<br />public class MyCanvas extends Canvas<br />{<br /> ...<br /> public void paint(Graphics graphics)<br /> {<br />graphics.drawRect(10, 10, 100, 100);<br /> }<br /> ...<br />}<br />
  5. 5. Өнгө өөрчлөх<br />public void paint(Graphics graphics)<br /> {<br />graphics.setColor(Color.red);<br />graphics.drawRect(10, 10, 100, 100);<br /> }<br />Доорх өнгүүдээс сонгоно:<br />Color.red<br />Color.blue<br />Color.green<br />Color.yellow<br />Color.pink<br />Color.black<br />Color.white<br />
  6. 6. Тойрог зурах<br />public void paint(Graphics graphics)<br /> {<br />graphics.setColor(Color.white);<br />graphics.fillOval(10, 10, 100, 100);<br />graphics.setColor(Color.blue);<br />graphics.drawOval(10, 10, 100, 100);<br /> }<br />
  7. 7. Дугуй булант тэгш өнцөгт зурах<br />public void paint(Graphics graphics)<br /> {<br />graphics.setColor(Color.pink);<br />graphics.fillRoundRect(10, 10, 100, 100, 5, 5);<br />graphics.setColor(Color.red);<br />graphics.drawRoundRect(10, 10, 100, 100, 5, 5);<br /> }<br />
  8. 8. График програмын жишээ<br />public class MyPanelextends JPanel{<br /> public void paintComponent(Graphics g){<br />super.paintComponent(g); <br />// erases background<br /> Graphics2D g2 = (Graphics2D)g; //cast for java2<br /> // my graphics:<br /> g2.setColor(new Color(255,0,0));<br /> g2.fillRect(10,10,200,50);<br /> g2.setColor(new Color(0,0,0));<br /> g2.drawString("Hello World", 10, 10);<br /> }<br />}<br />
  9. 9. Даалгавар<br />Smile зурах програм бич<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×