Programlama | Programlama Dilleri | C Programlama Dili |C++

Hata
  • XML Parsing Error at 1:82. Error 9: Invalid character
Anasayfa Programlama Java TrackBar Uygulamas?


TrackBar Uygulamas?

Netbeans platformunda yap?lan proje sayesinde kullan?c?dan al?nan say?n?n okunmas?n? sa?lamaktad?r. Dist klasor iindeki "JavaApplication5.jar" uzant?l? dosya al??t?r?larak sistem ba??ms?z program al??t?r?labilir.

Trackbar uygulamas?yla birlikte pencere zerinde geni?li?i de?i?tirilebilen bir daire izdirilmektedir.

Program?n Tamam?n? A?a??daki Linkten ?ndirebilirsiniz

Linki Grebilmeniz ?in ye Olman?z Gerekmektedir...

ye Kay?t

Program Kodu:

  1.  
  2.  
  3. /*
  4. * To change this template, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7.  
  8. package javaapplication5;
  9.  
  10. import java.awt.BorderLayout;
  11. import java.awt.Color;
  12. import java.awt.Container;
  13. import java.awt.Dimension;
  14. import java.awt.Graphics;
  15. import javax.swing.JFrame;
  16. import javax.swing.JPanel;
  17. import javax.swing.JSlider;
  18. import javax.swing.event.ChangeEvent;
  19. import javax.swing.event.ChangeListener;
  20.  
  21. /**
  22. *
  23. * @author Celal Atalar
  24. */
  25. class Daire extends JPanel
  26. {
  27. private int mesafe=10;
  28. public void paintComponent(Graphics g)
  29. {
  30. super.paintComponent(g);
  31. g.setColor(new Color((int)(Math.random()*256),(int)(Math.random()*256),(int)(Math.random()*256)));
  32. g.fillOval(10, 10, mesafe,mesafe);
  33. }
  34. public void mesafeayarlamasi(int disardangelen)
  35. {
  36. if(disardangelen<10)
  37. mesafe=10;
  38. else
  39. mesafe=disardangelen;
  40. repaint();
  41. }
  42. public Dimension getPreferredSize()
  43. {
  44. return new Dimension(200,200);
  45. }
  46. public Dimension getMinimumSize()
  47. {
  48. return getPreferredSize();
  49. }
  50. }
  51. public class TrackBar extends JFrame{
  52. JSlider cubuk;
  53. Daire benimpanel;
  54. public TrackBar()
  55. {
  56. benimpanel=new Daire();
  57. cubuk=new JSlider(JSlider.HORIZONTAL,0,200,10);
  58. cubuk.setMajorTickSpacing(10);
  59. cubuk.setPaintTicks(true);
  60. Container pencere=getContentPane();
  61. benimpanel.setBackground(Color.BLUE);
  62. pencere.add(benimpanel,BorderLayout.CENTER);
  63. pencere.add(cubuk,BorderLayout.SOUTH);
  64. cubuk.addChangeListener(
  65. new ChangeListener(){
  66. public void stateChanged (ChangeEvent olay)
  67. {
  68. benimpanel.mesafeayarlamasi(cubuk.getValue());
  69. }
  70. } );
  71. setSize(220,200);
  72. setVisible(true);
  73. }
  74. public static void main(String[] args)
  75. {
  76. TrackBar program=new TrackBar();
  77. program.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  78. }
  79.  
  80. }
  81.  
  82.  

Yorumlar (0)
Sadece kayıtlı kullanıcılar yorum yazabilir!
Son Güncelleme ( Perşembe, 07 Nisan 2011 23:46 )  
404 Not Found

404

Not Found

The resource requested could not be found on this server!


Proudly powered by LiteSpeed Web Server

Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.