Così ho scritto un programma con il compito di far scorrere del testo.
Solo che non appare niente![]()
Graziecodice:import javax.swing.*; import java.awt.*; import java.awt.event.*; public class scorriwords extends JFrame implements Runnable{ int x=1,y=1; Thread runner; scorriwords(){ super("ScorriWords v.1.0 - Keratox"); setBounds(20,10,700,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel pan = new JPanel(); setContentPane(pan); if(runner==null){ runner= new Thread(); runner.start(); } } public void run(){ while(true){ y--; } } public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D)g; g2.drawString("Word", x,y); } public static void main(String[] args){ scorriwords sw = new scorriwords(); sw.show(); repaint(); } }
ciao

