zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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;
    }
}