Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. package textmovie;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import javax.swing.JPanel;
  8.  
  9. /**
  10. *
  11. * @author cesar
  12. */
  13. public class texscroll extends JPanel {
  14. int x =510 , y = 420;
  15.  
  16. @Override
  17.  
  18. public void paint(Graphics g){
  19. super.paint(g);
  20. Graphics2D g2 = (Graphics2D)g;
  21. Font font = new Font("Arial",Font.BOLD + Font.PLAIN,20);
  22. g2.setFont(font);
  23. g2.setColor(Color.BLACK);
  24.  
  25. String string ="Con un presupuesto superior a los 3 millones de"
  26. + " soles, entregado a la empresa constructora ARC, y "
  27. + "adjudicándose a la empresa supervisora chultong, se"
  28. + " reiniciarán los trabajos de construccion y culminación "
  29. + "de la infraestructura de la institución educativa gran"
  30. + " unidad escolar san carlos en la ciudad de puno.";
  31. g2.drawString(string ,x,y);
  32. try{Thread.sleep(10);}
  33. catch(Exception ex)
  34. {
  35. };
  36. x-=1;
  37.  
  38. if(x==-10*string.length()){
  39. x= 510;
  40. }
  41. repaint();
  42.  
  43. // System.out.println(string.length() );
  44. }
  45. }
  46.  
  47.  
  48.  
  49.  
  50. ///////////////////////////////////main code//////////////////
  51.  
  52. package textmovie;
  53.  
  54. import java.awt.Color;
  55. import javax.swing.JFrame;
  56.  
  57. /**
  58. *
  59. * @author cesar
  60. */
  61. public class Textmovie {
  62.  
  63. /**
  64. * @param args the command line arguments
  65. */
  66. public static void main(String[] args) {
  67. JFrame jf = new JFrame("FGHJK");
  68. jf.setBackground(Color.CYAN);
  69. jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  70. jf.add(new texscroll());
  71. jf.setSize(720,480);
  72.  
  73. jf.setVisible(true);
  74.  
  75. }
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement