📄 ptool.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: PTool.java
package paintchat.util;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import paintchat.PProperties;
// Referenced classes of package paintchat.util:
// AppletWatcher, Me_d
public class PTool
{
public static Frame main_frame = null;
private static Me_d me_d = null;
private static PProperties resource = null;
private static Boolean ja = null;
private static File file_current = null;
private static Color back;
private static Color fore = null;
private static Color cb;
private static Color cf;
private static Font font;
public static void appletViewer(String s, String s1, PProperties pproperties, boolean flag)
{
try
{
AppletWatcher appletwatcher = new AppletWatcher(s, s1, pproperties, flag);
appletwatcher.setVisible(true);
}
catch(Throwable throwable)
{
System.out.println("viewer" + throwable);
}
}
public static boolean copyFile(String s, String s1, boolean flag)
{
try
{
s = replaceText(s, '/', '\\');
s1 = replaceText(s1, '/', '\\');
File file = new File(s);
if(!file.isFile())
throw new FileNotFoundException();
File file1;
if(flag)
{
File file2 = new File(s1);
file2.mkdirs();
int j = s.lastIndexOf(47);
file1 = new File(file2, j != -1 ? s.substring(j + 1) : s);
} else
{
int i = s1.lastIndexOf(47);
if(i > 0)
(new File(s1.substring(i + 1))).mkdirs();
file1 = new File(s1);
}
BufferedInputStream bufferedinputstream = new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(file1));
byte abyte0[] = new byte[4000];
int k;
while((k = bufferedinputstream.read(abyte0)) != -1)
bufferedoutputstream.write(abyte0, 0, k);
bufferedoutputstream.flush();
bufferedoutputstream.close();
bufferedinputstream.close();
return true;
}
catch(IOException ioexception)
{
System.out.println("copy" + ioexception);
}
catch(RuntimeException runtimeexception)
{
System.out.println("copy" + runtimeexception);
}
return false;
}
public static File fileDialog(Window window, String s, boolean flag)
{
String s1;
String s2;
try
{
Frame frame = (window instanceof Frame) ? (Frame)window : getPFrame();
FileDialog filedialog = new FileDialog(frame, (flag ? "書き込む" : "読みこむ") + "ファイルを選択してください", flag ? 1 : 0);
if(s != null)
filedialog.setFile(s);
filedialog.setModal(true);
getDefComponents(filedialog);
filedialog.setVisible(true);
s1 = filedialog.getDirectory();
s2 = filedialog.getFile();
if(s2.equals("null") || s2.equals("null"))
return null;
}
catch(RuntimeException runtimeexception)
{
runtimeexception.printStackTrace();
return null;
}
return new File(s1, s2);
}
public static String getClipboard()
{
String s = null;
try
{
StringSelection stringselection = new StringSelection("");
Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(stringselection);
if(transferable != null)
s = (String)transferable.getTransferData(DataFlavor.stringFlavor);
}
catch(Exception _ex)
{
s = null;
}
return s != null ? s : "";
}
public static File getCurrent()
{
if(file_current == null)
file_current = new File(System.getProperty("user.dir"));
return file_current;
}
public static void getDefComponent(Component component)
{
if(fore == null)
{
font = getDefFont(-1, false);
back = new Color(0xffccccff);
cb = Color.white;
cf = new Color(0xff505078);
fore = cf;
}
component.setFont(font);
if((component instanceof TextField) || (component instanceof TextArea))
{
component.setForeground(cf);
component.setBackground(cb);
} else
{
component.setForeground(fore);
component.setBackground(back);
}
}
public static void getDefComponents(Container container)
{
try
{
Component acomponent[] = container.getComponents();
if(acomponent != null)
{
for(int i = 0; i < acomponent.length; i++)
{
Component component = acomponent[i];
if(component instanceof Container)
getDefComponents((Container)component);
else
getDefComponent(component);
}
}
getDefComponent(container);
}
catch(Throwable throwable)
{
throwable.printStackTrace();
}
}
public static Font getDefFont(int i, boolean flag)
{
Dimension dimension = (new Frame()).getToolkit().getScreenSize();
float f = (float)((double)(float)dimension.height / 150D);
int j = (int)(f * 3F + (float)(i * 2));
j += j % 2;
if(j > 16)
j = 16;
return new Font(flag ? "SansSerif" : "Serif", 0, j);
}
public static void getDefSize(Component component)
{
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
component.setSize(dimension.width / 2, dimension.height / 2);
}
public static Frame getPFrame()
{
if(main_frame == null)
{
main_frame = new Frame();
main_frame.addNotify();
}
return main_frame;
}
public static String getRes(String s)
{
if(resource == null)
try
{
resource = new PProperties();
resource.load(new InputStreamReader(new FileInputStream(new File(getCurrent(), "cnf/resource_" + (isJapanese() ? "ja" : "other") + ".properties")), "UTF8"));
}
catch(FileNotFoundException _ex)
{
System.out.println("can't load resource file");
}
catch(UnsupportedEncodingException unsupportedencodingexception)
{
unsupportedencodingexception.printStackTrace();
}
return resource.getString(s);
}
public static String getRes(String s, String s1)
{
if(resource == null)
try
{
resource = new PProperties();
resource.load(new InputStreamReader(new FileInputStream(new File(getCurrent(), "cnf/resource_" + (isJapanese() ? "ja" : "other") + ".properties")), "UTF8"));
}
catch(FileNotFoundException _ex)
{
System.out.println("can't load resource file");
}
catch(UnsupportedEncodingException unsupportedencodingexception)
{
unsupportedencodingexception.printStackTrace();
}
return resource.getProperty(s, s1);
}
public static synchronized String getStringDialog(String s, String s1, String s2, String s3, String s4, String s5, boolean flag)
{
try
{
class SDL extends Dialog
implements ActionListener, ItemListener
{
private TextField edit;
private Choice choice;
private Button bo_san;
private String str_kaku;
private String str_lists[];
private String list_hint;
private File file_list;
public String res;
public void actionPerformed(ActionEvent actionevent)
{
try
{
if(actionevent.getSource() == bo_san)
{
File file = PTool.fileDialog(this, str_kaku, false);
if(file == null)
{
return;
} else
{
edit.setText(file.getCanonicalPath());
return;
}
}
res = edit.getText();
PTool.listSave(file_list, list_hint, str_lists, res);
dispose();
}
catch(Throwable throwable1)
{
throwable1.printStackTrace();
}
}
public void itemStateChanged(ItemEvent itemevent)
{
edit.setText((String)itemevent.getItem());
}
protected void processWindowEvent(WindowEvent windowevent)
{
if(windowevent.getID() == 201)
dispose();
}
public SDL(String s, String s1, String s2, String s3, String s4, String s5, boolean flag)
{
super(PTool.getPFrame(), s != null ? s : "書き込むか選択", true);
file_list = new File("cnf/list.cf");
res = null;
setLayout(new GridLayout(4, 1, 4, 4));
enableEvents(64L);
if(s2 == null)
s2 = " 実行 ";
str_kaku = s5 != null ? s5 : "";
list_hint = s3;
str_lists = PTool.listLoad(file_list, list_hint);
choice = new Choice();
choice.setCursor(Cursor.getPredefinedCursor(12));
if(str_lists != null)
{
for(int i = 0; i < str_lists.length; i++)
choice.addItem(str_lists[i]);
}
bo_san = new Button("参照");
bo_san.setEnabled(flag);
Panel panel = new Panel(new BorderLayout(1, 1));
panel.add(choice, "Center");
panel.add(bo_san, "East");
Label label = new Label(s1);
String s6;
if(s4 == null)
s6 = PTool.getClipboard();
else
s6 = s4;
choice.insert(s6, 0);
edit = new TextField(s6, 5);
add(label, 0);
add(edit, 1);
add(panel, 2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -