package Frame;
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.Container;
|
import java.awt.Font;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import javax.swing.ComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.ImageIcon;
|
import javax.swing.JComboBox;
|
import javax.swing.JPanel;
|
|
import PbuliClass.GetStyles;
|
import PbuliClass.JButtonModel;
|
import PbuliClass.JlableModel;
|
import PbuliClass.ReadFiles;
|
import PbuliClass.ShowMessage;
|
import PbuliClass.Systems;
|
import PbuliClass.jinternalFrame;
|
/**¸ÃÀàÓÃÓÚÑ¡Ôñϵͳ·ç¸ñ*/
|
public class StyleChoose extends jinternalFrame {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
JPanel mb1=null;
|
JComboBox<String> choose=null;//Ñ¡Ôñ·ç¸ñÏÂÀ¿ò
|
JButtonModel sure=null;//È·¶¨°´Å¥
|
JButtonModel restore=null;//»Ö¸´ÏµÍ³Ä¬ÈÏÉèÖÃ
|
|
public StyleChoose() {
|
String title="Ñ¡Ôñϵͳ·ç¸ñ";
|
if(Systems.sys().getLanguage().equals("English")) {
|
title="System style Site";
|
}
|
this.setTitle(title);
|
Container rq=getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(Color.white);
|
rq.add(getMb1(),BorderLayout.CENTER);
|
this.setFrameIcon(new ImageIcon("image/icon/styleicon.png"));//ÉèÖô°Ìåͼ±ê
|
|
}
|
|
public JPanel getMb1() {
|
if(mb1==null) {
|
mb1=new JPanel();
|
mb1.setLayout(null);
|
mb1.setBackground(Color.WHITE);
|
JlableModel name1= new JlableModel("Çл»ÏµÍ³·ç¸ñ: ");
|
name1.setBounds(250, 70, 100, 25);
|
mb1.add(name1);
|
mb1.add(getChoose());
|
mb1.add(getSure());
|
mb1.add(getRestore());
|
|
}
|
return mb1;
|
}
|
|
|
|
|
public JButtonModel getSure() {
|
if(sure==null) {
|
sure=new JButtonModel("È·¶¨ÐÞ¸Ä");
|
sure.setBounds(250,140,80, 25);
|
sure.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
String name=(String)choose.getSelectedItem();
|
String zhi=GetStyles.getZhi(name);
|
String np="style:"+zhi.trim()+":\n";
|
String path="systemFiles/style.txt";
|
ReadFiles.wirteTxt(path, np);
|
ShowMessage.xiu_gai();
|
}
|
});
|
|
}
|
return sure;
|
}
|
|
|
public JButtonModel getRestore() {
|
if(restore==null) {
|
restore=new JButtonModel("»Ö¸´Ä¬ÈÏÉèÖÃ");
|
restore.setBounds(350, 140, 110, 25);
|
restore.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
String np="javax.swing.plaf.metal.MetalLookAndFeel:\n";
|
String path="systemFiles/style.txt";
|
ReadFiles.wirteTxt(path, np);
|
ShowMessage.xiu_gai();
|
}
|
});
|
|
}
|
return restore;
|
}
|
|
public JComboBox<String> getChoose(){
|
if(choose==null) {
|
choose=new JComboBox<String>();
|
choose.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 14));//ÉèÖÃ×ÖÌå
|
ComboBoxModel<String> coModel=new DefaultComboBoxModel<>(GetStyles.getStleNames());//ÏÂÀÁбíÄ£ÐÍ
|
choose.setModel(coModel);
|
choose.setSelectedIndex(0);
|
choose.setBounds(350, 70, 200, 25);
|
}
|
return choose;
|
}
|
}
|