import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Diary extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
JLabel l2;
JLabel l1;
String quotes[] = {
//Space Marine quotes 0 - 20
"Some may question your right to let them live.",
"A Heretic may see the truth the world as a Traitor.",
"knowledge is power, hide it well",
"To admit defeat is toblaspheme against the Emperor",
"Sow the seeds of damnination andI shall reap the souls of the tainted.",
"Do not fail your Brothers. Though your charge.",
"Blessed is the mind too small for doubt.",
"We may be few, and our enemies galaxy shall yet know hope.",
"Give me a hundred Space Marines. other troops",
"Raise the flag high. Let thoseclaim their lives this day!",
"The Wolves aren't animals. No others outside its pack.",
"Pain and death are illusions its relevance.",
"Faith is purest whenit is unquestioning.",
"Each path must be chosen withwhole.",
"Come all you Xeno Throne's gaze!",
"Honour your Chapter.",
"The enemies of the the Space Marines!",
"My sword is at theor dead.",
"If you can see us, can hear is our laughter.",
"We have been woundedshall teach them otherwise.",
"I have travelled far andvery world tremble.",
//Chaos marine quotes
"If the path to salvation of purgatory, then so be it.",
"Do you hear the voices too?!!",
"Sanity is for the weak!",
"Know this! What will comelet the universe drown in it!",
"In the embrace of the great I once most feared: Death.",
"Let the Galaxy burn.",
"Though my guards may sleep never tire.",
"All power demands sacrifice... blood for the promise of power.",
"Let us play hide and slay!",
"There, feel the glory of necrosis, and rejoice! Nurgle loves you!",
"It is the fate of the weak to die Give me glory, or give me death!",
"The minds of gods are not for have to play.",
"Kill! Maim! Burn! Kill! Maim! Burn!",
"WE ARE THE DESTROYER!",
"By the Worm Eye that darkest depths of the Warp!",
"The lesson is this. The To aim low.",
"Long shall be your suffering. Joyous be your pain.",
"Horus was weak. and he let it slip away.",
"We're back, and better than ever!",
"Cast down the idols! a rotting corpse!"
};
JLabel showQuotes;
public static void main(String[] args) {
Diary frame = new Diary();
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setSize(600, 300);
frame.setVisible(true);
frame.setLocationRelativeTo(null);
frame.details();
frame.setResizable(false);
}
public void details()
{
setLayout(new BorderLayout());
JLabel background=new JLabel(new ImageIcon(Toolkit.getDefaultToolkit().createImage(Diary.class.getResource("background.jpg"))));
add(background);
background.setLayout(new FlowLayout());
l1=new JLabel("Lessons from a life of war");
l2=new JLabel("---------------------------------------");
int now = (int) showthis();
showQuotes = new JLabel(quotes[now]);
//size refresh is needed to display correctly
setSize(399,399);
setSize(600,300);
JPanel quotes = new JPanel();
add(quotes, BorderLayout.WEST);
JLabel quoteimg = new JLabel(new ImageIcon(Toolkit.getDefaultToolkit().createImage(Diary.class.getResource("quotesImg.jpg"))));
quoteimg.setLayout(new FlowLayout());
quotes.add(quoteimg);
quoteimg.add(l1);
quoteimg.add(l2);
quoteimg.add(showQuotes);
if(now < 21)
setTitle("Diary of a Space Marine");
else if(now < 41){
setTitle("Memoirs of Chaos");
remove(background);
background=new JLabel(new ImageIcon(Toolkit.getDefaultToolkit().createImage(Diary.class.getResource("chaos.jpg"))));
setSize(399,399);
setSize(600,300);
add(background);}
pack();
//Thread pauses the program and then stops it after 15 secs
Thread thread = new Thread() {
public void run(){
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.exit(0);
}
};
thread.run();
}
public double showthis()
{
double finalNum;
do{
finalNum = Math.random() * 100;
}while(finalNum >= 41 );
return finalNum;
}
}