package ui.component.menu;
import java.io.IOException;
import java.io.InputStream;
import xkit.XKit ;
import cize.ComponentBox ;
import ui.component.about.AboutCtrl;
/**
* @author Koen Roevens
*/
public class Menu {
/**
* Constructor
*/
private XKit x;
private Object parent;
public Menu(XKit x) throws IOException {
this(x, null, null);
}
public Menu(XKit x , ComponentBox c , Object parent) throws IOException {
this.x = x;
this.parent = parent;
if (c != null) {
c.parseComponent (getStream(), this , parent);
} else {
x.add(x.parse(getStream(), this));
}
}
private InputStream getStream () throws IOException {
return getClass().getResourceAsStream("menu.xml");
}
/**
* Listener method
*/
public void exit() {
System.exit(0);
}
/**
* Listener method
*/
public void defaultTheme() {
x.setColors(0xe6e6e6, 0x000000, 0xffffff,
0x909090, 0xb0b0b0, 0xededed, 0xb9b9b9, 0x89899a, 0xc5c5dd);
}
/**
* Listener method
*/
public void yellowTheme() {
x.setColors(0xeeeecc, 0x000000, 0xffffff,
0x999966, 0xb0b096, 0xededcb, 0xcccc99, 0xcc6600, 0xffcc66);
}
/**
* Listener method
*/
public void blueTheme() {
x.setColors(0x6375d6, 0xffffff, 0x7f8fdd,
0xd6dff5, 0x9caae5, 0x666666, 0x003399, 0xff3333, 0x666666);
}
/**
* Listener method
*/
public void about() {
new AboutCtrl(x,
x.getString(parent,"description") ,
x.getString(parent,"author"),
x.getString(parent,"email"));
}
}
|