mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-19 21:09:37 +00:00
Better looking GUI
This commit is contained in:
1 parent
3600a7c5bf
commit
d27b24fbde
7 files changed
+233
-227
No files matched your search
Binary file not shown.
@@ -8,7 +8,7 @@ import java.util.logging.Logger;
|
||||
|
||||
public class CustomSkinLoaderGUI {
|
||||
|
||||
public static final String VERSION ="1.0.8";
|
||||
public static final String VERSION ="1.1.0";
|
||||
|
||||
public static final Logger log=Logger.getLogger("CustomSkinLoader-GUI");
|
||||
public static final File LCK=new File("GUI.lck");
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package idv.jlchntoz;
|
||||
|
||||
public class Version {
|
||||
private String version;
|
||||
private long longVersion;
|
||||
public Version(String version){
|
||||
this.version=version;
|
||||
longVersion=getLongVersion(version);
|
||||
}
|
||||
private long getLongVersion(String version){
|
||||
String[] temp=version.split("\\.");
|
||||
//System.out.println(version);
|
||||
long multi=1;
|
||||
long temp1=0;
|
||||
for(int i=temp.length-1;i>=0;i--){
|
||||
//System.out.println(temp[i]);
|
||||
temp1+=Integer.parseInt(temp[i])*multi;
|
||||
multi*=100;
|
||||
}
|
||||
//System.out.println(temp1);
|
||||
return temp1;
|
||||
}
|
||||
public String getVersion(){
|
||||
return version;
|
||||
}
|
||||
public long getLongVersion(){
|
||||
return longVersion;
|
||||
}
|
||||
public boolean isNewerThan(String compareVersion){
|
||||
return longVersion>getLongVersion(compareVersion);
|
||||
}
|
||||
public boolean isNewerThanOrEquals(String compareVersion){
|
||||
return longVersion>=getLongVersion(compareVersion);
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.ILanguage;
|
||||
import idv.jlchntoz.lang.LangManager;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class CloakFrame {
|
||||
private static ILanguage lang=LangManager.getLanguage();
|
||||
public static boolean mod=false;
|
||||
public static final String[] urls={
|
||||
"#"+lang.minecraftOffical(),
|
||||
"http://s3.amazonaws.com/MinecraftCloaks/*.png",
|
||||
"http://skins.minecraft.net/MinecraftCloaks/*.png",
|
||||
"#MineCrack",
|
||||
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
|
||||
/*
|
||||
* XFL03's Skin Website Closed
|
||||
"#OpenSkin",
|
||||
"http://skin.axdt.net/MinecraftCloaks/*.png",
|
||||
*/
|
||||
"#SkinMe",
|
||||
"http://www.skinme.cc:88/MinecraftCloaks/*.png"
|
||||
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
final JFrame jf = new JFrame (lang.title()+" - "+lang.cloak()+lang.loadList());
|
||||
Container con = jf.getContentPane();
|
||||
con.setLayout(null);
|
||||
//setBounds(x,y,width,height)
|
||||
jf.setBounds(400, 200, 515, 420);
|
||||
|
||||
Font boldCourier=new Font("Courier", Font.BOLD, 30);
|
||||
|
||||
JLabel title=new JLabel();
|
||||
title.setText(lang.cloak()+lang.loadList());
|
||||
title.setFont(boldCourier);
|
||||
title.setBounds(130, 5, 370, 30);
|
||||
con.add(title);
|
||||
|
||||
final JTextArea cloakList=new JTextArea();
|
||||
cloakList.setBounds(15, 40, 470, 266);
|
||||
con.add(cloakList);
|
||||
cloakList.setText(read("capeurls.txt"));
|
||||
|
||||
JButton defaultBtn=new JButton();
|
||||
defaultBtn.setText(lang.useDefault());
|
||||
defaultBtn.setBounds(15, 310, 235, 30);
|
||||
con.add(defaultBtn);
|
||||
defaultBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp="";
|
||||
for(int i=0;i<=2;i++)
|
||||
temp+=urls[i]+"\r\n";
|
||||
cloakList.setText(temp);
|
||||
};
|
||||
});
|
||||
JButton urlBtn=new JButton();
|
||||
urlBtn.setText(lang.useRecommended());
|
||||
urlBtn.setBounds(250, 310, 235, 30);
|
||||
con.add(urlBtn);
|
||||
urlBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp=cloakList.getText()+"\r\n";
|
||||
if(temp.equalsIgnoreCase("\r\n"))
|
||||
temp="";
|
||||
for(int i=0;i<urls.length;i++)
|
||||
temp+=urls[i]+"\r\n";
|
||||
cloakList.setText(temp);
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
JButton skinBtn=new JButton();
|
||||
skinBtn.setText(lang.save());
|
||||
skinBtn.setBounds(15, 350, 235, 30);
|
||||
con.add(skinBtn);
|
||||
skinBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
save(cloakList.getText());
|
||||
JOptionPane.showMessageDialog(null,lang.saved());
|
||||
};
|
||||
});
|
||||
|
||||
JButton clokeBtn=new JButton();
|
||||
clokeBtn.setText(lang.close());
|
||||
clokeBtn.setBounds(250, 350, 235, 30);
|
||||
con.add(clokeBtn);
|
||||
clokeBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
jf.setVisible(false);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
jf.setVisible(true);
|
||||
jf.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
|
||||
jf.setResizable(false);
|
||||
|
||||
}
|
||||
|
||||
public static void save(String data){
|
||||
File a=new File("capeurls.txt");
|
||||
File b=new File("CustomSkinLoader/capeurls.txt");
|
||||
try {
|
||||
a.createNewFile();
|
||||
b.createNewFile();
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
write(a,data);
|
||||
if(b.exists())
|
||||
write(b,data);
|
||||
}
|
||||
|
||||
public static boolean write(File file,String Data){
|
||||
FileWriter fw=null;
|
||||
try{
|
||||
fw = new FileWriter(file);
|
||||
fw.write(Data,0,Data.length());
|
||||
fw.flush();
|
||||
fw.close();
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static String read(String FileName){
|
||||
BufferedReader br = null;
|
||||
String data="";
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(FileName));
|
||||
data = br.readLine();
|
||||
while( br.ready()){
|
||||
data += "\r\n"+br.readLine();
|
||||
}
|
||||
br.close();
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.Version;
|
||||
import idv.jlchntoz.lang.ILanguage;
|
||||
import idv.jlchntoz.lang.LangManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
@@ -16,7 +18,19 @@ import javax.swing.JLabel;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class MainFrame {
|
||||
private static ILanguage lang=LangManager.getLanguage();
|
||||
private static final ILanguage lang=LangManager.getLanguage();
|
||||
public Version patchVersion=new Version("1.0");
|
||||
public static boolean useDataFolder=false;
|
||||
|
||||
public static final Color bg2=new Color(244, 243, 222, 255);
|
||||
public static final Color bg3=new Color(190, 173, 146, 150);
|
||||
public static final Color bg5=new Color(91, 73, 70, 255);
|
||||
|
||||
public static final Font defaultBigFont=new Font("΢ÈíÑźÚ", Font.BOLD, 30);
|
||||
public static final Font defaultSmallFont=new Font("΢ÈíÑźÚ", Font.PLAIN, 15);
|
||||
public static final Font defaultSmallerFont=new Font("΢ÈíÑźÚ", Font.PLAIN, 13);
|
||||
public static final Font englishBigFont=new Font("Comic Sans MS", Font.BOLD, 30);
|
||||
public static final Font englishSmallFont=new Font("Comic Sans MS", Font.PLAIN, 15);
|
||||
|
||||
public void init(String[] args) {
|
||||
|
||||
@@ -24,61 +38,106 @@ public class MainFrame {
|
||||
Container con = jf.getContentPane();
|
||||
con.setLayout(null);
|
||||
//setBounds(x,y,width,height)
|
||||
jf.setBounds(400, 200, 400, 300);
|
||||
int windowWidth = 400;
|
||||
int windowHeight = 300;
|
||||
Toolkit kit = Toolkit.getDefaultToolkit();
|
||||
Dimension screenSize = kit.getScreenSize();
|
||||
int screenWidth = screenSize.width;
|
||||
int screenHeight = screenSize.height;
|
||||
jf.setBounds(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2,
|
||||
windowWidth , windowHeight);
|
||||
|
||||
Font boldCourier=new Font("Courier", Font.BOLD, 30);
|
||||
con.setBackground(bg2);
|
||||
|
||||
JLabel title=new JLabel();
|
||||
title.setForeground(bg5);
|
||||
title.setHorizontalAlignment(JLabel.CENTER);
|
||||
title.setText(lang.title()+lang.index());
|
||||
title.setFont(boldCourier);
|
||||
title.setBounds(15, 5, 370, 30);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
title.setFont(englishBigFont);
|
||||
else
|
||||
title.setFont(defaultBigFont);
|
||||
title.setBounds(15, 5, 370, 40);
|
||||
con.add(title);
|
||||
|
||||
if(args.length>0 && args[0].equalsIgnoreCase("f")){
|
||||
JLabel tip1=new JLabel();
|
||||
tip1.setForeground(bg5);
|
||||
tip1.setHorizontalAlignment(JLabel.CENTER);
|
||||
tip1.setText(lang.first1());
|
||||
tip1.setBounds(30, 55, 370, 15);
|
||||
tip1.setBounds(10, 50, 370, 20);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
tip1.setFont(englishSmallFont);
|
||||
else
|
||||
tip1.setFont(defaultSmallFont);
|
||||
con.add(tip1);
|
||||
|
||||
JLabel tip2=new JLabel();
|
||||
tip2.setForeground(bg5);
|
||||
tip2.setHorizontalAlignment(JLabel.CENTER);
|
||||
tip2.setText(lang.first2());
|
||||
tip2.setBounds(30, 70, 370, 15);
|
||||
tip2.setBounds(10, 70, 370, 20);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
tip2.setFont(englishSmallFont);
|
||||
else
|
||||
tip2.setFont(defaultSmallFont);
|
||||
con.add(tip2);
|
||||
}
|
||||
if(args.length>1){
|
||||
patchVersion=new Version(args[1]);
|
||||
if(patchVersion.isNewerThanOrEquals("12.1"))
|
||||
useDataFolder=true;
|
||||
JLabel tip3=new JLabel();
|
||||
tip3.setForeground(bg5);
|
||||
tip3.setHorizontalAlignment(JLabel.CENTER);
|
||||
tip3.setText(lang.yourVersion()+" "+args[1]);
|
||||
tip3.setBounds(30, 90, 370, 15);
|
||||
tip3.setBounds(10, 100, 370, 20);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
tip3.setFont(englishSmallFont);
|
||||
else
|
||||
tip3.setFont(defaultSmallFont);
|
||||
con.add(tip3);
|
||||
}
|
||||
|
||||
JButton skinBtn=new JButton();
|
||||
skinBtn.setForeground(bg5);
|
||||
skinBtn.setBackground(bg3);
|
||||
skinBtn.setText(lang.skin()+lang.loadList());
|
||||
skinBtn.setBounds(15, 180, 370, 30);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
skinBtn.setFont(englishSmallFont);
|
||||
else
|
||||
skinBtn.setFont(defaultSmallFont);
|
||||
con.add(skinBtn);
|
||||
skinBtn.addActionListener(new ActionListener(){ //µ¥»÷ʼþ
|
||||
skinBtn.addActionListener(new ActionListener(){
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String[] aa={};
|
||||
String[] aa={"skin"};
|
||||
SkinFrame.main(aa);
|
||||
};
|
||||
});
|
||||
|
||||
JButton clokeBtn=new JButton();
|
||||
clokeBtn.setText(lang.cloak()+lang.loadList());
|
||||
clokeBtn.setBounds(15, 215, 370, 30);
|
||||
con.add(clokeBtn);
|
||||
clokeBtn.addActionListener(new ActionListener(){ //µ¥»÷ʼþ
|
||||
JButton cloakBtn=new JButton();
|
||||
cloakBtn.setForeground(bg5);
|
||||
cloakBtn.setBackground(bg3);
|
||||
cloakBtn.setText(lang.cloak()+lang.loadList());
|
||||
cloakBtn.setBounds(15, 215, 370, 30);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
cloakBtn.setFont(englishSmallFont);
|
||||
else
|
||||
cloakBtn.setFont(defaultSmallFont);
|
||||
con.add(cloakBtn);
|
||||
cloakBtn.addActionListener(new ActionListener(){
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String[] aa={};
|
||||
CloakFrame.main(aa);
|
||||
String[] aa={"cape"};
|
||||
SkinFrame.main(aa);
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
jf.setVisible(true);
|
||||
if(args.length>=3&&args[2].equalsIgnoreCase("ingame")){
|
||||
if(args.length>=3&&args[2].equalsIgnoreCase("in")){
|
||||
jf.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
|
||||
}else{
|
||||
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
@@ -4,7 +4,8 @@ import idv.jlchntoz.lang.ILanguage;
|
||||
import idv.jlchntoz.lang.LangManager;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
@@ -23,7 +24,9 @@ import javax.swing.WindowConstants;
|
||||
public class SkinFrame {
|
||||
private static ILanguage lang=LangManager.getLanguage();
|
||||
public static boolean mod=false;
|
||||
public static final String[] urls={
|
||||
private static String to="skin";
|
||||
|
||||
public static final String[] urls0={
|
||||
"#"+lang.minecraftOffical(),
|
||||
"http://s3.amazonaws.com/MinecraftSkins/*.png",
|
||||
"http://skins.minecraft.net/MinecraftSkins/*.png",
|
||||
@@ -37,31 +40,83 @@ public class SkinFrame {
|
||||
"#SkinMe",
|
||||
"http://www.skinme.cc:88/MinecraftSkins/*.png"
|
||||
|
||||
};
|
||||
public static final String[] urls1={
|
||||
"#"+lang.minecraftOffical(),
|
||||
"http://s3.amazonaws.com/MinecraftCloaks/*.png",
|
||||
"http://skins.minecraft.net/MinecraftCloaks/*.png",
|
||||
"#Optifine",
|
||||
"http://s.optifine.net/capes/*.png",
|
||||
"#MineCrack",
|
||||
"http://minecrack.fr.nf/mc/cloaksminecrackd/*.png",
|
||||
/*
|
||||
* XFL03's Skin Website Closed
|
||||
"#OpenSkin",
|
||||
"http://skin.axdt.net/MinecraftCloaks/*.png",
|
||||
*/
|
||||
"#SkinMe",
|
||||
"http://www.skinme.cc:88/MinecraftCloaks/*.png"
|
||||
|
||||
};
|
||||
|
||||
public static void main(String[] args) {
|
||||
final JFrame jf = new JFrame (lang.title()+" - "+lang.skin()+lang.loadList());
|
||||
if(args.length>0)
|
||||
to=args[0];
|
||||
final String[] urls;
|
||||
String ti="";
|
||||
if(to.equalsIgnoreCase("cape")){
|
||||
urls=urls1;
|
||||
ti=lang.cloak();
|
||||
}else{
|
||||
urls=urls0;
|
||||
ti=lang.skin();
|
||||
}
|
||||
final JFrame jf = new JFrame (lang.title()+" - "+ti+lang.loadList());
|
||||
Container con = jf.getContentPane();
|
||||
con.setLayout(null);
|
||||
//setBounds(x,y,width,height)
|
||||
jf.setBounds(400, 200, 515, 420);
|
||||
|
||||
Font boldCourier=new Font("Courier", Font.BOLD, 30);
|
||||
con.setBackground(MainFrame.bg2);
|
||||
int windowWidth = 507;
|
||||
int windowHeight = 420;
|
||||
Toolkit kit = Toolkit.getDefaultToolkit();
|
||||
Dimension screenSize = kit.getScreenSize();
|
||||
int screenWidth = screenSize.width;
|
||||
int screenHeight = screenSize.height;
|
||||
jf.setBounds(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2,
|
||||
windowWidth , windowHeight);
|
||||
|
||||
JLabel title=new JLabel();
|
||||
title.setText(lang.skin()+lang.loadList());
|
||||
title.setFont(boldCourier);
|
||||
title.setBounds(130, 5, 370, 30);
|
||||
title.setForeground(MainFrame.bg5);
|
||||
title.setHorizontalAlignment(JLabel.CENTER);
|
||||
title.setText(ti+lang.loadList());
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
title.setFont(MainFrame.englishBigFont);
|
||||
else
|
||||
title.setFont(MainFrame.defaultBigFont);
|
||||
title.setBounds(10, 5, 480, 30);
|
||||
con.add(title);
|
||||
|
||||
final JTextArea skinList=new JTextArea();
|
||||
skinList.setBounds(15, 40, 470, 266);
|
||||
skinList.setBounds(15, 45, 470, 260);
|
||||
skinList.setFont(MainFrame.defaultSmallerFont);
|
||||
skinList.setForeground(MainFrame.bg5);
|
||||
con.add(skinList);
|
||||
skinList.setText(read("skinurls.txt"));
|
||||
File temp0=new File("CustomSkinLoader/"+to+"urls.txt");
|
||||
if(temp0.exists())
|
||||
skinList.setText(read(temp0));
|
||||
else{
|
||||
|
||||
skinList.setText(read(new File(""+to+"urls.txt")));
|
||||
}
|
||||
|
||||
JButton defaultBtn=new JButton();
|
||||
defaultBtn.setText(lang.useDefault());
|
||||
defaultBtn.setBounds(15, 310, 235, 30);
|
||||
defaultBtn.setBounds(15, 310, 233, 30);
|
||||
defaultBtn.setForeground(MainFrame.bg5);
|
||||
defaultBtn.setBackground(MainFrame.bg3);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
defaultBtn.setFont(MainFrame.englishSmallFont);
|
||||
else
|
||||
defaultBtn.setFont(MainFrame.defaultSmallFont);
|
||||
con.add(defaultBtn);
|
||||
defaultBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
@@ -74,7 +129,13 @@ public class SkinFrame {
|
||||
});
|
||||
JButton urlBtn=new JButton();
|
||||
urlBtn.setText(lang.useRecommended());
|
||||
urlBtn.setBounds(250, 310, 235, 30);
|
||||
urlBtn.setBounds(252, 310, 235, 30);
|
||||
urlBtn.setForeground(MainFrame.bg5);
|
||||
urlBtn.setBackground(MainFrame.bg3);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
urlBtn.setFont(MainFrame.englishSmallFont);
|
||||
else
|
||||
urlBtn.setFont(MainFrame.defaultSmallFont);
|
||||
con.add(urlBtn);
|
||||
urlBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
@@ -86,32 +147,43 @@ public class SkinFrame {
|
||||
for(int i=0;i<urls.length;i++)
|
||||
temp+=urls[i]+"\r\n";
|
||||
skinList.setText(temp);
|
||||
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
JButton skinBtn=new JButton();
|
||||
skinBtn.setText(lang.save());
|
||||
skinBtn.setBounds(15, 350, 235, 30);
|
||||
con.add(skinBtn);
|
||||
skinBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
JButton saveBtn=new JButton();
|
||||
saveBtn.setText(lang.save());
|
||||
saveBtn.setBounds(15, 350, 233, 30);
|
||||
saveBtn.setForeground(MainFrame.bg5);
|
||||
saveBtn.setBackground(MainFrame.bg3);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
saveBtn.setFont(MainFrame.englishSmallFont);
|
||||
else
|
||||
saveBtn.setFont(MainFrame.defaultSmallFont);
|
||||
con.add(saveBtn);
|
||||
saveBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
save(skinList.getText());
|
||||
JOptionPane.showMessageDialog(null,lang.saved());
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
JButton clokeBtn=new JButton();
|
||||
clokeBtn.setText(lang.close());
|
||||
clokeBtn.setBounds(250, 350, 235, 30);
|
||||
con.add(clokeBtn);
|
||||
clokeBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
JButton closeBtn=new JButton();
|
||||
closeBtn.setText(lang.close());
|
||||
closeBtn.setBounds(252, 350, 235, 30);
|
||||
closeBtn.setForeground(MainFrame.bg5);
|
||||
closeBtn.setBackground(MainFrame.bg3);
|
||||
if(LangManager.langCode.equalsIgnoreCase("en"))
|
||||
closeBtn.setFont(MainFrame.englishSmallFont);
|
||||
else
|
||||
closeBtn.setFont(MainFrame.defaultSmallFont);
|
||||
con.add(closeBtn);
|
||||
closeBtn.addActionListener(new ActionListener(){ //单击事件
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
jf.setVisible(false);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -121,22 +193,25 @@ public class SkinFrame {
|
||||
|
||||
}
|
||||
|
||||
public static void save(String data){
|
||||
File a=new File("skinurls.txt");
|
||||
File b=new File("CustomSkinLoader/skinurls.txt");
|
||||
System.out.println(b.getAbsolutePath());
|
||||
private static void save(String data){
|
||||
File a=new File(to+"urls.txt");
|
||||
File b=new File("CustomSkinLoader/"+to+"urls.txt");
|
||||
//System.out.println(b.getAbsolutePath());
|
||||
try {
|
||||
a.createNewFile();
|
||||
if(!MainFrame.useDataFolder)
|
||||
a.createNewFile();
|
||||
b.createNewFile();
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
}
|
||||
write(a,data);
|
||||
if(!MainFrame.useDataFolder)
|
||||
write(a,data);
|
||||
if(b.exists())
|
||||
write(b,data);
|
||||
}
|
||||
|
||||
public static boolean write(File file,String Data){
|
||||
private static boolean write(File file,String Data){
|
||||
System.out.println("Write to "+file.getAbsolutePath());
|
||||
FileWriter fw=null;
|
||||
try{
|
||||
fw = new FileWriter(file);
|
||||
@@ -149,11 +224,12 @@ public class SkinFrame {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static String read(String FileName){
|
||||
private static String read(File file){
|
||||
System.out.println("Read from "+file.getAbsolutePath());
|
||||
BufferedReader br = null;
|
||||
String data="";
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(FileName));
|
||||
br = new BufferedReader(new FileReader(file));
|
||||
data = br.readLine();
|
||||
while( br.ready()){
|
||||
data += "\r\n"+br.readLine();
|
||||
|
||||
@@ -3,7 +3,7 @@ package idv.jlchntoz.lang;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LangManager {
|
||||
|
||||
public static String langCode="en";
|
||||
public static ILanguage getLanguage(){
|
||||
Locale locale = Locale.getDefault();
|
||||
String l=locale.getLanguage().toLowerCase();
|
||||
@@ -11,12 +11,15 @@ public class LangManager {
|
||||
if(l.equalsIgnoreCase("zh")){
|
||||
if(c.equalsIgnoreCase("cn")){
|
||||
//zh_cn
|
||||
langCode="zh_cn";
|
||||
return new ChineseSimpLang();
|
||||
}
|
||||
//zh
|
||||
langCode="zh";
|
||||
return new ChineseTranLang();
|
||||
}
|
||||
//en
|
||||
langCode="en";
|
||||
return new EnglishLang();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user