0 Members and 1 Guest are viewing this topic.
import java.awt.*;import javax.swing.*;import java.util.Random;import java.awt.Graphics;public class Test{public static void main(String[] args){int b = 1;JFrame frame = new JFrame("Cause why not?");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(300,50);Container pane = frame.getContentPane();DrawingPanel panel = new DrawingPanel("LOL");pane.add(panel);frame.setVisible(true);while(2*b==1 || 2*b!=1) // that is the question...panel.repaint();}}class DrawingPanel extends JPanel{private String str;public DrawingPanel(String s){str = s;}public void paintComponent(Graphics g){super.paintComponent(g);Random rand = new Random();g.setColor(new Color(rand.nextInt(256),rand.nextInt(256),rand.nextInt(256)));g.drawString(str,4,30);}}
No!!! :OEDIT: Of coure I tried
Code: ( "Cause why not?") [Select]import java.awt.*;import javax.swing.*;import java.util.Random;import java.awt.Graphics;public class Test{public static void main(String[] args){int b = 1;JFrame frame = new JFrame("Cause why not?");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(300,50);Container pane = frame.getContentPane();DrawingPanel panel = new DrawingPanel("LOL");pane.add(panel);frame.setVisible(true);while(2*b==1 || 2*b!=1) // that is the question...panel.repaint();}}class DrawingPanel extends JPanel{private String str;public DrawingPanel(String s){str = s;}public void paintComponent(Graphics g){super.paintComponent(g);Random rand = new Random();g.setColor(new Color(rand.nextInt(256),rand.nextInt(256),rand.nextInt(256)));g.drawString(str,4,30);}}i had to :p
haha well you need to compile it first... and it really wouldn't do much harm. it DOES create an infinite loop, but you can press ctrl+b to break out of it. it displays a window and then displays the string "LOL" over and over, each time in a different color. but the colors change so fast you can't really tell
Use BlueJ, right?
Quote from: nemo on October 18, 2010, 09:28:58 pmhaha well you need to compile it first... and it really wouldn't do much harm. it DOES create an infinite loop, but you can press ctrl+b to break out of it. it displays a window and then displays the string "LOL" over and over, each time in a different color. but the colors change so fast you can't really tellCTRL+C, right?
man, I love the "prevent additional dialogue option for Chrome.