This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Need help with my code! Trying to do a mousedrag to be able to "draw" in an applet. That part is succesful and works fine(kind of blinks a lot tho), but the button and random color do not work(the line is always black)So why isn't the button showing up in the applet and why wont the random color work?! thank you.
Your button is doing nothing. You need to attach an ActionListener to it for it to work. But that won't solve all your problems.
First of all, whenever you override paint(Graphics) or paintComponent(Graphics) (the latter in Swing) you should always first call super.paint(g) / super.paintComponent(g). Furthermore, you are not telling the Graphics object to use another colour, unless that's what Expo.setRandomColor(g) does. Keep in mind that this method is called in paint, so each repaint will be in a new random colour.
Apart from migrating this code from AWT to Swing (using JApplet and JButton), I also suggest you don't use two ints. Instead, I'd create a new class (or use an existing one, like java.awt.Point) and use a List of that class.