Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package textmovie;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import javax.swing.JPanel;
- /**
- *
- * @author cesar
- */
- public class texscroll extends JPanel {
- int x =510 , y = 420;
- @Override
- public void paint(Graphics g){
- super.paint(g);
- Graphics2D g2 = (Graphics2D)g;
- Font font = new Font("Arial",Font.BOLD + Font.PLAIN,20);
- g2.setFont(font);
- g2.setColor(Color.BLACK);
- String string ="Con un presupuesto superior a los 3 millones de"
- + " soles, entregado a la empresa constructora ARC, y "
- + "adjudicándose a la empresa supervisora chultong, se"
- + " reiniciarán los trabajos de construccion y culminación "
- + "de la infraestructura de la institución educativa gran"
- + " unidad escolar san carlos en la ciudad de puno.";
- g2.drawString(string ,x,y);
- try{Thread.sleep(10);}
- catch(Exception ex)
- {
- };
- x-=1;
- if(x==-10*string.length()){
- x= 510;
- }
- repaint();
- // System.out.println(string.length() );
- }
- }
- ///////////////////////////////////main code//////////////////
- package textmovie;
- import java.awt.Color;
- import javax.swing.JFrame;
- /**
- *
- * @author cesar
- */
- public class Textmovie {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- JFrame jf = new JFrame("FGHJK");
- jf.setBackground(Color.CYAN);
- jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- jf.add(new texscroll());
- jf.setSize(720,480);
- jf.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement