mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-25 04:04:25 +00:00
Compare commits
9
Commits
1.0.2
...
GUI-archive
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
546caf028a | ||
|
|
d27b24fbde | ||
|
|
3600a7c5bf | ||
|
|
504a598428 | ||
|
|
e6f7618071 | ||
|
|
20a2dda540 | ||
|
|
57725f2c7a | ||
|
|
dc057ae7af | ||
|
|
c2e4235227 |
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,22 +2,36 @@ package idv.jlchntoz;
|
||||
|
||||
import idv.jlchntoz.gui.MainFrame;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class CustomSkinLoaderGUI {
|
||||
|
||||
public static final String VERSION ="1.0.2";
|
||||
public static final String VERSION ="1.1.1";
|
||||
|
||||
public static final Logger log=Logger.getLogger("CustomSkinLoader-GUI");
|
||||
public static final File LCK=new File("GUI.lck");
|
||||
private static final long SECONDS=30;
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.info("Thanks for using CustomSkinLoader!");
|
||||
log.info("Version "+VERSION+" !");
|
||||
MainFrame mf=new MainFrame();
|
||||
mf.init(args);
|
||||
|
||||
|
||||
|
||||
long dt=System.currentTimeMillis()-SECONDS*1000;
|
||||
if(LCK.exists()&&LCK.lastModified()>=dt){
|
||||
log.info("Sorry! GUI has already been running!");
|
||||
log.info("If you believe it is a mistake, please delete 'GUI.lck'.");
|
||||
}else{
|
||||
LCK.delete();
|
||||
try {
|
||||
LCK.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LCK.deleteOnExit();
|
||||
MainFrame mf=new MainFrame();
|
||||
mf.init(args);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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(Version compareVersion){
|
||||
return longVersion>compareVersion.getLongVersion();
|
||||
}
|
||||
public boolean isNewerThan(String compareVersion){
|
||||
return longVersion>getLongVersion(compareVersion);
|
||||
}
|
||||
|
||||
public boolean isNewerThanOrEquals(Version compareVersion){
|
||||
return longVersion>=compareVersion.getLongVersion();
|
||||
}
|
||||
public boolean isNewerThanOrEquals(String compareVersion){
|
||||
return longVersion>=getLongVersion(compareVersion);
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.Language;
|
||||
import idv.jlchntoz.lang.DefaultLang;
|
||||
|
||||
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 DefaultLang lang=Language.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]+"\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()+"\n";
|
||||
for(int i=0;i<urls.length;i++)
|
||||
temp+=urls[i]+"\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");
|
||||
try {
|
||||
a.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
write(a.getAbsolutePath(),data);
|
||||
}
|
||||
|
||||
public static boolean write(String FileName,String Data){
|
||||
FileWriter fw=null;
|
||||
try{
|
||||
fw = new FileWriter(FileName);
|
||||
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 += "\n"+br.readLine();
|
||||
}
|
||||
br.close();
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.Language;
|
||||
import idv.jlchntoz.lang.DefaultLang;
|
||||
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;
|
||||
|
||||
@@ -14,7 +18,19 @@ import javax.swing.JLabel;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class MainFrame {
|
||||
private static DefaultLang lang=Language.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) {
|
||||
|
||||
@@ -22,57 +38,111 @@ 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(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);
|
||||
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
jf.setResizable(false);
|
||||
|
||||
if(args.length>=3&&args[2].equalsIgnoreCase("in")){
|
||||
jf.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
|
||||
}else{
|
||||
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
}
|
||||
jf.setResizable(false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package idv.jlchntoz.gui;
|
||||
|
||||
import idv.jlchntoz.lang.Language;
|
||||
import idv.jlchntoz.lang.DefaultLang;
|
||||
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;
|
||||
@@ -21,12 +22,14 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
public class SkinFrame {
|
||||
private static DefaultLang lang=Language.getLanguage();
|
||||
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",
|
||||
"http://s3.amazonaws.com/MinecraftSkins/*.png",
|
||||
"#MineCrack",
|
||||
"http://minecrack.fr.nf/mc/skinsminecrackd/*.png",
|
||||
/*
|
||||
@@ -37,33 +40,84 @@ public class SkinFrame {
|
||||
"#SkinMe",
|
||||
"http://www.skinme.cc:88/MinecraftSkins/*.png"
|
||||
|
||||
};
|
||||
public static final String[] urls1={
|
||||
"#"+lang.minecraftOffical(),
|
||||
"http://skins.minecraft.net/MinecraftCloaks/*.png",
|
||||
"http://s3.amazonaws.com/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(){ //单击事件
|
||||
defaultBtn.addActionListener(new ActionListener(){
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp="";
|
||||
@@ -74,41 +128,61 @@ 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(){ //单击事件
|
||||
urlBtn.addActionListener(new ActionListener(){
|
||||
@Override
|
||||
public void actionPerformed (ActionEvent e){
|
||||
String temp=skinList.getText()+"\r\n";
|
||||
if(temp.equalsIgnoreCase("\r\n")){
|
||||
temp="";
|
||||
}
|
||||
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);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -118,40 +192,49 @@ public class SkinFrame {
|
||||
|
||||
}
|
||||
|
||||
public static void save(String data){
|
||||
File a=new File("skinurls.txt");
|
||||
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();
|
||||
}
|
||||
write(a.getAbsolutePath(),data);
|
||||
if(!MainFrame.useDataFolder)
|
||||
write(a,data);
|
||||
if(b.exists())
|
||||
write(b,data);
|
||||
}
|
||||
|
||||
public static boolean write(String FileName,String Data){
|
||||
FileWriter fw=null;
|
||||
try{
|
||||
fw = new FileWriter(FileName);
|
||||
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){
|
||||
private static boolean write(File file,String Data){
|
||||
System.out.println("Write to "+file.getAbsolutePath());
|
||||
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;
|
||||
}
|
||||
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 += "\n"+br.readLine();
|
||||
data += "\r\n"+br.readLine();
|
||||
}
|
||||
br.close();
|
||||
return data;
|
||||
br.close();
|
||||
return data;
|
||||
} catch (Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,61 +1,50 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
|
||||
public class ChineseSimpLang extends DefaultLang {
|
||||
@Override
|
||||
public class ChineseSimpLang implements ILanguage {
|
||||
public String title(){
|
||||
return "自定义皮肤加载器";
|
||||
}
|
||||
@Override
|
||||
public String gui(){
|
||||
return " 图形化界面";
|
||||
}
|
||||
@Override
|
||||
public String index(){
|
||||
return " 索引";
|
||||
}
|
||||
@Override
|
||||
public String first1(){
|
||||
return "这是您第一次使用自定义皮肤加载器!";
|
||||
}
|
||||
@Override
|
||||
public String first2(){
|
||||
return "请点击下列按钮以修改设置!";
|
||||
}
|
||||
@Override
|
||||
public String skin(){
|
||||
return "皮肤";
|
||||
}
|
||||
@Override
|
||||
public String cloak(){
|
||||
return "披风";
|
||||
}
|
||||
@Override
|
||||
public String loadList(){
|
||||
return "加载列表";
|
||||
}
|
||||
@Override
|
||||
public String minecraftOffical(){
|
||||
return "Minecraft 官方[正版]";
|
||||
}
|
||||
@Override
|
||||
public String useDefault(){
|
||||
return "使用默认(官方)";
|
||||
}
|
||||
@Override
|
||||
public String useRecommended(){
|
||||
return "使用推荐";
|
||||
}
|
||||
@Override
|
||||
public String save(){
|
||||
return "保存";
|
||||
}
|
||||
@Override
|
||||
public String saved(){
|
||||
return "已保存,请重新启动游戏!";
|
||||
}
|
||||
@Override
|
||||
public String close(){
|
||||
return "关闭";
|
||||
}
|
||||
public String yourVersion(){
|
||||
return "您的皮肤模组版本:";
|
||||
}
|
||||
}
|
||||
@@ -1,61 +1,50 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
|
||||
public class ChineseTranLang extends DefaultLang {
|
||||
@Override
|
||||
public class ChineseTranLang implements ILanguage {
|
||||
public String title(){
|
||||
return "萬用皮膚模組";
|
||||
}
|
||||
@Override
|
||||
public String gui(){
|
||||
return " 用戶界面";
|
||||
}
|
||||
@Override
|
||||
public String index(){
|
||||
return " 目錄";
|
||||
}
|
||||
@Override
|
||||
public String first1(){
|
||||
return "這是您第一次使用本模組!";
|
||||
}
|
||||
@Override
|
||||
public String first2(){
|
||||
return "請單擊下列按鈕進行配置修改!";
|
||||
}
|
||||
@Override
|
||||
public String skin(){
|
||||
return "皮膚";
|
||||
}
|
||||
@Override
|
||||
public String cloak(){
|
||||
return "披風";
|
||||
}
|
||||
@Override
|
||||
public String loadList(){
|
||||
return "加載列表";
|
||||
}
|
||||
@Override
|
||||
public String minecraftOffical(){
|
||||
return "Minecraft 官方[正版]";
|
||||
}
|
||||
@Override
|
||||
public String useDefault(){
|
||||
return "使用默認(官方)";
|
||||
}
|
||||
@Override
|
||||
public String useRecommended(){
|
||||
return "使用推薦";
|
||||
}
|
||||
@Override
|
||||
public String save(){
|
||||
return "保存";
|
||||
}
|
||||
@Override
|
||||
public String saved(){
|
||||
return "已保存,請重新開啟遊戲!";
|
||||
}
|
||||
@Override
|
||||
public String close(){
|
||||
return "關閉";
|
||||
}
|
||||
public String yourVersion(){
|
||||
return "您的皮膚模組版本:";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
public class DefaultLang {
|
||||
public class EnglishLang implements ILanguage{
|
||||
public String title(){
|
||||
return "CustomSkinLoader";
|
||||
}
|
||||
@@ -43,4 +43,7 @@ public class DefaultLang {
|
||||
public String close(){
|
||||
return "Close";
|
||||
}
|
||||
public String yourVersion(){
|
||||
return "Your CustomSkinLoader Version:";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package idv.jlchntoz.lang;
|
||||
|
||||
public interface ILanguage {
|
||||
public String title();
|
||||
public String gui();
|
||||
public String index();
|
||||
public String first1();
|
||||
public String first2();
|
||||
public String skin();
|
||||
public String cloak();
|
||||
public String loadList();
|
||||
public String minecraftOffical();
|
||||
public String useDefault();
|
||||
public String useRecommended();
|
||||
public String save();
|
||||
public String saved();
|
||||
public String close();
|
||||
public String yourVersion();
|
||||
}
|
||||
@@ -2,22 +2,25 @@ package idv.jlchntoz.lang;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Language {
|
||||
|
||||
public static DefaultLang getLanguage(){
|
||||
public class LangManager {
|
||||
public static String langCode="en";
|
||||
public static ILanguage getLanguage(){
|
||||
Locale locale = Locale.getDefault();
|
||||
String l=locale.getLanguage().toLowerCase();
|
||||
String c=locale.getCountry().toLowerCase();
|
||||
if(l.equalsIgnoreCase("zh")){
|
||||
if(c.equalsIgnoreCase("cn")){
|
||||
//zh_cn
|
||||
langCode="zh_cn";
|
||||
return new ChineseSimpLang();
|
||||
}
|
||||
//zh
|
||||
langCode="zh";
|
||||
return new ChineseTranLang();
|
||||
}
|
||||
//en
|
||||
return new DefaultLang();
|
||||
langCode="en";
|
||||
return new EnglishLang();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user