public class Xerxes
{
private JFrame vonbraun;
private JPanel vonbraunPanel;
private JTabbedPane planets;
private ReadCfg readcfg;
private ReadInstallCfg readinstallcfg;
private ReadShockCfg readshockcfg;
private ReadCamCfg readcamcfg;
private ReadUserCfg readusercfg;
private ReadUserBnd readuserbnd;
private XerxesMain xerxesmain;
private XerxesMonster xerxesmonster;
private XerxesChat1 xerxeschat1;
private XerxesChat2 xerxeschat2;
private XerxesChat3 xerxeschat3;
private XerxesChat4 xerxeschat4;
private XerxesChat5 xerxeschat5;
private XerxesChat6 xerxeschat6;
private XerxesChat7 xerxeschat7;
private XerxesChat8 xerxeschat8;
private XerxesHelp xerxeshelp;
private XerxesInfo xerxesinfo;
private XerxesButton xerxesbutton;
private String version = "3.03.49";
private Toolkit tk;
private int ausgewaehlt;
private int ausgewaehltold;
public XerxesButton getXerxesbutton() {
return xerxesbutton;
}
public void setXerxesbutton(XerxesButton xerxesbutton) {
this.xerxesbutton = xerxesbutton;
}
public JTabbedPane getPlanets() {
return planets;
}
public void setPlanets(JTabbedPane planets) {
this.planets = planets;
}
public String getVersion()
{
return version;
}
@SuppressWarnings("static-access")
public Xerxes(SetRes setres)
{
try
{
UIManager.setLookAndFeel(new MyLookAndFeel());
}
catch(UnsupportedLookAndFeelException e)
{
e.printStackTrace();
}
UIManager.put("OptionPane.background",new ColorUIResource(Color.black));
UIManager.put("Panel.background", Color.black);
UIManager.put("OptionPane.errorDialog.border.background", Color.black);
UIManager.put("OptionPane.errorDialog.titlePane.background", Color.black);
UIManager.put("OptionPane.errorDialog.titlePane.foreground", Color.green);
UIManager.put("OptionPane.errorDialog.titlePane.shadow", Color.black);
UIManager.put("OptionPane.foreground", Color.green);
UIManager.put("OptionPane.messageForeground", Color.green);
UIManager.put("OptionPane.questionDialog.border.background", Color.black);
UIManager.put("OptionPane.questionDialog.titlePane.background",Color.black);
UIManager.put("OptionPane.questionDialog.titlePane.foreground",Color.green);
UIManager.put("OptionPane.questionDialog.titlePane.shadow", Color.black);
UIManager.put("OptionPane.warningDialog.border.background", Color.black);
UIManager.put("OptionPane.warningDialog.titlePane.background", Color.black);
UIManager.put("OptionPane.warningDialog.titlePane.foreground", Color.green);
UIManager.put("OptionPane.warningDialog.titlePane.shadow", Color.black);
UIManager.put("Boreder.foreground", Color.GREEN);
UIManager.put("Boreder.background", Color.BLACK);
UIManager.put("Button.foreground", Color.GREEN);
UIManager.put("Button.background", Color.BLACK);
UIManager.put("Button.foreground", Color.GREEN);
UIManager.put("activeCaption", new javax.swing.plaf.ColorUIResource(Color.GREEN));
UIManager.put("inactiveCaption", new javax.swing.plaf.ColorUIResource(Color.GREEN));
Border border = BorderFactory.createLineBorder(Color.GREEN);
UIManager.put("Button.border", border);
//Thx to gnartsch
UIManager.put("TabbedPane.foreground", Color.green);
UIManager.put("TabbedPane.background", Color.black);
UIManager.put("TabbedPane.selected", Color.green);
UIManager.put("TabbedPane.focus", Color.green);
UIManager.put("TabbedPane.light", Color.green);
UIManager.put("TabbedPane.darkShadow", Color.green);
UIManager.put("TabbedPane.selectHighlight", Color.green);
JFrame.setDefaultLookAndFeelDecorated(true);
javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme(new NoBumpsTheme());
try{UIManager.setLookAndFeel(new MyLookAndFeel());}
catch(UnsupportedLookAndFeelException e){e.printStackTrace();}
UIManager.put("activeCaption", new javax.swing.plaf.ColorUIResource(Color.black));
UIManager.put("activeCaptionText", new javax.swing.plaf.ColorUIResource(Color.green));
vonbraun = new JFrame("System Sock 2 " + getVersion());
//Thx to gnartsch and [url=http://www.java-forum.org]Java Forum: Java-Forum.org[/url]
URL filename = getClass().getResource("Icon.jpg");
vonbraun.setIconImage(tk.getDefaultToolkit().getImage(filename));
changeButtonColor(vonbraun.getComponents());
vonbraun.getContentPane().setBackground(Color.green);
vonbraun.getRootPane().setBorder(BorderFactory.createLineBorder(Color.green,3));
vonbraun.setBackground(Color.black);
vonbraun.setForeground(Color.green);
vonbraun.setLayout( new BorderLayout());
vonbraunPanel = new JPanel();
vonbraun.add(vonbraunPanel, BorderLayout.NORTH);
vonbraunPanel.setBackground(Color.black);
vonbraunPanel.setForeground(Color.green);
vonbraunPanel.setBorder(BorderFactory.createLineBorder(Color.green));
vonbraunPanel.setOpaque(true);
readcfg = new ReadCfg(setres);
readusercfg = new ReadUserCfg(setres, readcfg.getreadpath());
readinstallcfg = new ReadInstallCfg(setres, readcfg.getreadpath());
readshockcfg = new ReadShockCfg(setres, readcfg.getreadpath());
readcamcfg = new ReadCamCfg(setres, readcfg.getreadpath());
readuserbnd = new ReadUserBnd(setres, readcfg.getreadpath());
setPlanets(new JTabbedPane(JTabbedPane.BOTTOM));
getPlanets().setUI(new javax.swing.plaf.metal.MetalTabbedPaneUI()
{
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex){}
});
getPlanets().addTab(setres.getTxt().getString("MainTab"), xerxesmain = new XerxesMain(setres, readcfg, readusercfg, readshockcfg, readcamcfg, readinstallcfg));
getPlanets().addTab(setres.getTxt().getString("MonsterTab"), xerxesmonster = new XerxesMonster(setres, readusercfg));
getPlanets().addTab(setres.getTxt().getString("Chat1Tab"), xerxeschat1 = new XerxesChat1(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat2Tab"), xerxeschat2 = new XerxesChat2(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat3Tab"), xerxeschat3 = new XerxesChat3(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat4Tab"), xerxeschat4 = new XerxesChat4(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat5Tab"), xerxeschat5 = new XerxesChat5(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat6Tab"), xerxeschat6 = new XerxesChat6(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat7Tab"), xerxeschat7 = new XerxesChat7(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("Chat8Tab"), xerxeschat8 = new XerxesChat8(setres, readuserbnd));
getPlanets().addTab(setres.getTxt().getString("HelpTab"), xerxeshelp = new XerxesHelp(setres, this));
getPlanets().addTab(setres.getTxt().getString("InfoTab"), xerxesinfo = new XerxesInfo(setres, this));
vonbraunPanel.add(getPlanets());
getPlanets().setBackground(Color.BLACK);
getPlanets().setForeground(Color.GREEN);
getPlanets().setBorder(BorderFactory.createLineBorder(Color.green));
UIManager.put("JTabbedPane.font", new Font("Dialog", Font.ITALIC, 12));
UIManager.put("JTabbedPane.focus", Color.BLACK);
getPlanets().setBackgroundAt(0, Color.BLACK);
getPlanets().setBackgroundAt(1, Color.BLACK);
getPlanets().setBackgroundAt(2, Color.BLACK);
getPlanets().setBackgroundAt(3, Color.BLACK);
getPlanets().setBackgroundAt(4, Color.BLACK);
getPlanets().setBackgroundAt(5, Color.BLACK);
getPlanets().setBackgroundAt(6, Color.BLACK);
getPlanets().setBackgroundAt(7, Color.BLACK);
getPlanets().setBackgroundAt(8, Color.BLACK);
getPlanets().setBackgroundAt(9, Color.BLACK);
getPlanets().setBackgroundAt(10, Color.BLACK);
getPlanets().setBackgroundAt(11, Color.BLACK);
getPlanets().setForegroundAt(0, Color.GREEN);
getPlanets().setForegroundAt(1, Color.GREEN);
getPlanets().setForegroundAt(2, Color.GREEN);
getPlanets().setForegroundAt(3, Color.GREEN);
getPlanets().setForegroundAt(4, Color.GREEN);
getPlanets().setForegroundAt(5, Color.GREEN);
getPlanets().setForegroundAt(6, Color.GREEN);
getPlanets().setForegroundAt(7, Color.GREEN);
getPlanets().setForegroundAt(8, Color.GREEN);
getPlanets().setForegroundAt(9, Color.GREEN);
getPlanets().setForegroundAt(10, Color.GREEN);
getPlanets().setForegroundAt(11, Color.GREEN);
//Thanx to gnartsch
getPlanets().setForegroundAt(getPlanets().getSelectedIndex(), Color.BLACK);
getPlanets().setBackgroundAt(getPlanets().getSelectedIndex(), Color.GREEN);
ausgewaehlt = ausgewaehltold = getPlanets().getSelectedIndex();
//Thx to gnartsch
ChangeListener changeListener = new ChangeListener()
{
public void stateChanged(ChangeEvent changeEvent)
{
JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
ausgewaehltold = ausgewaehlt;
ausgewaehlt = sourceTabbedPane.getSelectedIndex();
getPlanets().setForegroundAt(getPlanets().getSelectedIndex(), Color.BLACK);
getPlanets().setBackgroundAt(getPlanets().getSelectedIndex(), Color.GREEN);
getPlanets().setForegroundAt(ausgewaehltold, Color.GREEN);
getPlanets().setBackgroundAt(ausgewaehltold, Color.BLACK);
}
};
getPlanets().addChangeListener(changeListener);
setXerxesbutton(new XerxesButton(setres, this, xerxesmain, xerxesmonster, xerxeschat1, xerxeschat2, xerxeschat3, xerxeschat4, xerxeschat5, xerxeschat6, xerxeschat7, xerxeschat8, xerxeshelp, xerxesinfo, readcfg, vonbraun));
if(readcfg.getIniLanguage().equals("GERMAN"))
vonbraun.setSize(800,480);
else
vonbraun.setSize(860,480);
vonbraun.getContentPane().setBackground(Color.black);
vonbraun.getContentPane().setForeground(Color.green);
vonbraun.setResizable(false);
vonbraun.setVisible(true);
vonbraun.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
//by MD
public void changeButtonColor(Component[] comps)
{
for(int x=0, y=comps.length; x<y; x++)
{
if(comps[x] instanceof AbstractButton)
{
((AbstractButton)comps[x]).setBackground(Color.black);
((AbstractButton)comps[x]).setBorder(BorderFactory.createLineBorder(Color.green));
}
else if(comps[x] instanceof Container)
{
changeButtonColor(((Container)comps[x]).getComponents());
}
}
}
}
class GreenMetalTheme extends javax.swing.plaf.metal.DefaultMetalTheme
{
public javax.swing.plaf.ColorUIResource getPrimaryControlHighlight(){ return new javax.swing.plaf.ColorUIResource(Color.green);}
public javax.swing.plaf.ColorUIResource getPrimaryControlDarkShadow(){ return new javax.swing.plaf.ColorUIResource(Color.green);}
public javax.swing.plaf.ColorUIResource getPrimaryControl(){ return new javax.swing.plaf.ColorUIResource(Color.black);}
public javax.swing.plaf.ColorUIResource getPrimaryControlInfo(){ return new javax.swing.plaf.ColorUIResource(Color.green);}
}