Ok, So I made an test java applet to make sure I know how to make them but I the default look and feel looks really ugly. So I want to switch it Nimbus but my tacit isn't working. I've done about an hour worth of Google searching but nothing came up, Except one forum that had the question, But no answers I could understand. Any ideas? And if this is hard to understand, i'm sorry.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
public class Websitetest extends JApplet implements ActionListener, Runnable {
boolean i = false;
Color red = new Color(255, 0, 0);
Color lightgrey = new Color(200, 200, 200);
Thread runner;
public void init() {
setLookAndFeel();
Button dp = new Button("Don't press");
dp.addActionListener(this);
FlowLayout flow = new FlowLayout();
setLayout(flow);
add(dp);
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D) screen;
if (i == false) {screen2D.setColor(lightgrey);}
else {screen2D.setColor(red);}
screen2D.fillRect(0, 0, getSize().width, getSize().height);
screen2D.setColor(Color.black);
if (i == false) {screen2D.drawString("", 5, 60);}
else {screen2D.drawString("I SAID DON'T PRESS!", 90, 60);}
}
public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}
public void stop() {
if (runner != null) {
runner = null;
}
}
public void run() {
Thread thisThread = Thread.currentThread();
}
public void actionPerformed(ActionEvent event) {
i = true;
repaint();
}
private void setLookAndFeel() {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception exc) {
//ignore error
}
}
}