Advertisement
NathanVincent

Jesse AI.java source

Dec 30th, 2018
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 267.22 KB | None | 0 0
  1. import java.util.concurrent.ScheduledExecutorService;
  2. import java.util.concurrent.ThreadLocalRandom;
  3. import java.awt.datatransfer.StringSelection;
  4. import java.time.temporal.TemporalAdjusters;
  5. import java.awt.event.MouseMotionListener;
  6. import javax.script.ScriptEngineManager;
  7. import javax.swing.event.ChangeListener;
  8. import javax.sound.sampled.FloatControl;
  9. import javax.sound.sampled.AudioSystem;
  10. import javax.swing.border.EmptyBorder;
  11. import java.util.concurrent.Executors;
  12. import javax.swing.ListSelectionModel;
  13. import java.util.concurrent.TimeUnit;
  14. import java.util.regex.Matcher;
  15. import java.util.regex.Pattern;
  16. import com.sun.glass.events.KeyEvent;
  17. import javax.swing.border.LineBorder;
  18. import java.awt.event.ActionListener;
  19. import javax.swing.event.ChangeEvent;
  20. import java.awt.image.WritableRaster;
  21. import javax.sound.sampled.Port.Info;
  22. import java.awt.event.WindowListener;
  23. import java.awt.TrayIcon.MessageType;
  24. import java.awt.event.WindowAdapter;
  25. import java.awt.event.MouseListener;
  26. import java.awt.image.BufferedImage;
  27. import java.awt.GraphicsEnvironment;
  28. import java.io.BufferedInputStream;
  29. import java.security.MessageDigest;
  30. import java.awt.event.MouseAdapter;
  31. import javax.swing.AbstractAction;
  32. import java.awt.event.KeyListener;
  33. import javax.swing.SwingUtilities;
  34. import java.awt.event.ActionEvent;
  35. import java.awt.event.WindowEvent;
  36. import javax.swing.SwingConstants;
  37. import javax.swing.JPasswordField;
  38. import java.text.SimpleDateFormat;
  39. import java.net.InetSocketAddress;
  40. import javax.swing.BorderFactory;
  41. import javax.script.ScriptEngine;
  42. import java.awt.event.InputEvent;
  43. import javazoom.jl.player.Player;
  44. import java.awt.event.MouseEvent;
  45. import javax.swing.border.Border;
  46. import java.io.InputStreamReader;
  47. import java.net.NetworkInterface;
  48. import javax.sound.sampled.Port;
  49. import javax.swing.JRadioButton;
  50. import javax.swing.JFileChooser;
  51. import javax.swing.JScrollPane;
  52. import javax.swing.JOptionPane;
  53. import java.io.FileInputStream;
  54. import java.text.DecimalFormat;
  55. import javax.swing.ButtonGroup;
  56. import java.awt.GraphicsDevice;
  57. import java.net.SocketAddress;
  58. import java.io.BufferedReader;
  59. import javax.swing.JTextField;
  60. import java.io.BufferedWriter;
  61. import java.io.FilenameFilter;
  62. import java.io.IOException;
  63. import javax.swing.JComponent;
  64. import javax.swing.JTextArea;
  65. import javax.imageio.ImageIO;
  66. import javax.swing.KeyStroke;
  67. import java.awt.image.Raster;
  68. import javax.swing.BoxLayout;
  69. import javax.swing.ImageIcon;
  70. import javax.swing.UIManager;
  71. import java.util.Enumeration;
  72. import javax.swing.JCheckBox;
  73. import javax.swing.JComboBox;
  74. import java.awt.BorderLayout;
  75. import java.util.Collections;
  76. import java.net.InetAddress;
  77. import java.util.LinkedList;
  78. import java.util.Properties;
  79. import java.text.DateFormat;
  80. import java.io.StringWriter;
  81. import java.util.ArrayList;
  82. import java.awt.Graphics2D;
  83. import java.time.LocalDate;
  84. import java.time.DayOfWeek;
  85. import javax.swing.JButton;
  86. import java.io.PrintWriter;
  87. import java.nio.file.Files;
  88. import javax.swing.JSlider;
  89. import java.awt.FlowLayout;
  90. import java.awt.GridLayout;
  91. import java.awt.SystemTray;
  92. import java.io.FileWriter;
  93. import java.io.FileReader;
  94. import javax.swing.JLabel;
  95. import java.awt.Dimension;
  96. import javax.swing.JPanel;
  97. import java.awt.Rectangle;
  98. import java.awt.Component;
  99. import java.util.Calendar;
  100. import javax.swing.JFrame;
  101. import javax.swing.Action;
  102. import java.awt.PopupMenu;
  103. import javax.swing.JList;
  104. import java.util.Arrays;
  105. import java.util.Random;
  106. import java.awt.Desktop;
  107. import java.awt.Toolkit;
  108. import java.net.Socket;
  109. import java.util.List;
  110. import java.awt.Robot;
  111. import java.awt.Color;
  112. import java.awt.Image;
  113. import java.util.Date;
  114. import java.awt.Point;
  115. import java.awt.Font;
  116. import java.net.URL;
  117. import java.net.URI;
  118. import java.io.File;
  119. import java.awt.*;
  120.  
  121.  
  122. public class AI implements ActionListener, MouseMotionListener, MouseListener, ChangeListener, WindowListener
  123. {
  124. public Player Player;
  125. public Player MP3Player;
  126.  
  127. public JSlider MusicVolumeSlider;
  128.  
  129. public File CreateUserBackground = new File("No file chosen");
  130. public File CurrentMusicFile;
  131. public File CurrentUserNote;
  132. public File FileChooserFile;
  133.  
  134. public LinkedList<Preference> PreferencesList = new LinkedList<Preference>();
  135.  
  136. public Font DefaultFont = new Font("Tahoma",Font.BOLD, 30);
  137. public Font DefaultFontSmall = new Font("Tahoma",Font.BOLD, 15);
  138. public Font LoginFont = new Font("Comic Sans MS",Font.BOLD, 30);
  139. public Font ButtonFont = new Font("Dialog Font",Font.BOLD,15);
  140. public Font Tahoma = new Font("Tahoma",Font.BOLD,20);
  141. public Font WeatherFontBig = new Font("Segoe UI Black", Font.BOLD, 30);
  142. public Font WeatherFontSmall = new Font("Segoe UI Black", Font.BOLD, 20);
  143. public Font UserFont;
  144.  
  145. public ImageIcon SASIDIcon = new ImageIcon("SASIDFiles\\Pictures\\SASIDIcon.png");
  146. public ImageIcon SASIDTrayIcon = new ImageIcon("SASIDFiles\\Pictures\\SASIDTrayIcon.png");
  147.  
  148. public List<String> OperationList = new ArrayList<String>();
  149. public List<String> PropertiesList;
  150. public List<File> BackgroundsList;
  151. public List<String> BackgroundsNameList;
  152. public List<File> MusicList;
  153. public List<String> MusicNameList;
  154. public List<File> NoteList;
  155. public List<String> NoteNameList;
  156.  
  157. public JList<?> PizzaTopingsList;
  158. public JList<?> FontList;
  159. public JList<?> FileSelectionList;
  160. public JList<?> BackgroundSelectionList;
  161. public JList<?> MusicSelectionList;
  162.  
  163. public String HangmanWord;
  164. public String OS;
  165. public String OriginalOperation;
  166. public String PhoneNumber = "";
  167. public String CalculatorExpression = "";
  168. public String CUsername;
  169. public String FirstWord;
  170. public String operation;
  171. public String YesOrNo;
  172. public String NewName;
  173. public String UserCity;
  174. public String UserLat;
  175. public String UserLon;
  176. public String UserState;
  177. public String UserStateAbr;
  178. public String UserISP;
  179. public String UserCountry;
  180. public String UserCountryAbr;
  181. public String Temperature;
  182. public String CloudCover;
  183. public String UVIndex;
  184. public String WeatherCondition;
  185. public String WeatherSummary;
  186. public String Humidity;
  187. public String Visibility;
  188. public String Pressure;
  189. public String Sunrise;
  190. public String Sunset;
  191. public String WindSpeed;
  192. public String WindDirection;
  193. public String WeatherIcon;
  194. public String SASIDVer = "SASID Build 0.5";
  195. public String Username = "Unknown user";
  196.  
  197. public Color ConsoleColor = new Color(39,40,34);
  198. public Color RegularRed = new Color(223,85,83);
  199. public Color CalculatorOrange = new Color(255,140,0);
  200. public Color TTTBlue = new Color(71,81,117);
  201. public Color Vanila = new Color(252,251,227);
  202. public Color UserColor;
  203.  
  204. public ButtonGroup RadioCurrentValueGroup;
  205. public ButtonGroup RadioNewValueGroup;
  206.  
  207. public JComboBox<?> PizzaCrustCombo;
  208.  
  209. public JRadioButton NewFahrenheit;
  210. public JRadioButton OldFahrenheit;
  211. public JRadioButton NewCelsius;
  212. public JRadioButton OldCelsius;
  213. public JRadioButton NewKelvin;
  214. public JRadioButton OldKelvin;
  215. public JRadioButton Medium;
  216. public JRadioButton Large;
  217. public JRadioButton Small;
  218.  
  219. public JPasswordField HashField;
  220. public JPasswordField pass;
  221. public JPasswordField NewUserPassword;
  222. public JPasswordField NewUserPasswordconf;
  223.  
  224. public BufferedWriter CSVwriter;
  225.  
  226. public BufferedReader CSVreader;
  227.  
  228. public BufferedInputStream BIS;
  229. public FileInputStream FIS;
  230.  
  231. public JButton Back;
  232. public JButton DebugButton;
  233. public JButton CloseWeather;
  234. public JButton MinimizeWeather;
  235. public JButton Facebook;
  236. public JButton Twitter;
  237. public JButton Instagram;
  238. public JButton YouTube;
  239. public JButton DeleteMusic;
  240. public JButton OpenMusic;
  241. public JButton AddMusic;
  242. public JButton DeleteBackground;
  243. public JButton OpenBackground;
  244. public JButton AddBackground;
  245. public JButton SaveNote;
  246. public JButton RepeatMusic;
  247. public JButton ApplyPreferences;
  248. public JButton Apply;
  249. public JButton close;
  250. public JButton CloseDebug;
  251. public JButton Eight;
  252. public JButton Seven;
  253. public JButton Three;
  254. public JButton Nine;
  255. public JButton Five;
  256. public JButton Four;
  257. public JButton Zero;
  258. public JButton Six;
  259. public JButton Two;
  260. public JButton One;
  261. public JButton SubmitButton;
  262. public JButton ResetValues;
  263. public JButton HashButton;
  264. public JButton ResetPizza;
  265. public JButton ChangeSize;
  266. public JButton PlaceOrder;
  267. public JButton DialNumber;
  268. public JButton ApplyFont;
  269. public JButton Calculate;
  270. public JButton CloseLog;
  271. public JButton minimize;
  272. public JButton ClickMe;
  273. public JButton CloseDraw;
  274. public JButton CloseMusic;
  275. public JButton CalculatorOne;
  276. public JButton CalculatorTwo;
  277. public JButton CalculatorThree;
  278. public JButton CalculatorFour;
  279. public JButton CalculatorFive;
  280. public JButton CalculatorSix;
  281. public JButton CalculatorSeven;
  282. public JButton CalculatorEight;
  283. public JButton CalculatorNine;
  284. public JButton CalculatorZero;
  285. public JButton CalculatorAdd;
  286. public JButton CalculatorSubtract;
  287. public JButton CalculatorMultiply;
  288. public JButton CalculatorDivide;
  289. public JButton CalculatorDecimal;
  290. public JButton CalculatorEquals;
  291. public JButton CalculatorClear;
  292. public JButton CalculatorPercent;
  293. public JButton CalculatorOpenP;
  294. public JButton CalculatorCloseP;
  295. public JButton CalculatorDeciaml;
  296. public JButton TTT1;
  297. public JButton TTT2;
  298. public JButton TTT3;
  299. public JButton TTT4;
  300. public JButton TTT5;
  301. public JButton TTT6;
  302. public JButton TTT7;
  303. public JButton TTT8;
  304. public JButton TTT9;
  305. public JButton TTTReset;
  306. public JButton AddNote;
  307. public JButton DeleteNote;
  308. public JButton SubmitNote;
  309. public JButton OpenNote;
  310. public JButton SubmitNewNote;
  311. public JButton GetYTTN;
  312. public JButton ApproveImage;
  313. public JButton PlayPauseMusic;
  314. public JButton StopMusic;
  315. public JButton NextMusic;
  316. public JButton LastMusic;
  317. public JButton LoopMusic;
  318. public JButton SelectMusicDir;
  319. public JButton HangmanA;
  320. public JButton HangmanB;
  321. public JButton HangmanC;
  322. public JButton HangmanD;
  323. public JButton HangmanE;
  324. public JButton HangmanF;
  325. public JButton HangmanG;
  326. public JButton HangmanH;
  327. public JButton HangmanI;
  328. public JButton HangmanJ;
  329. public JButton HangmanK;
  330. public JButton HangmanL;
  331. public JButton HangmanM;
  332. public JButton HangmanN;
  333. public JButton HangmanO;
  334. public JButton HangmanP;
  335. public JButton HangmanQ;
  336. public JButton HangmanR;
  337. public JButton HangmanS;
  338. public JButton HangmanT;
  339. public JButton HangmanU;
  340. public JButton HangmanV;
  341. public JButton HangmanW;
  342. public JButton HangmanX;
  343. public JButton HangmanY;
  344. public JButton HangmanZ;
  345. public JButton HangmanReset;
  346.  
  347. public JTextField StartingValue;
  348. public JTextField InputField;
  349. public JTextField NameField;
  350. public JTextField EnterName;
  351. public JTextField Green;
  352. public JTextField Red;
  353. public JTextField Blue;
  354. public JTextField CalculatorField;
  355. public JTextField NewNoteField;
  356. public JTextField YTTNField;
  357. public JTextField NewUserName;
  358.  
  359. public double CalculationValue;
  360.  
  361. public long PauseLocation;
  362. public long SongTotalLength;
  363.  
  364. public boolean YouTubeScript;
  365. public boolean MathShellMode;
  366. public boolean ChristmasEcho;
  367. public boolean HalloweenEcho;
  368. public boolean IndependenceDayEcho;
  369. public boolean ThanksgivingEcho;
  370. public boolean AprilFoolsDayEcho;
  371. public boolean OneMathPrint;
  372. public boolean PositionMode;
  373. public boolean ToDoListMode;
  374. public boolean AlwaysOnTop;
  375. public boolean YouTubeMode;
  376. public boolean PrintMode;
  377. public boolean DebugMode;
  378. public boolean GoogleMode;
  379. public boolean PlayIcon = true;
  380. public boolean MusicStopped;
  381. public boolean RepeatAudio;
  382. public boolean UpdateClock;
  383. public boolean UpdateWeather;
  384.  
  385. public JFrame HangmanFrame;
  386. public JFrame DebugFrame;
  387. public JFrame WeatherFrame;
  388. public JFrame MediaFrame;
  389. public JFrame NoteEditorFrame;
  390. public JFrame PreferencesFrame;
  391. public JFrame TemperatureFrame;
  392. public JFrame ClickMeFrame;
  393. public JFrame PictureFrame;
  394. public JFrame ConsoleFrame;
  395. public JFrame LoginFrame;
  396. public JFrame PizzaFrame;
  397. public JFrame ColorFrame;
  398. public JFrame PhoneFrame;
  399. public JFrame HashFrame;
  400. public JFrame FontFrame;
  401. public JFrame CalculatorFrame;
  402. public JFrame TTTFrame;
  403. public JFrame NoteFrame;
  404. public JFrame NewNoteFrame;
  405. public JFrame YTTNFrame;
  406. public JFrame CreateUserFrame;
  407. public JFrame PixelFrame;
  408. public JFrame MusicFrame;
  409. public JFrame EditUserFrame;
  410.  
  411. public JCheckBox BreadSticks;
  412. public JCheckBox Salad;
  413. public JCheckBox Soda;
  414. public JCheckBox MusicOnStart;
  415. public JCheckBox SPOS;
  416.  
  417. public JTextArea OutputArea;
  418. public JTextArea NoteEditArea;
  419. public JTextArea OrderCommentsTextArea;
  420. public JTextArea NoteTextArea;
  421. public JTextArea NewNoteArea;
  422.  
  423. public JLabel HangmanImageLabel;
  424. public JLabel HangmanLabel;
  425. public JLabel NumberLabel;
  426. public JLabel DisplayLabel;
  427. public JLabel DebugLabel;
  428. public JLabel DebugDragLabel;
  429. public JLabel CreateNewUser;
  430. public JLabel ParentLabel;
  431. public JLabel ConsoleDragLabel;
  432. public JLabel TTTLabel;
  433. public JLabel SplashLabel;
  434. public JLabel NewUserLabel;
  435. public JLabel MusicLabel;
  436. public JLabel MusicDragLabel;
  437. public JLabel MusicTitleLabel;
  438. public JLabel WeatherDragLabel;
  439. public JLabel WeatherLabel;
  440. public JLabel CurrentTimeLabel;
  441. public JLabel LocationLabel;
  442. public JLabel CurrentWeatherIconLabel;
  443. public JLabel CurrentWeatherLabel;
  444. public JLabel TemperatureLabel;
  445. public JLabel UVIndexLabel;
  446. public JLabel CloudCoverLabel;
  447. public JLabel WindSpeedLabel;
  448. public JLabel WindDirectionLabel;
  449. public JLabel HumidityLabel;
  450. public JLabel PressureLabel;
  451. public JLabel VisibilityLabel;
  452. public JLabel SunriseLabel;
  453. public JLabel SunsetLabel;
  454. public JLabel ChooseBackground;
  455.  
  456. public File[] ValidBackgroundPaths;
  457. public File[] MusicFiles;
  458.  
  459. public JScrollPane OutputScroll;
  460. public JScrollPane FileScroll;
  461. public JScrollPane NoteListScroll;
  462. public JScrollPane NoteScroll;
  463. public JScrollPane BackgroundListScroll;
  464. public JScrollPane MusicListScroll;
  465.  
  466. public int HangmanWrongGuesses;
  467. public int ScrollingIndex;
  468. public int CurrentDowns;
  469. public int BackGroundY;
  470. public int BackGroundX;
  471. public int ScreenY;
  472. public int ScreenX;
  473. public int yMouse;
  474. public int xMouse;
  475. public int CurrentPlayerTurn;
  476. public int CurrentBackgroundIndex = 0;
  477. public int RestoreX;
  478. public int RestoreY;
  479. public int WeatherRestoreX;
  480. public int WeatherRestoreY;
  481. public int CurrentMusicIndex;
  482.  
  483. public final int PlayerX = 0;
  484. public final int PlayerO = 1;
  485.  
  486. public JPanel ParentPanel;
  487. public JPanel MusicPanel;
  488.  
  489. public static Robot Rob;
  490.  
  491. public BufferedImage ReturnImage = null;
  492.  
  493. final PopupMenu Popup = new PopupMenu();
  494.  
  495. final TrayIcon TrayIcon = new TrayIcon(SASIDTrayIcon.getImage(), SASIDVer + " [" + Username + "]");
  496.  
  497. final SystemTray Tray = SystemTray.getSystemTray();
  498.  
  499. public CheckboxMenuItem HideOnClose;
  500.  
  501. public Thread YouTubeThread;
  502.  
  503. public static void main(String[] args)
  504. {
  505. new AI();
  506. }
  507.  
  508. AI()
  509. {
  510. UIManager.put("ToolTip.background", ConsoleColor);
  511.  
  512. UIManager.put("ToolTip.border", Color.black);
  513.  
  514. UIManager.put("ToolTip.font", Tahoma);
  515.  
  516. UIManager.put("ToolTip.foreground", new Color(85,85,255));
  517.  
  518. MACAddress();
  519.  
  520. GetName();
  521.  
  522. Location();
  523.  
  524. Tray();
  525.  
  526. File Users = new File("JesseUsers");
  527.  
  528. String[] directories = Users.list(new FilenameFilter()
  529. {
  530. @Override
  531. public boolean accept(File current, String name)
  532. {
  533. return new File(current, name).isDirectory();
  534. }
  535. });
  536.  
  537. if (directories.length == 0)
  538. {
  539. QBox("It appears that no users exist on this version of SASID. You should create one.");
  540.  
  541. Login(false);
  542. }
  543.  
  544. else
  545. {
  546. Login(false);
  547. }
  548. }
  549.  
  550. public void Console()
  551. {
  552. try
  553. {
  554. ValidBackgroundPaths = GetBackgrounds();
  555.  
  556. GetScreenSize();
  557.  
  558. TrayIcon.setToolTip(SASIDVer + " [" + Username + "]");
  559.  
  560. for (int i = 0 ; i < ValidBackgroundPaths.length ; i++)
  561. {
  562. File UneditedImage = ValidBackgroundPaths[i];
  563.  
  564. ImageIcon Size = new ImageIcon(ValidBackgroundPaths[i].toString());
  565.  
  566. BackGroundX = Size.getIconWidth();
  567.  
  568. BackGroundY = Size.getIconHeight();
  569.  
  570. if (BackGroundX > ScreenX || BackGroundY > ScreenY)
  571. {
  572. BufferedImage SaveImage = ImageFromConsole(ScreenX - 500, ScreenY - 500, UneditedImage);
  573.  
  574. ImageIO.write(SaveImage, "png", new File(ValidBackgroundPaths[i].toString()));
  575. }
  576. }
  577.  
  578. GetBackgroundSize();
  579.  
  580. GetBackgrounds();
  581.  
  582. ConsoleFrame = new JFrame();
  583.  
  584. WindowsFeel(ConsoleFrame);
  585.  
  586. DebugCheck();
  587.  
  588. ConsoleFrame.setUndecorated(true);
  589.  
  590. ConsoleFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  591.  
  592. ConsoleFrame.setBounds(0, 0, BackGroundX, BackGroundY);
  593.  
  594. ConsoleFrame.setTitle(SASIDVer + " [" + Username + "]");
  595.  
  596. ParentPanel = new JPanel();
  597.  
  598. ParentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  599.  
  600. ConsoleFrame.setContentPane(ParentPanel);
  601.  
  602. ParentPanel.setLayout(null);
  603.  
  604. ParentLabel = new JLabel("");
  605.  
  606. ParentLabel.setIcon(new ImageIcon(ValidBackgroundPaths[CurrentBackgroundIndex].toString()));
  607.  
  608. ParentLabel.setToolTipText(ValidBackgroundPaths[CurrentBackgroundIndex].getName().replace(".png", ""));
  609.  
  610. ParentLabel.setBounds(0, 0, BackGroundX, BackGroundY);
  611.  
  612. ParentLabel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4,
  613. InputEvent.ALT_DOWN_MASK), "AlternateBackground");
  614.  
  615. ParentLabel.getActionMap().put("AlternateBackground", new AbstractAction()
  616. {
  617. private static final long serialVersionUID = 1L;
  618.  
  619. @Override
  620. public void actionPerformed(ActionEvent e)
  621. {
  622. ChangeSize.doClick();
  623. }
  624. });
  625.  
  626. ParentPanel.add(ParentLabel);
  627.  
  628. ConsoleFrame.setIconImage(SASIDIcon.getImage());
  629.  
  630. OutputArea = new JTextArea()
  631. {
  632. @Override
  633. public void setBorder(Border border)
  634. {
  635. //no border
  636. }
  637. };
  638.  
  639. OutputArea.setEditable(false);
  640.  
  641. OutputArea.setAutoscrolls(true);
  642.  
  643. OutputArea.setBounds(10, 62, BackGroundX - 20, BackGroundY - 204);
  644.  
  645. OutputArea.setLineWrap(true);
  646.  
  647. OutputArea.setWrapStyleWord(true);
  648.  
  649. OutputArea.setFocusable(true);
  650.  
  651. OutputArea.setSelectionColor(new Color(204,153,0));
  652.  
  653. OutputArea.setOpaque(false);
  654.  
  655. OutputArea.setBackground(new Color(0,0,0,0));
  656.  
  657. OutputScroll = new JScrollPane(OutputArea,
  658. JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  659. JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  660.  
  661. OutputScroll.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0));
  662.  
  663. OutputScroll.getViewport().setBorder(null);
  664.  
  665. OutputScroll.getViewport().setOpaque(false);
  666.  
  667. OutputScroll.setOpaque(false);
  668.  
  669. OutputScroll.setBorder(BorderFactory.createEmptyBorder());
  670.  
  671. OutputScroll.setBounds(10, 62, BackGroundX - 20, BackGroundY - 204);
  672.  
  673. ParentLabel.add(OutputScroll);
  674.  
  675. InputField = new JTextField(40)
  676. {
  677. @Override
  678. public void setBorder(Border border)
  679. {
  680. //No Border
  681. }
  682. };
  683.  
  684. InputField.addKeyListener(new KeyListener()
  685. {
  686. @Override
  687. public void keyPressed(java.awt.event.KeyEvent e)
  688. {
  689. if (InputField.getText().length() == 1)
  690. {
  691. InputField.setText(InputField.getText().toUpperCase());
  692. }
  693. }
  694.  
  695. @Override
  696. public void keyReleased(java.awt.event.KeyEvent e)
  697. {
  698. if (InputField.getText().length() == 1)
  699. {
  700. InputField.setText(InputField.getText().toUpperCase());
  701. }
  702. }
  703.  
  704. @Override
  705. public void keyTyped(java.awt.event.KeyEvent e)
  706. {
  707. if (InputField.getText().length() == 1)
  708. {
  709. InputField.setText(InputField.getText().toUpperCase());
  710. }
  711. }
  712. });
  713.  
  714. InputField.setToolTipText("Input Field");
  715.  
  716. InputField.setSelectionColor(new Color(204,153,0));
  717.  
  718. InputField.addKeyListener(CommandScrolling);
  719.  
  720. ConsoleFrame.addWindowListener(ConsoleEcho);
  721.  
  722. InputField.setBounds(10, 82 + OutputArea.getHeight(), BackGroundX - 20, BackGroundY - (OutputArea.getHeight() + 62 + 40));
  723.  
  724. InputField.setOpaque(false);
  725.  
  726. ParentLabel.add(InputField);
  727.  
  728. InputField.addActionListener(InputFieldAction);
  729.  
  730. InputField.setCaretColor(Vanila);
  731.  
  732. UserFontAndColor();
  733.  
  734. DebugButton = new JButton("");
  735.  
  736. DebugButton.setToolTipText("Debug Menu");
  737.  
  738. DebugButton.addActionListener(this);
  739.  
  740. DebugButton.addMouseListener(this);
  741.  
  742. DebugButton.setBounds(4, 4, 22, 22);
  743.  
  744. ImageIcon DebugIcon = new ImageIcon("SASIDFiles\\Pictures\\Debug1.png");
  745.  
  746. DebugButton.setIcon(DebugIcon);
  747.  
  748. ParentLabel.add(DebugButton);
  749.  
  750. DebugButton.setFocusPainted(false);
  751.  
  752. DebugButton.setOpaque(false);
  753.  
  754. DebugButton.setContentAreaFilled(false);
  755.  
  756. DebugButton.setBorderPainted(false);
  757.  
  758. minimize = new JButton("");
  759.  
  760. minimize.setToolTipText("Minimize");
  761.  
  762. minimize.addActionListener(this);
  763.  
  764. minimize.addMouseListener(this);
  765.  
  766. minimize.setBounds(BackGroundX - 81, 4, 22, 20);
  767.  
  768. ImageIcon mini = new ImageIcon("SASIDFiles\\Pictures\\Minimize1.png");
  769.  
  770. minimize.setIcon(mini);
  771.  
  772. ParentLabel.add(minimize);
  773.  
  774. minimize.setFocusPainted(false);
  775.  
  776. minimize.setOpaque(false);
  777.  
  778. minimize.setContentAreaFilled(false);
  779.  
  780. minimize.setBorderPainted(false);
  781.  
  782. ChangeSize = new JButton("");
  783.  
  784. ChangeSize.setToolTipText("Alternate Background");
  785.  
  786. ChangeSize.addActionListener(this);
  787.  
  788. ChangeSize.addMouseListener(this);
  789.  
  790. ChangeSize.setBounds(BackGroundX - 54, 4, 22, 20);
  791.  
  792. ImageIcon Size = new ImageIcon("SASIDFiles\\Pictures\\ChangeSize1.png");
  793.  
  794. ChangeSize.setIcon(Size);
  795.  
  796. ParentLabel.add(ChangeSize);
  797.  
  798. ChangeSize.setFocusPainted(false);
  799.  
  800. ChangeSize.setOpaque(false);
  801.  
  802. ChangeSize.setContentAreaFilled(false);
  803.  
  804. ChangeSize.setBorderPainted(false);
  805.  
  806. close = new JButton("");
  807.  
  808. close.setToolTipText("Close");
  809.  
  810. close.addActionListener(this);
  811.  
  812. close.addMouseListener(this);
  813.  
  814. close.setBounds(BackGroundX - 27, 4, 22, 20);
  815.  
  816. ImageIcon exit = new ImageIcon("SASIDFiles\\Pictures\\Close1.png");
  817.  
  818. close.setIcon(exit);
  819.  
  820. ParentLabel.add(close);
  821.  
  822. close.setFocusPainted(false);
  823.  
  824. close.setOpaque(false);
  825.  
  826. close.setContentAreaFilled(false);
  827.  
  828. close.setBorderPainted(false);
  829.  
  830. ConsoleDragLabel = new JLabel();
  831.  
  832. ConsoleDragLabel.setBounds(0,0,BackGroundX,30);
  833.  
  834. ConsoleDragLabel.setToolTipText("Drag label");
  835.  
  836. ConsoleDragLabel.addMouseMotionListener(this);
  837.  
  838. ConsoleDragLabel.setOpaque(true);
  839.  
  840. ConsoleDragLabel.setBackground(new Color(26,32,51));
  841.  
  842. WeatherStats();
  843.  
  844. ConsoleDragLabel.setFont(WeatherFontSmall);
  845.  
  846. ConsoleDragLabel.setForeground(Vanila);
  847.  
  848. ParentLabel.add(ConsoleDragLabel);
  849.  
  850. ConsoleFrame.repaint();
  851.  
  852. ConsoleFrame.addWindowListener(this);
  853.  
  854. ConsoleFrame.setLocationRelativeTo(null);
  855.  
  856. ConsoleFrame.setVisible(true);
  857.  
  858. ConsoleFrame.setAlwaysOnTop(true);
  859.  
  860. ConsoleFrame.setAlwaysOnTop(false);
  861.  
  862. if (InternetUnReachable())
  863. {
  864. println("Sorry, " + Username + ", but I had trouble reaching the internet. You may not be connected to the internet. Resultingly, some features may not work properly.");
  865. }
  866. }
  867.  
  868. catch (Exception e)
  869. {
  870. LogError(e);
  871. }
  872. }
  873.  
  874. public void Handle(String operation)
  875. {
  876. try
  877. {
  878. FirstWord = FirstWord(operation);
  879.  
  880. if (Filter(operation))
  881. {
  882. println("Sorry, " + Username + ", but that language is prohibited.");
  883.  
  884. operation = "";
  885. }
  886.  
  887. else if (IsPalindrome(operation.replace(" ", "").toCharArray()) && operation.length() > 3)
  888. {
  889. println("Nice palindrome.");
  890. }
  891.  
  892. else if ((EIC("quit") && !MathShellMode) || EIC("leave") || EIC("stop") || has("exit") || EIC("close"))
  893. {
  894. exit();
  895. }
  896.  
  897. else if (EIC("test"))
  898. {
  899. Test();
  900. }
  901.  
  902. else if (has("Flip a coin") || has("coin flip") || has("heads or tails") || (has("flip") && has("coin")))
  903. {
  904. if (Math.random() <= 0.5)
  905. {
  906. println("It's Heads!");
  907. }
  908.  
  909. else if (Math.random() <= 0.0001)
  910. {
  911. println("You're not going to beleive this, but it landed on its side");
  912. }
  913.  
  914. else
  915. {
  916. println("It's Tails!");
  917. }
  918. }
  919.  
  920. else if ((has("hello") || has("Whats up") || EIC("hi") || has("hi "))
  921. && (!has("print") && !has("echo") && !has("youtube") && !has("google")
  922. && !has("wikipedia") && !has("synonym") && !has("define")))
  923. {
  924. int choice = RI(1,5);
  925.  
  926. if (choice == 1)
  927. {
  928. println("Hello " + Username + ".");
  929. }
  930.  
  931. else if (choice == 2)
  932. {
  933. println("Hi " + Username + "." );
  934. }
  935.  
  936. else if (choice == 3)
  937. {
  938. println("What's up " + Username + "?");
  939. }
  940.  
  941. else if (choice == 4)
  942. {
  943. println("How are you doing, " + Username + "?");
  944. }
  945.  
  946. else
  947. {
  948. println("Hi," + Username + ", i'm SAISD.");
  949. }
  950. }
  951.  
  952. else if (has("bye"))
  953. {
  954. println("Please don't go.");
  955. }
  956.  
  957. else if (has("time") || has ("day"))
  958. {
  959. println(WeatherTime());
  960. }
  961.  
  962. else if (EIC("die") || has("roll a die") || has("roll die"))
  963. {
  964. int Roll = ThreadLocalRandom.current().nextInt(1, 7);
  965.  
  966. println("You rolled a " + Roll + ".");
  967. }
  968.  
  969. else if (EIC("lol"))
  970. {
  971. println("I ccl about your stupid memes.");
  972. }
  973.  
  974. else if (has("thank"))
  975. {
  976. println("You're welcome.");
  977. }
  978.  
  979. else if (has("you") && has("cool"))
  980. {
  981. println("I know.");
  982. }
  983.  
  984.  
  985. else if (has("paint"))
  986. {
  987. String param = "C:\\Windows\\system32\\mspaint.exe";
  988.  
  989. Runtime.getRuntime().exec(param);
  990. }
  991.  
  992. else if (EIC("pi"))
  993. {
  994. println(Math.PI);
  995. }
  996.  
  997. else if (has("euler") || EIC("e"))
  998. {
  999. println(Math.E);
  1000. }
  1001.  
  1002. else if (has("scrub"))
  1003. {
  1004. println("You're a scrub lord.");
  1005. }
  1006.  
  1007. else if (has("break;"))
  1008. {
  1009. println("Why would you want to break me?");
  1010. }
  1011.  
  1012. else if (hasWord("url"))
  1013. {
  1014. String StringURL = GetInput("Enter your desired URL");
  1015.  
  1016. if (StringURL != "" && StringURL != null)
  1017. {
  1018. URI URI = new URI(StringURL);
  1019.  
  1020. InternetConnect(URI);
  1021. }
  1022. }
  1023.  
  1024. else if (has("temperature") || EIC("temp"))
  1025. {
  1026. SwingFeel(ConsoleFrame);
  1027.  
  1028. Temperature();
  1029. }
  1030.  
  1031. else if (has("click me"))
  1032. {
  1033. SwingFeel(ConsoleFrame);
  1034.  
  1035. ClickMe();
  1036. }
  1037.  
  1038. else if ((has("how") && has("are") && has("you")))
  1039. {
  1040. println("I am feeling like a programmed response. Thank you for asking.");
  1041. }
  1042.  
  1043. else if (has("how") && has("day been"))
  1044. {
  1045. println("I was having fun until you started asking me questions.");
  1046. }
  1047.  
  1048. else if (has("How old are you") || (has("what") && has("your age")))
  1049. {
  1050. println("I am 256");
  1051. }
  1052.  
  1053. else if (((has("who") || has("what")) && has("you")) && has("name"))
  1054. {
  1055. println("I am SASID (Smart Assistant Still In Development).");
  1056. }
  1057.  
  1058. else if (has("What") && has("do") && has("you") && (has("job") || has("living")))
  1059. {
  1060. println("I am an olympic athlete.");
  1061. }
  1062.  
  1063. else if (has("helpful"))
  1064. {
  1065. println("I will always do my best to serve you.");
  1066. }
  1067.  
  1068. else if (EIC("k"))
  1069. {
  1070. println("Fun Fact: the letter 'K' comes from the Greek letter kappa, which was taken "
  1071. + "from \nthe Semitic kap, the symbol for an open hand. It is this very hand \nwhich "
  1072. + "will be slapping you in the face for saying 'k' to me.");
  1073. }
  1074.  
  1075.  
  1076. else if (has("phone") || has("dialer") || has(" call") || has(" call"))
  1077. {
  1078. SwingFeel(ConsoleFrame);
  1079.  
  1080. PhoneDialer();
  1081. }
  1082.  
  1083. else if (has("reset") && has("mouse"))
  1084. {
  1085. ResetMouse();
  1086. }
  1087.  
  1088. else if (has("close") && !EIC("close"))
  1089. {
  1090. exit();
  1091. }
  1092.  
  1093. else if (EIC("bottom") || EIC("down"))
  1094. {
  1095. Rob = new Robot();
  1096. Rob.keyPress(KeyEvent.VK_CONTROL);
  1097. Rob.keyPress(KeyEvent.VK_ALT);
  1098. Rob.keyPress(KeyEvent.VK_DOWN);
  1099. Rob.keyRelease(KeyEvent.VK_CONTROL);
  1100. Rob.keyRelease(KeyEvent.VK_ALT);
  1101. Rob.keyRelease(KeyEvent.VK_DOWN);
  1102. }
  1103.  
  1104. else if (EIC("top") || EIC("up"))
  1105. {
  1106. Rob = new Robot();
  1107. Rob.keyPress(KeyEvent.VK_CONTROL);
  1108. Rob.keyPress(KeyEvent.VK_ALT);
  1109. Rob.keyPress(KeyEvent.VK_UP);
  1110. Rob.keyRelease(KeyEvent.VK_CONTROL);
  1111. Rob.keyRelease(KeyEvent.VK_ALT);
  1112. Rob.keyRelease(KeyEvent.VK_UP);
  1113. }
  1114.  
  1115. else if (EIC("left"))
  1116. {
  1117. Rob = new Robot();
  1118. Rob.keyPress(KeyEvent.VK_CONTROL);
  1119. Rob.keyPress(KeyEvent.VK_ALT);
  1120. Rob.keyPress(KeyEvent.VK_LEFT);
  1121. Rob.keyRelease(KeyEvent.VK_CONTROL);
  1122. Rob.keyRelease(KeyEvent.VK_ALT);
  1123. Rob.keyRelease(KeyEvent.VK_LEFT);
  1124. }
  1125.  
  1126. else if (EIC("right"))
  1127. {
  1128. Rob = new Robot();
  1129. Rob.keyPress(KeyEvent.VK_CONTROL);
  1130. Rob.keyPress(KeyEvent.VK_ALT);
  1131. Rob.keyPress(KeyEvent.VK_RIGHT);
  1132. Rob.keyRelease(KeyEvent.VK_CONTROL);
  1133. Rob.keyRelease(KeyEvent.VK_ALT);
  1134. Rob.keyRelease(KeyEvent.VK_RIGHT);
  1135. }
  1136.  
  1137. else if (has("log off"))
  1138. {
  1139. String shutdownCmd = "shutdown -l";
  1140.  
  1141. Runtime.getRuntime().exec(shutdownCmd);
  1142. }
  1143.  
  1144. else if (has("lock the taskbar") || has("lock taskbar") || has("lock the task bar") || has("lock task bar"))
  1145. {
  1146. OpenFile("SASIDFiles\\Video\\LockTheTaskbar.mp4");
  1147. }
  1148.  
  1149. else if (EIC("clc") || EIC("cls") || EIC("clear") || (has("clear") && has("screen")))
  1150. {
  1151. CLC();
  1152. }
  1153.  
  1154. else if (EIC("no") || EIC("nope"))
  1155. {
  1156. println("Yes");
  1157. }
  1158.  
  1159. else if (has("how can I help"))
  1160. {
  1161. println("That's my line :P");
  1162. }
  1163.  
  1164. else if (has("siri") || has("jarvis"))
  1165. {
  1166. println("*yawn*");
  1167. }
  1168.  
  1169. else if (has("Whos in charge here") || has("Who is in charge here"))
  1170. {
  1171. PlayMusic("SASIDFiles\\Audio\\TheClaw.mp3");
  1172. }
  1173.  
  1174. else if (has("stop") && has("music"))
  1175. {
  1176. StopMusic();
  1177. }
  1178.  
  1179. else if (has("copy to clipboard") || (has("copy") && has("clipboard")) || EIC("clipboard") || has("clipy") || has("clippy"))
  1180. {
  1181. String Clipy = GetInput("What would you like me to copy to your clipboard?");
  1182.  
  1183. StringSelection selection = new StringSelection(Clipy);
  1184.  
  1185. java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  1186.  
  1187. clipboard.setContents(selection, selection);
  1188.  
  1189. println( "\" " + Clipy + " \" is now copied to your clipboard.");
  1190. }
  1191.  
  1192. else if (has("reset") && has("clipboard"))
  1193. {
  1194. String Reset = null;
  1195.  
  1196. StringSelection selection = new StringSelection(Reset);
  1197.  
  1198. java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  1199.  
  1200. clipboard.setContents(selection, selection);
  1201.  
  1202. println("Clipboard has been reset.");
  1203. }
  1204.  
  1205. else if ((has("graphing") && has("calculator")) || has("desmos") || has("graphing"))
  1206. {
  1207. InternetConnect("https://www.desmos.com/calculator");
  1208. }
  1209.  
  1210. else if (has("airHeads xtremes") || has("candy"))
  1211. {
  1212. InternetConnect("http://airheads.com/candy#xtremes");
  1213. }
  1214.  
  1215. else if (has("prime"))
  1216. {
  1217. String PrimeString = (GetInput("Enter any positive integer and I will tell you if\nit's prime and what it's divisible by."));
  1218.  
  1219. if (PrimeString != null && !PrimeString.equals(""))
  1220. {
  1221. int Prime = Integer.parseInt(PrimeString);
  1222.  
  1223. ArrayList<Integer> Numbers = new ArrayList<Integer>();
  1224.  
  1225. for (int i = 2; i <= Prime/2; i++)
  1226. {
  1227. if (Prime % i == 0)
  1228. {
  1229. Numbers.add(i);
  1230. }
  1231. }
  1232.  
  1233. if (Numbers.isEmpty())
  1234. {
  1235. println("The integer " + Prime + " is indeed a prime number.");
  1236. }
  1237.  
  1238. else
  1239. {
  1240. println("The integer " + Prime + " is not a prime number because it is divisible by " + Numbers);
  1241. }
  1242. }
  1243. }
  1244.  
  1245. else if (has("youtube") && (!has("word search") && !has("mode") && !has("random") && !has("thumbnail")))
  1246. {
  1247. String VideoReq = GetInput("What would you like to search YouTube for?");
  1248.  
  1249. if (VideoReq != null && !VideoReq.equals(""))
  1250. {
  1251. VideoReq = VideoReq.replace("'", "").replace(" ", "+");
  1252.  
  1253. InternetConnect("https://www.youtube.com/results?search_query=" + VideoReq);
  1254. }
  1255. }
  1256.  
  1257. else if ((has("google") && !has("mode") && !has("stupid")))
  1258. {
  1259. String google = GetInput("What would you like to Google?");
  1260.  
  1261. if (google != null && !google.equals(""))
  1262. {
  1263. google = google.replace("'", "").replace(" ", "+");
  1264.  
  1265. InternetConnect("https://www.google.com/search?q=" + google);
  1266. }
  1267. }
  1268.  
  1269. else if (EIC("404"))
  1270. {
  1271. InternetConnect("http://google.com/=");
  1272. }
  1273.  
  1274. else if (has("calculator") && !has("graphing"))
  1275. {
  1276. SwingFeel(ConsoleFrame);
  1277.  
  1278. Calculator();
  1279. }
  1280.  
  1281. else if (FirstWord.equalsIgnoreCase("echo"))
  1282. {
  1283. String sentences[] = operation.split(" ");
  1284.  
  1285. for (int i = 1; i<sentences.length;i++)
  1286. {
  1287. print(sentences[i] + " ");
  1288.  
  1289. }
  1290.  
  1291. println("");
  1292. }
  1293.  
  1294. else if ((FirstWord.equalsIgnoreCase("print") || FirstWord.equalsIgnoreCase("println")) && !has("mode"))
  1295. {
  1296. String sentences[] = operation.split(" ");
  1297.  
  1298. for (int i = 1 ; i < sentences.length ; i++)
  1299. {
  1300. print(sentences[i] + " ");
  1301. }
  1302.  
  1303. println("");
  1304. }
  1305.  
  1306. else if (has("triangle"))
  1307. {
  1308. InternetConnect("https://www.triangle-calculator.com/");
  1309. }
  1310.  
  1311. else if (EIC("why"))
  1312. {
  1313. println("Why not?");
  1314. }
  1315.  
  1316. else if (EIC("why not"))
  1317. {
  1318. println("Why?");
  1319. }
  1320.  
  1321. else if (has("groovy"))
  1322. {
  1323. println("Alright Scooby Doo.");
  1324. }
  1325.  
  1326. else if (has("dbquit"))
  1327. {
  1328. DebugMode = false;
  1329. }
  1330.  
  1331. else if (has("luck"))
  1332. {
  1333. if (Math.random() * 100 <= 0.001)
  1334. {
  1335. println("YOU WON!!");
  1336. }
  1337.  
  1338. else
  1339. {
  1340. println("You are not lucky today.");
  1341. }
  1342. }
  1343.  
  1344. else if (has("are you sure") || has("are you certain"))
  1345. {
  1346. if (Math.random() <= 0.5)
  1347. {
  1348. println("No");
  1349. }
  1350.  
  1351. else
  1352. {
  1353. println("Yes");
  1354. }
  1355. }
  1356.  
  1357. else if (has("math") && !EIC("mathsh"))
  1358. {
  1359. String Math = GetInput("What math operation would you like to perform?");
  1360.  
  1361. if (Math != null && !Math.equals(""))
  1362. {
  1363. Math = Math.replace("'", "").replace(" ", "+");
  1364.  
  1365. InternetConnect("https://www.wolframalpha.com/input/?i=" + Math);
  1366. }
  1367. }
  1368.  
  1369. else if (has("nathan") || EIC("me"))
  1370. {
  1371. draw("SASIDFiles\\Pictures\\me.png");
  1372. }
  1373.  
  1374. else if (has("youtube") && has("mode"))
  1375. {
  1376. if (has("true"))
  1377. {
  1378. println("YouTube mode has been set to true.");
  1379. YouTubeMode = true;
  1380. GoogleMode = false;
  1381. ToDoListMode = false;
  1382. PrintMode = false;
  1383. }
  1384.  
  1385. else if (has("false"))
  1386. {
  1387. println("YouTube mode has been set to false.");
  1388. YouTubeMode = false;
  1389. GoogleMode = false;
  1390. ToDoListMode = true;
  1391. PrintMode = false;
  1392. }
  1393.  
  1394. else
  1395. {
  1396. println("Please specify the boolean value of YouTube mode.");
  1397. }
  1398. }
  1399.  
  1400. else if (has("google") && has("mode"))
  1401. {
  1402. if (has("true"))
  1403. {
  1404. println("Google mode has been set to true.");
  1405. GoogleMode = true;
  1406. YouTubeMode = false;
  1407. ToDoListMode = false;
  1408. PrintMode = false;
  1409. }
  1410.  
  1411. else if (has("false"))
  1412. {
  1413. println("Google mode has been set to false.");
  1414. GoogleMode = false;
  1415. YouTubeMode = false;
  1416. ToDoListMode = true;
  1417. PrintMode = false;
  1418. }
  1419.  
  1420. else
  1421. {
  1422. println("Please specify the boolean value of Google mode.");
  1423. }
  1424. }
  1425.  
  1426. else if (has("todo") && has("mode"))
  1427. {
  1428. if (has("true"))
  1429. {
  1430. println("to-do mode has been set to true.");
  1431. GoogleMode = false;
  1432. YouTubeMode = false;
  1433. ToDoListMode = true;
  1434. PrintMode = false;
  1435. }
  1436.  
  1437. else if (has("false"))
  1438. {
  1439. println("to-do mode has been set to false.");
  1440. GoogleMode = true;
  1441. YouTubeMode = false;
  1442. ToDoListMode = false;
  1443. PrintMode = false;
  1444. }
  1445.  
  1446. else
  1447. {
  1448. println("Please specify the boolean value of to-do mode.");
  1449. }
  1450. }
  1451.  
  1452. else if (has("print") && has("mode"))
  1453. {
  1454. if (has("true"))
  1455. {
  1456. println("print mode has been set to true.");
  1457. PrintMode = true;
  1458. GoogleMode = false;
  1459. YouTubeMode = false;
  1460. ToDoListMode = false;
  1461. }
  1462.  
  1463. else if (has("false"))
  1464. {
  1465. println("print mode has been set to false.");
  1466. GoogleMode = false;
  1467. YouTubeMode = false;
  1468. ToDoListMode = true;
  1469. PrintMode = false;
  1470. }
  1471.  
  1472. else
  1473. {
  1474. println("Please specify the boolean value of print mode.");
  1475. }
  1476. }
  1477.  
  1478. else if (has("position") && has("mode"))
  1479. {
  1480. if (has("true"))
  1481. {
  1482. println("Position mode has been set to true.");
  1483.  
  1484. PositionMode = true;
  1485. }
  1486.  
  1487. else if (has("false"))
  1488. {
  1489. println("Position mode has been set to false.");
  1490.  
  1491. PositionMode = false;
  1492. }
  1493.  
  1494. else
  1495. {
  1496. println("Please specify the boolean value of Position mode.");
  1497. }
  1498. }
  1499.  
  1500. else if (has("always on top mode"))
  1501. {
  1502. if (has("true"))
  1503. {
  1504. println("Always on top mode has been set to true.");
  1505.  
  1506. AlwaysOnTop = true;
  1507.  
  1508. ConsoleFrame.setAlwaysOnTop(true);
  1509. }
  1510.  
  1511. else if (has("false"))
  1512. {
  1513. println("Always on top mode has been set to false.");
  1514.  
  1515. AlwaysOnTop = true;
  1516.  
  1517. ConsoleFrame.setAlwaysOnTop(false);
  1518. }
  1519.  
  1520. else
  1521. {
  1522. println("Please specify the boolean value of always on top mode.");
  1523. }
  1524. }
  1525.  
  1526. else if (has("error") && !has("throw"))
  1527. {
  1528. if (DebugMode)
  1529. {
  1530. File WhereItIs = new File("SASIDFiles\\Errors");
  1531.  
  1532. Desktop.getDesktop().open(WhereItIs);
  1533. }
  1534.  
  1535. else
  1536. {
  1537. println("There are no errors here.");
  1538. }
  1539. }
  1540.  
  1541. else if (EIC("help"))
  1542. {
  1543. Help();
  1544. }
  1545.  
  1546. else if (has("light") && has("saber"))
  1547. {
  1548. PlayMusic("SASIDFiles\\Audio\\Lightsaber.mp3");
  1549. }
  1550.  
  1551. else if (has("xbox"))
  1552. {
  1553. PlayMusic("SASIDFiles\\Audio\\xbox.mp3");
  1554. }
  1555.  
  1556. else if (has("star trek"))
  1557. {
  1558. PlayMusic("SASIDFiles\\Audio\\StarTrek.mp3");
  1559. }
  1560.  
  1561. else if (has("it goes down"))
  1562. {
  1563. OpenFile("SASIDFiles\\Video\\ItGoesDown.mp4");
  1564. }
  1565.  
  1566. else if (EIC("cmd") || (has("command") && has("prompt")))
  1567. {
  1568. File WhereItIs = new File("c:\\Windows\\System32\\cmd.exe");
  1569.  
  1570. Desktop.getDesktop().open(WhereItIs);
  1571. }
  1572.  
  1573. else if (has("shakespeare"))
  1574. {
  1575. int rand = RI(1,2);
  1576.  
  1577. if (rand == 1)
  1578. {
  1579. println("Glamis hath murdered sleep, and therefore Cawdor shall sleep no more, Macbeth shall sleep no more.");
  1580. }
  1581.  
  1582. else
  1583. {
  1584. println("To be, or not to be, that is the question: Whether 'tis nobler in the mind to suffer the slings and arrows of "
  1585. + "outrageous fortune, or to take arms against a sea of troubles and by opposing end them.");
  1586. }
  1587. }
  1588.  
  1589. else if (has("windows"))
  1590. {
  1591. PlayMusic("SASIDFiles\\Audio\\windows.mp3");
  1592. }
  1593.  
  1594. else if (has("binary"))
  1595. {
  1596. String ToInt = GetInput("Enter a decimal number to be converted to binary.");
  1597.  
  1598. if (ToInt.matches("[0-9]+") && ToInt != null && !ToInt.equals(""))
  1599. {
  1600. String Print = ToBinary(Integer.parseInt(ToInt));
  1601.  
  1602. println(ToInt + " converted to binary equals: " + Print);
  1603. }
  1604.  
  1605. else
  1606. {
  1607. println("Your value must only contain numbers.");
  1608. }
  1609. }
  1610.  
  1611. else if (has("pizza"))
  1612. {
  1613. SwingFeel(ConsoleFrame);
  1614.  
  1615. PizzaPlace();
  1616. }
  1617.  
  1618. else if (EIC("imposible"))
  1619. {
  1620. println("¿Lo es?");
  1621. }
  1622.  
  1623. else if (EIC("look"))
  1624. {
  1625. println("L()()K ---->> !FREE STUFF! <<---- L()()K");
  1626. }
  1627.  
  1628. else if (EIC("sasid"))
  1629. {
  1630. println("Yes?");
  1631. }
  1632.  
  1633. else if (FirstWord.equalsIgnoreCase("define"))
  1634. {
  1635. String Define = operation.toLowerCase().replace("'", "").replace(" ", "+").replace("define", "");
  1636.  
  1637. InternetConnect("http://www.dictionary.com/browse/" + Define + "?s=t");
  1638. }
  1639.  
  1640. else if (has("wikipedia"))
  1641. {
  1642. String Wiki = GetInput("What would you like to look up on Wikipedia?");
  1643.  
  1644. if (Wiki != null && !Wiki.equals(""))
  1645. {
  1646. Wiki = Wiki.replace("'", "").replace(" ","_");
  1647.  
  1648. InternetConnect("https://en.wikipedia.org/wiki/" + Wiki);
  1649. }
  1650. }
  1651.  
  1652. else if (FirstWord.equalsIgnoreCase("synonym"))
  1653. {
  1654. String Syn = operation.replace("synonym","");
  1655.  
  1656. Syn = Syn.replace("'", "").replace(" ", "+");
  1657.  
  1658. InternetConnect("http://www.thesaurus.com//browse//" + Syn);
  1659. }
  1660.  
  1661. else if (has("board"))
  1662. {
  1663. InternetConnect("http://gameninja.com//games//fly-squirrel-fly.html");
  1664. }
  1665.  
  1666. else if (EIC("open cd"))
  1667. {
  1668. OpenCD("D:\\");
  1669. }
  1670.  
  1671. else if (EIC("close cd"))
  1672. {
  1673. CloseCD("D:\\");
  1674. }
  1675.  
  1676. else if (EIC("font"))
  1677. {
  1678. SwingFeel(ConsoleFrame);
  1679.  
  1680. font();
  1681.  
  1682. WindowsFeel(ConsoleFrame);
  1683. }
  1684.  
  1685. else if (has("font") && has("reset"))
  1686. {
  1687. InputField.setFont(DefaultFont);
  1688.  
  1689. OutputArea.setFont(DefaultFont);
  1690.  
  1691. println("The font has been reset.");
  1692. }
  1693.  
  1694. else if (EIC("color"))
  1695. {
  1696. SwingFeel(ConsoleFrame);
  1697.  
  1698. Color();
  1699.  
  1700. WindowsFeel(ConsoleFrame);
  1701. }
  1702.  
  1703. else if (has("reset") && has("color"))
  1704. {
  1705. OutputArea.setForeground(new Color(255,255,255));
  1706.  
  1707. InputField.setForeground(new Color(255,255,255));
  1708.  
  1709. println("The text color has been reset.");
  1710. }
  1711.  
  1712.  
  1713. else if (EIC("top left"))
  1714. {
  1715. ConsoleFrame.setLocation(0,0);
  1716. }
  1717.  
  1718. else if (EIC("top right"))
  1719. {
  1720. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  1721.  
  1722. GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
  1723.  
  1724. Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
  1725.  
  1726. int X = (int) rect.getMaxX() - ConsoleFrame.getWidth();
  1727.  
  1728. ConsoleFrame.setLocation(X, 0);
  1729. }
  1730.  
  1731. else if (EIC("bottom left"))
  1732. {
  1733. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  1734.  
  1735. GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
  1736.  
  1737. Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
  1738.  
  1739. int Y = (int) rect.getMaxY() - ConsoleFrame.getHeight();
  1740.  
  1741. ConsoleFrame.setLocation(0, Y);
  1742. }
  1743.  
  1744. else if (EIC("bottom right"))
  1745. {
  1746. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  1747.  
  1748. GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
  1749.  
  1750. Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
  1751.  
  1752. int X = (int) rect.getMaxX();
  1753.  
  1754. int Y = (int) rect.getMaxY();
  1755.  
  1756. ConsoleFrame.setLocation(X - ConsoleFrame.getWidth(),Y - ConsoleFrame.getHeight());
  1757. }
  1758.  
  1759. else if (EIC("middle") || EIC("center"))
  1760. {
  1761. ConsoleFrame.setLocationRelativeTo(null);
  1762. }
  1763.  
  1764. else if (has("random") && has("youtube"))
  1765. {
  1766. boolean FollowThrough = YesOrNo("You are about to run a script which\n"
  1767. + "will randomly generate unique\n"
  1768. + "YouTube video ID's until it finds a\n"
  1769. + "valid one. This will most likely take\n"
  1770. + "a while. Are you sure you wish to continue?");
  1771.  
  1772. if (FollowThrough)
  1773. {
  1774. println("The script has started. At any point, type \"stop script\" to stop the script.");
  1775.  
  1776. RandomYoutube();
  1777. }
  1778. }
  1779.  
  1780. else if (EIC("pin") || EIC("login"))
  1781. {
  1782. Login(true);
  1783. }
  1784.  
  1785. else if (has("arduino"))
  1786. {
  1787. InternetConnect("https://www.arduino.cc/");
  1788. }
  1789.  
  1790. else if (has("rasberry pi"))
  1791. {
  1792. InternetConnect("https://www.raspberrypi.org/");
  1793. }
  1794.  
  1795. else if (EIC("&&"))
  1796. {
  1797. println("||");
  1798. }
  1799.  
  1800. else if (EIC("||"))
  1801. {
  1802. println("&&");
  1803. }
  1804.  
  1805. else if (EIC("youtube word search"))
  1806. {
  1807. String Word = GetInput("Enter the desired word you would like to find in a YouTube URL");
  1808.  
  1809. if (Word != null && !Word.equals(""))
  1810. {
  1811. String browse = "https://www.google.com/search?q=allinurl:REPLACE site:youtube.com";
  1812.  
  1813. browse = browse.replace("REPLACE", Word).replace(" ", "+");
  1814.  
  1815. InternetConnect(browse);
  1816. }
  1817. }
  1818.  
  1819. else if (has("disco"))
  1820. {
  1821. String iterations = GetInput("How many iterations would you like to disco for?");
  1822.  
  1823. if (iterations != null && !iterations.equals(""))
  1824. {
  1825. Disco(Integer.parseInt(iterations));
  1826. }
  1827. }
  1828.  
  1829. else if (has("game"))
  1830. {
  1831. File WhereItIs = new File("SASIDFiles\\Jars\\Jailbreak.jar");
  1832.  
  1833. Desktop.getDesktop().open(WhereItIs);
  1834. }
  1835.  
  1836. else if (EIC("mathsh"))
  1837. {
  1838. MathShellMode = true;
  1839.  
  1840. CLC();
  1841.  
  1842. MathShell("");
  1843. }
  1844.  
  1845. else if (has("clear") && (has("operation") || has ("command")))
  1846. {
  1847. OperationList.clear();
  1848.  
  1849. ScrollingIndex = 0;
  1850.  
  1851. println("The operation list has been cleared.");
  1852. }
  1853.  
  1854. else if (has("there") && has("no") && has("internet"))
  1855. {
  1856. println("Sucks to be you.");
  1857. }
  1858.  
  1859. else if (EIC("i hate you"))
  1860. {
  1861. println("That's not very nice.");
  1862. }
  1863.  
  1864. else if (EIC("netsh"))
  1865. {
  1866. File WhereItIs = new File("C:\\Windows\\system32\\netsh.exe");
  1867.  
  1868. Desktop.getDesktop().open(WhereItIs);
  1869. }
  1870.  
  1871. else if (has("system properties"))
  1872. {
  1873. ShowProperties();
  1874. }
  1875.  
  1876. else if (EIC("preferences") || EIC("prefs"))
  1877. {
  1878. SwingFeel(ConsoleFrame);
  1879.  
  1880. Preferences();
  1881. }
  1882.  
  1883. else if (has("story") && has("tell"))
  1884. {
  1885. println("It was a lazy day. SASID was enjoying a deep sleep when suddenly " + Username + " started talking to SASID."
  1886. + " It was at this moment that SASID knew its day had been ruined.");
  1887. }
  1888.  
  1889. else if (EIC("hey"))
  1890. {
  1891. println("Hey hey.");
  1892. }
  1893.  
  1894. else if (EIC("panic"))
  1895. {
  1896. exit();
  1897. }
  1898.  
  1899. else if (EIC("hash"))
  1900. {
  1901. SwingFeel(ConsoleFrame);
  1902.  
  1903. CreateHash();
  1904. }
  1905.  
  1906. else if (has("home"))
  1907. {
  1908. println("There's no place like 127.0.0.1");
  1909. }
  1910.  
  1911. else if (EIC("search") || EIC("dir") || (has("file") && has("search")) || EIC("directory") || EIC("ls"))
  1912. {
  1913. WindowsFeel(ConsoleFrame);
  1914.  
  1915. DirectorySearch();
  1916.  
  1917. SwingFeel(ConsoleFrame);
  1918. }
  1919.  
  1920. else if (has("I") && has("love"))
  1921. {
  1922. println("Sorry, " + Username + ", but I don't understand human affection.");
  1923. }
  1924.  
  1925. else if (has("vexento"))
  1926. {
  1927. InternetConnect("https://www.youtube.com/user/Vexento/videos");
  1928. }
  1929.  
  1930. else if (has("minecraft"))
  1931. {
  1932. println("GET OUT OF MY ROOM I'M PLAYING MINECRAFT!");
  1933. }
  1934.  
  1935. else if (EIC("loop"))
  1936. {
  1937. println("Handle(\"loop\");");
  1938. }
  1939.  
  1940. else if (EIC("sasid dir"))
  1941. {
  1942. if (DebugMode == true)
  1943. {
  1944. String CurrentDir = System.getProperty("user.dir");
  1945.  
  1946. OpenFile(CurrentDir);
  1947. }
  1948.  
  1949. else
  1950. {
  1951. println("Sorry, " + Username + ", but you don't have permission to do that.");
  1952. }
  1953. }
  1954.  
  1955. else if ((has("tic") && has("tac") && has("toe")) || EIC("TTT"))
  1956. {
  1957. SwingFeel(ConsoleFrame);
  1958.  
  1959. TicTacToe();
  1960. }
  1961.  
  1962. else if (has("note"))
  1963. {
  1964. SwingFeel(ConsoleFrame);
  1965.  
  1966. Note();
  1967. }
  1968.  
  1969. else if ((has("youtube") && has("thumbnail")) || (has("yt") && has("thumb")))
  1970. {
  1971. SwingFeel(ConsoleFrame);
  1972.  
  1973. YouTubeThumbnail();
  1974. }
  1975.  
  1976. else if (has("class"))
  1977. {
  1978. InternetConnect("https://my.msstate.edu/web/home-community/banner#");
  1979. }
  1980.  
  1981. else if (has("msu") && has("map"))
  1982. {
  1983. InternetConnect("https://map.msstate.edu/map/?id=233#");
  1984. }
  1985.  
  1986. else if (EIC("housing"))
  1987. {
  1988. InternetConnect("https://iis.housing.msstate.edu/StarRezPortal/Default.aspx?Params=L9ezxPcQnQuRGKTzF%2b4sxb3feWCDviBo");
  1989. }
  1990.  
  1991. else if (has("scholarship"))
  1992. {
  1993. InternetConnect("https://msstate.academicworks.com/applications");
  1994. }
  1995.  
  1996. else if (has("helix"))
  1997. {
  1998. InternetConnect("http://helixstarkville.com/");
  1999. }
  2000.  
  2001. else if (has("papers") && has("please"))
  2002. {
  2003. InternetConnect("http://papersplea.se/");
  2004. }
  2005.  
  2006. else if (has("java"))
  2007. {
  2008. println("public class Apples");
  2009. println("{");
  2010. println(" public static void main(String[] args)");
  2011. println(" {");
  2012. println(" System.out.println(\"Hello World!\");");
  2013. println(" }");
  2014. println("}");
  2015. }
  2016.  
  2017. else if (has("coffee"))
  2018. {
  2019. InternetConnect("https://www.google.com/search?q=coffe+shops+near+me");
  2020. }
  2021.  
  2022. else if (EIC("ip") || has(" ip") || has(" ip"))
  2023. {
  2024. println(InetAddress.getLocalHost().getHostAddress());
  2025. }
  2026.  
  2027. else if(has("html5"))
  2028. {
  2029. draw("SASIDFiles\\Pictures\\html5.png");
  2030. }
  2031.  
  2032. else if (EIC("css"))
  2033. {
  2034. draw("SASIDFiles\\Pictures\\css.png");
  2035. }
  2036.  
  2037. else if ((has("create") || has("new")) && has("user"))
  2038. {
  2039. SwingFeel(ConsoleFrame);
  2040.  
  2041. CreateUser();
  2042. }
  2043.  
  2044. else if(has("computer") && has("properties"))
  2045. {
  2046. SwingFeel(ConsoleFrame);
  2047.  
  2048. ComputerProperties();
  2049. }
  2050.  
  2051. else if ((has("delete") || has("remove")) && (has("user") || has("account")))
  2052. {
  2053. SwingFeel(ConsoleFrame);
  2054.  
  2055. DeleteAccount();
  2056. }
  2057.  
  2058. else if (has("system") && has("sounds"))
  2059. {
  2060. SwingFeel(ConsoleFrame);
  2061.  
  2062. SystemSounds();
  2063. }
  2064.  
  2065. else if ((has("pixelate") || has("distort")) && (has("image") || has("picture")))
  2066. {
  2067. WindowsFeel(ConsoleFrame);
  2068.  
  2069. File File = GetFile("Select the file you wish to pixelate");
  2070.  
  2071. if (File != null && File.getName().endsWith(".png"))
  2072. {
  2073. String Input = GetInput("How pixelated do you want the image? A higher number corresponds to less pixels.");
  2074.  
  2075. if (Input != null && !Input.equals(""))
  2076. {
  2077. Pixelate(File, Integer.parseInt(Input));
  2078.  
  2079. SwingFeel(ConsoleFrame);
  2080. }
  2081. }
  2082. }
  2083.  
  2084. else if (has("donuts"))
  2085. {
  2086. InternetConnect("https://www.dunkindonuts.com/en/food-drinks/donuts/donuts");
  2087. }
  2088.  
  2089. else if (has("anagram"))
  2090. {
  2091. String Word1 = GetInput("This function will tell you if two\n"
  2092. + "words are anagrams of each other.\n"
  2093. + "Enter your first word");
  2094.  
  2095. String Word2 = GetInput("Enter your second word");
  2096.  
  2097. if (Word1.length() != Word2.length())
  2098. {
  2099. println("These words are not anagrams of each other.");
  2100. }
  2101.  
  2102. else if (Word1.equalsIgnoreCase(Word2))
  2103. {
  2104. println("These words are in fact anagrams of each other.");
  2105. }
  2106.  
  2107. else
  2108. {
  2109. char[] W1C = Word1.toCharArray();
  2110.  
  2111. char[] W2C = Word2.toCharArray();
  2112.  
  2113. Arrays.sort(W1C);
  2114.  
  2115. Arrays.sort(W2C);
  2116.  
  2117. if (Arrays.equals(W1C, W2C))
  2118. {
  2119. println("These words are in fact anagrams of each other.");
  2120. }
  2121. }
  2122. }
  2123.  
  2124. else if (has("alphabet") && (has("sort") || has("organize") || has("arrange")))
  2125. {
  2126. String Sort = GetInput("Enter your word to be alphabetically organized");
  2127.  
  2128. char[] Sorted = Sort.toCharArray();
  2129.  
  2130. Arrays.sort(Sorted);
  2131.  
  2132. println(new String(Sorted));
  2133. }
  2134.  
  2135. else if (has("mp3") || has("music"))
  2136. {
  2137. WindowsFeel(ConsoleFrame);
  2138.  
  2139. mp3(null);
  2140.  
  2141. SwingFeel(ConsoleFrame);
  2142. }
  2143.  
  2144. else if (has("bai"))
  2145. {
  2146. InternetConnect("http://www.drinkbai.com");
  2147. }
  2148.  
  2149. else if (has("occam") && has("razor"))
  2150. {
  2151. InternetConnect("http://en.wikipedia.org/wiki/Occam%27s_razor");
  2152. }
  2153.  
  2154. else if (has("sasid") && (has("picture") ||has("image")))
  2155. {
  2156. if (DebugMode)
  2157. {
  2158. OpenFile("SASIDFiles\\Pictures");
  2159. }
  2160.  
  2161. else
  2162. {
  2163. println("Sorry, " + Username + ", but you do not have permission to access that.");
  2164. }
  2165. }
  2166.  
  2167. else if (has("when") && has("thanksgiving"))
  2168. {
  2169. int year = Calendar.getInstance().get(Calendar.YEAR);
  2170.  
  2171. LocalDate RealTG = LocalDate.of(year, 11, 1).with(TemporalAdjusters.dayOfWeekInMonth(4, DayOfWeek.THURSDAY));
  2172.  
  2173. println("Thanksgiving this year is on the " + RealTG.getDayOfMonth() + " of November.");
  2174. }
  2175.  
  2176. else if (has("location") || (has("where") && has("am") && has("i")))
  2177. {
  2178. Location();
  2179.  
  2180. println("You are currently in " + UserCity + ", " + UserState + " and your Internet Service Provider is " + UserISP);
  2181. }
  2182.  
  2183. else if (has("fibonacci"))
  2184. {
  2185. print("0, 1");
  2186.  
  2187. Fib(0,1);
  2188. }
  2189.  
  2190. else if (has("edit") && has ("user"))
  2191. {
  2192. SwingFeel(ConsoleFrame);
  2193.  
  2194. EditUser();
  2195. }
  2196.  
  2197. else if (has("throw") && has("error"))
  2198. {
  2199. throw new IOException("Error thrown on " + UserTime());
  2200. }
  2201.  
  2202. else if (has("asdf"))
  2203. {
  2204. println("Who is the spiciest meme lord?");
  2205. }
  2206.  
  2207. else if (has("qwerty"))
  2208. {
  2209. println("I prefer Dvorak, but I also like Colemak, Maltron, and JCUKEN.");
  2210. }
  2211.  
  2212. else if (EIC("thor") || has("thor ") || has(" thor"))
  2213. {
  2214. println("Piss off, ghost.");
  2215. }
  2216.  
  2217. else if ((has("social") && has("media")) || (has("media") && has("widget")))
  2218. {
  2219. SwingFeel(ConsoleFrame);
  2220.  
  2221. SocialMedia();
  2222. }
  2223.  
  2224. else if (EIC("about:blank"))
  2225. {
  2226. InternetConnect("about:blank");
  2227. }
  2228.  
  2229. else if (has("weather"))
  2230. {
  2231. WeatherWidget();
  2232. }
  2233.  
  2234. else if (has("hide"))
  2235. {
  2236. ConsoleFrame.setVisible(false);
  2237. }
  2238.  
  2239. else if (has("stop") && has("script"))
  2240. {
  2241. println("The YouTube script has been stopped.");
  2242.  
  2243. YouTubeScript = false;
  2244.  
  2245. ConsoleFrame.setTitle(SASIDVer + " [" + Username + "]");
  2246. }
  2247.  
  2248. else if (EIC("Debug"))
  2249. {
  2250. if (DebugMode)
  2251. {
  2252. Debug();
  2253. }
  2254.  
  2255. else
  2256. {
  2257. println("Sorry, " + Username + ", but you do not have permission to use that feature.");
  2258. }
  2259. }
  2260.  
  2261. else if (has("hangman"))
  2262. {
  2263. Hangman();
  2264. }
  2265.  
  2266. else
  2267. {
  2268. if (GoogleMode)
  2269. {
  2270. operation = operation.replace("'", "").replace(" ", "+");
  2271.  
  2272. InternetConnect("https://www.google.com/search?q=" + operation);
  2273. }
  2274.  
  2275. else if (YouTubeMode)
  2276. {
  2277. operation = operation.replace("'", "").replace(" ", "+");
  2278.  
  2279. InternetConnect("https://www.youtube.com/results?search_query=" + operation);
  2280. }
  2281.  
  2282. else if (PrintMode)
  2283. {
  2284. println(OriginalOperation);
  2285. }
  2286.  
  2287. else
  2288. {
  2289. String ToDo = GetInput("I'm not sure how to respond to that. What should I do when I see:\n" + operation + "?");
  2290.  
  2291. LogToDo(ToDo);
  2292. }
  2293. }
  2294. }
  2295.  
  2296. catch (Exception e)
  2297. {
  2298. LogError(e);
  2299. }
  2300. }
  2301.  
  2302. @Override
  2303. public void actionPerformed(ActionEvent event)
  2304. {
  2305. DecimalFormat df2 = new DecimalFormat(".####");
  2306.  
  2307. Object control = event.getSource();
  2308.  
  2309. if (control == Calculate)
  2310. {
  2311. try
  2312. {
  2313. if (OldKelvin.isSelected() && CalculationValue <= 0)
  2314. {
  2315. QBox("Temperatures below absolute zero are imposible.");
  2316. }
  2317.  
  2318. else
  2319. {
  2320. CalculationValue = Double.parseDouble(StartingValue.getText());
  2321.  
  2322. if (OldFahrenheit.isSelected())
  2323. {
  2324. if (NewFahrenheit.isSelected())
  2325. {
  2326. QBox("Get out of here with that. Your value is already in Fahrenheit.");
  2327. }
  2328.  
  2329. else if (NewCelsius.isSelected())
  2330. {
  2331. double CelsiusFromFahrenheit;
  2332.  
  2333. CelsiusFromFahrenheit = (CalculationValue - 32.0) / 1.8;
  2334.  
  2335. QBox( CalculationValue + " Fahrenheit converted to Celsius equals: "
  2336. + df2.format(CelsiusFromFahrenheit));
  2337.  
  2338. StartingValue.setText("");
  2339.  
  2340. RadioCurrentValueGroup.clearSelection();
  2341.  
  2342. RadioNewValueGroup.clearSelection();
  2343. }
  2344.  
  2345. else if (NewKelvin.isSelected())
  2346. {
  2347. double KelvinFromFahrenheit;
  2348.  
  2349. KelvinFromFahrenheit = (CalculationValue +459.67) * 5/9;
  2350.  
  2351. if (KelvinFromFahrenheit >= 0)
  2352. {
  2353. QBox(CalculationValue + " Fahrenheit converted to Kelvin equals: "
  2354. + df2.format(KelvinFromFahrenheit));
  2355.  
  2356. StartingValue.setText("");
  2357.  
  2358. RadioCurrentValueGroup.clearSelection();
  2359.  
  2360. RadioNewValueGroup.clearSelection();
  2361. }
  2362.  
  2363. else
  2364. {
  2365. QBox("Temperatures below absolute zero are imposible.");
  2366. }
  2367. }
  2368.  
  2369. }
  2370.  
  2371. else if (OldCelsius.isSelected())
  2372. {
  2373. if (NewFahrenheit.isSelected())
  2374. {
  2375. double FahrenheitFromCelsius;
  2376.  
  2377. FahrenheitFromCelsius = (CalculationValue *1.8) + 32;
  2378.  
  2379. QBox(CalculationValue + " Celsius converted to Fahrenheit equals: "
  2380. + df2.format(FahrenheitFromCelsius));
  2381.  
  2382. StartingValue.setText("");
  2383.  
  2384. RadioCurrentValueGroup.clearSelection();
  2385.  
  2386. RadioNewValueGroup.clearSelection();
  2387. }
  2388.  
  2389. else if (NewCelsius.isSelected())
  2390. {
  2391. QBox("Get out of here with that. Your value is already in Celsius.");
  2392. }
  2393.  
  2394. else if (NewKelvin.isSelected())
  2395. {
  2396. double KelvinFromCelsius;
  2397.  
  2398. KelvinFromCelsius = CalculationValue + 273.15 ;
  2399.  
  2400. if (KelvinFromCelsius >= 0)
  2401. {
  2402. QBox(CalculationValue + " Celsius converted to Kelvin equals: "
  2403. + df2.format(KelvinFromCelsius));
  2404.  
  2405. StartingValue.setText("");
  2406.  
  2407. RadioCurrentValueGroup.clearSelection();
  2408.  
  2409. RadioNewValueGroup.clearSelection();
  2410. }
  2411.  
  2412. else
  2413. {
  2414. QBox("Temperatures below absolute zero are imposible.");
  2415. }
  2416. }
  2417.  
  2418. }
  2419.  
  2420. else if (OldKelvin.isSelected())
  2421. {
  2422. if (NewFahrenheit.isSelected())
  2423. {
  2424. double FahrenheitFromKelvin;
  2425.  
  2426. FahrenheitFromKelvin = CalculationValue * 1.8 - 459.67;
  2427.  
  2428. QBox(CalculationValue + " Kelvin converted to Fahrenheit equals: "
  2429. + df2.format(FahrenheitFromKelvin));
  2430.  
  2431. StartingValue.setText("");
  2432.  
  2433. RadioCurrentValueGroup.clearSelection();
  2434.  
  2435. RadioNewValueGroup.clearSelection();
  2436. }
  2437.  
  2438. else if (NewCelsius.isSelected())
  2439. {
  2440. double CelsiusFromKelvin;
  2441.  
  2442. CelsiusFromKelvin = CalculationValue - 273.15;
  2443.  
  2444. QBox( CalculationValue + " Kelvin converted to Celsius equals: "
  2445. + df2.format(CelsiusFromKelvin));
  2446.  
  2447. StartingValue.setText("");
  2448.  
  2449. RadioCurrentValueGroup.clearSelection();
  2450.  
  2451. RadioNewValueGroup.clearSelection();
  2452. }
  2453.  
  2454. else if (NewKelvin.isSelected())
  2455. {
  2456. QBox("Get out of here with that. Your value is already in Kelvin");
  2457. }
  2458. }
  2459.  
  2460. else
  2461. {
  2462. QBox("Please select your current temperature unit and the one you want to convet to.");
  2463. }
  2464. }
  2465. }
  2466.  
  2467. catch (Exception ex)
  2468. {
  2469. QBox("Your value must only contain numbers.");
  2470. }
  2471. }
  2472.  
  2473. else if (control == ResetValues)
  2474. {
  2475. StartingValue.setText("");
  2476.  
  2477. RadioCurrentValueGroup.clearSelection();
  2478.  
  2479. RadioNewValueGroup.clearSelection();
  2480. }
  2481.  
  2482. else if (control == ClickMe)
  2483. {
  2484. ClickMeFrame.dispose();
  2485.  
  2486. ClickMe();
  2487. }
  2488.  
  2489. else if (control == DialNumber)
  2490. {
  2491. if (PhoneNumber.length() > 0)
  2492. {
  2493. QBox("Dialing: " + PhoneNumber.replace("null", ""));
  2494.  
  2495. PhoneNumber = "";
  2496. }
  2497. }
  2498.  
  2499. else if (control == One)
  2500. {
  2501. PhoneNumber = PhoneNumber + "1";
  2502.  
  2503. NumberLabel.setText(NumberFormat(PhoneNumber));
  2504. }
  2505.  
  2506. else if (control == Two)
  2507. {
  2508. PhoneNumber = PhoneNumber + "2";
  2509.  
  2510. NumberLabel.setText(NumberFormat(PhoneNumber));
  2511. }
  2512.  
  2513. else if (control == Three)
  2514. {
  2515. PhoneNumber = PhoneNumber + "3";
  2516.  
  2517. NumberLabel.setText(NumberFormat(PhoneNumber));
  2518. }
  2519.  
  2520. else if (control == Four)
  2521. {
  2522. PhoneNumber = PhoneNumber + "4";
  2523.  
  2524. NumberLabel.setText(NumberFormat(PhoneNumber));
  2525. }
  2526.  
  2527. else if (control == Five)
  2528. {
  2529. PhoneNumber = PhoneNumber + "5";
  2530.  
  2531. NumberLabel.setText(NumberFormat(PhoneNumber));
  2532. }
  2533.  
  2534. else if (control == Six)
  2535. {
  2536. PhoneNumber = PhoneNumber + "6";
  2537.  
  2538. NumberLabel.setText(NumberFormat(PhoneNumber));
  2539. }
  2540.  
  2541. else if (control == Seven)
  2542. {
  2543. PhoneNumber = PhoneNumber + "7";
  2544.  
  2545. NumberLabel.setText(NumberFormat(PhoneNumber));
  2546. }
  2547.  
  2548. else if (control == Eight)
  2549. {
  2550. PhoneNumber = PhoneNumber + "8";
  2551.  
  2552. NumberLabel.setText(NumberFormat(PhoneNumber));
  2553. }
  2554.  
  2555. else if (control == Nine)
  2556. {
  2557. PhoneNumber = PhoneNumber + "9";
  2558.  
  2559. NumberLabel.setText(PhoneNumber);
  2560. }
  2561.  
  2562. else if (control == Zero)
  2563. {
  2564. PhoneNumber = PhoneNumber + "0";
  2565.  
  2566. NumberLabel.setText(NumberFormat(PhoneNumber));
  2567. }
  2568.  
  2569. else if (control == Back)
  2570. {
  2571. if (PhoneNumber.length() > 0)
  2572. {
  2573. PhoneNumber = PhoneNumber.substring(0, PhoneNumber.length() - 1);
  2574.  
  2575. NumberLabel.setText(NumberFormat(PhoneNumber));
  2576. }
  2577. }
  2578.  
  2579. else if (control == PlaceOrder)
  2580. {
  2581. if (EnterName.getText().length() == 0)
  2582. {
  2583. QBox("Sorry, but you must enter a name.");
  2584. }
  2585.  
  2586. else
  2587. {
  2588. String Name = EnterName.getText().substring(0, 1).toUpperCase() + EnterName.getText().substring(1) + "\n";
  2589.  
  2590. String Size = "";
  2591.  
  2592. if (Small.isSelected())
  2593. {
  2594. Size = "Small\n";
  2595. }
  2596.  
  2597. else
  2598. {
  2599. if (Medium.isSelected())
  2600. {
  2601. Size = "Medium\n";
  2602. }
  2603.  
  2604. else
  2605. {
  2606. Size = "Large\n";
  2607. }
  2608. }
  2609.  
  2610. String Crust = (String)PizzaCrustCombo.getSelectedItem() + "\n";
  2611.  
  2612. List<?> TopingsList = PizzaTopingsList.getSelectedValuesList();
  2613.  
  2614. ArrayList<String> Topings = new ArrayList<String>();
  2615.  
  2616. for (int i = 0 ; i < TopingsList.size() ; i++)
  2617. {
  2618. Topings.add(TopingsList.get(i).toString());
  2619. }
  2620.  
  2621. if (Topings.isEmpty())
  2622. {
  2623. Topings.add("Pepperoni");
  2624.  
  2625. Topings.add("Bacon");
  2626.  
  2627. Topings.add("Banana peppers");
  2628. }
  2629.  
  2630. String TopingsChosen = "";
  2631.  
  2632. for (int i = 0 ; i < Topings.size() ; i++)
  2633. {
  2634. TopingsChosen = TopingsChosen + (String) Topings.get(i) + "\n";
  2635. }
  2636.  
  2637. String Extras = "";
  2638.  
  2639. if (BreadSticks.isSelected())
  2640. {
  2641. Extras += "BreadSticks\n";
  2642. }
  2643.  
  2644. if (Salad.isSelected())
  2645. {
  2646. Extras += "Salad\n";
  2647. }
  2648.  
  2649. if (Soda.isSelected())
  2650. {
  2651. Extras += "Soda\n";
  2652. }
  2653.  
  2654. String Comments = OrderCommentsTextArea.getText().trim();
  2655.  
  2656. if (Extras.length() == 0)
  2657. {
  2658. Extras = "";
  2659. }
  2660.  
  2661. else
  2662. {
  2663. Extras = "\nEXTRAS: " + "\n" + Extras;
  2664. }
  2665.  
  2666. if (Comments.length() == 0)
  2667. {
  2668. QBox("CUSTOMER NAME: " + "\n" + Name + "\n" + "PIZZA SIZE: "
  2669. + "\n" + Size + "\n" + "CRUST TYPE: " + "\n" + Crust + "\n" + "TOPINGS: " + "\n" + TopingsChosen
  2670. + "\n" + Extras);
  2671. }
  2672.  
  2673. else
  2674. {
  2675. QBox("CUSTOMER NAME: " + "\n" + Name + "\n" + "PIZZA SIZE: "
  2676. + "\n" + Size + "\n" + "CRUST TYPE: " + "\n" + Crust + "\n" + "TOPINGS: " + "\n" + TopingsChosen
  2677. + "\n" + Extras + "\nADDITIONAL COMMENTS: " + "\n" + Comments);
  2678. }
  2679. }
  2680. }
  2681.  
  2682. else if (control == ResetPizza)
  2683. {
  2684. EnterName.setText("");
  2685.  
  2686. Small.setSelected(true);
  2687.  
  2688. PizzaCrustCombo.setSelectedItem("Thin");
  2689.  
  2690. PizzaTopingsList.clearSelection();
  2691.  
  2692. BreadSticks.setSelected(false);
  2693.  
  2694. Salad.setSelected(false);
  2695.  
  2696. Soda.setSelected(false);
  2697.  
  2698. OrderCommentsTextArea.setText("");
  2699. }
  2700.  
  2701. else if (control == minimize)
  2702. {
  2703. RestoreX = ConsoleFrame.getX();
  2704.  
  2705. RestoreY = ConsoleFrame.getY();
  2706.  
  2707. MinimizeAnimation(ConsoleFrame);
  2708.  
  2709. ConsoleFrame.setState(Frame.ICONIFIED);
  2710. }
  2711.  
  2712. else if (control == close)
  2713. {
  2714. try
  2715. {
  2716. Rob = new Robot();
  2717. }
  2718.  
  2719. catch (Exception e)
  2720. {
  2721. LogError(e);
  2722. }
  2723.  
  2724. Rob.keyPress(KeyEvent.VK_CONTROL);
  2725. Rob.keyPress(KeyEvent.VK_ALT);
  2726. Rob.keyPress(KeyEvent.VK_UP);
  2727. Rob.keyRelease(KeyEvent.VK_CONTROL);
  2728. Rob.keyRelease(KeyEvent.VK_ALT);
  2729. Rob.keyRelease(KeyEvent.VK_UP);
  2730.  
  2731. exit();
  2732. }
  2733.  
  2734. else if (control == Apply)
  2735. {
  2736. int RedValue = Integer.parseInt(Red.getText());
  2737.  
  2738. int GreenValue = Integer.parseInt(Green.getText());
  2739.  
  2740. int BlueValue = Integer.parseInt(Blue.getText());
  2741.  
  2742. if ((RedValue > 255) || (BlueValue > 255) || (GreenValue > 255))
  2743. {
  2744. beep();
  2745. }
  2746.  
  2747. else
  2748. {
  2749. OutputArea.setForeground(new Color(RedValue,GreenValue,BlueValue));
  2750.  
  2751. InputField.setForeground(new Color(RedValue,GreenValue,BlueValue));
  2752.  
  2753. CloseAnimation(ColorFrame);
  2754.  
  2755. ColorFrame.dispose();
  2756.  
  2757. println("The color [" + RedValue + "," + GreenValue + "," + BlueValue + "] has been applied.");
  2758. }
  2759. }
  2760.  
  2761. else if (control == CloseLog)
  2762. {
  2763. CloseAnimation(LoginFrame);
  2764.  
  2765. LoginFrame.dispose();
  2766.  
  2767. if (ConsoleFrame == null)
  2768. {
  2769. System.exit(0);
  2770. }
  2771. }
  2772.  
  2773. else if (control == ApplyFont)
  2774. {
  2775. String FontS = (String) FontList.getSelectedValue();
  2776.  
  2777. if (FontS != null)
  2778. {
  2779. Font ApplyFont = new Font(FontS, Font.BOLD, 30);
  2780.  
  2781. OutputArea.setFont(ApplyFont);
  2782.  
  2783. InputField.setFont(ApplyFont);
  2784.  
  2785. println("The font \"" + FontS + "\" has been applied.");
  2786.  
  2787. CloseAnimation(FontFrame);
  2788.  
  2789. FontFrame.dispose();
  2790. }
  2791. }
  2792.  
  2793. else if (control == ApplyPreferences)
  2794. {
  2795. ReadPreferences();
  2796.  
  2797. if (MusicOnStart.isSelected())
  2798. {
  2799. WritePreferences("PlayMusic","1");
  2800.  
  2801. CloseAnimation(PreferencesFrame);
  2802.  
  2803. PreferencesFrame.dispose();
  2804. }
  2805.  
  2806. else if (!MusicOnStart.isSelected())
  2807. {
  2808. WritePreferences("PlayMusic","0");
  2809.  
  2810. CloseAnimation(PreferencesFrame);
  2811.  
  2812. PreferencesFrame.dispose();
  2813. }
  2814.  
  2815. if (SPOS.isSelected())
  2816. {
  2817. WritePreferences("SystemPropertiesOnStart","1");
  2818.  
  2819. CloseAnimation(PreferencesFrame);
  2820.  
  2821. PreferencesFrame.dispose();
  2822. }
  2823.  
  2824. else if (!SPOS.isSelected())
  2825. {
  2826. WritePreferences("SystemPropertiesOnStart","0");
  2827.  
  2828. CloseAnimation(PreferencesFrame);
  2829.  
  2830. PreferencesFrame.dispose();
  2831. }
  2832. }
  2833.  
  2834. else if (control == ChangeSize)
  2835. {
  2836. ValidBackgroundPaths = GetBackgrounds();
  2837.  
  2838. if (ShouldISwitch() && ValidBackgroundPaths.length > 1)
  2839. {
  2840. SwitchBackgroundToLeft();
  2841.  
  2842. SwitchBackground();
  2843.  
  2844. SwitchBackgroundFromLeft();
  2845. }
  2846.  
  2847. else if (OnLastBackground() && ValidBackgroundPaths.length > 1)
  2848. {
  2849. CurrentBackgroundIndex = -1;
  2850.  
  2851. SwitchBackgroundToLeft();
  2852.  
  2853. SwitchBackground();
  2854.  
  2855. SwitchBackgroundFromLeft();
  2856. }
  2857.  
  2858. else if (ValidBackgroundPaths.length == 1)
  2859. {
  2860. boolean FollowThrough = YesOrNo("You only have one background image. Would you like to add more?");
  2861.  
  2862. if (FollowThrough)
  2863. {
  2864. OpenFile("JesseUsers\\" + Username + "\\Backgrounds");
  2865.  
  2866. InternetConnect("https://images.google.com/");
  2867. }
  2868. }
  2869.  
  2870. else
  2871. {
  2872. println("The background image you are trying to switch to does not exist.");
  2873. }
  2874. }
  2875.  
  2876. else if (control == HashButton)
  2877. {
  2878. String PrintHash = Hash(new String(HashField.getPassword()));
  2879.  
  2880. CloseAnimation(HashFrame);
  2881.  
  2882. HashFrame.dispose();
  2883.  
  2884. QBox("Your hashed password is: " + PrintHash + "\nIt has also been copied to your clipboard.");
  2885.  
  2886. StringSelection selection = new StringSelection(PrintHash);
  2887.  
  2888. java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  2889.  
  2890. clipboard.setContents(selection, selection);
  2891. }
  2892.  
  2893. else if (control == CloseDraw)
  2894. {
  2895. CloseAnimation(PictureFrame);
  2896.  
  2897. PictureFrame.dispose();
  2898.  
  2899. PictureFrame = null;
  2900. }
  2901.  
  2902. else if (control == CalculatorZero)
  2903. {
  2904. CalculatorExpression += "0";
  2905.  
  2906. CalculatorField.setText(CalculatorExpression);
  2907. }
  2908.  
  2909. else if (control == CalculatorOne)
  2910. {
  2911. CalculatorExpression += "1";
  2912.  
  2913. CalculatorField.setText(CalculatorExpression);
  2914. }
  2915.  
  2916. else if (control == CalculatorTwo)
  2917. {
  2918. CalculatorExpression += "2";
  2919.  
  2920. CalculatorField.setText(CalculatorExpression);
  2921. }
  2922.  
  2923. else if (control == CalculatorThree)
  2924. {
  2925. CalculatorExpression += "3";
  2926.  
  2927. CalculatorField.setText(CalculatorExpression);
  2928. }
  2929.  
  2930. else if (control == CalculatorFour)
  2931. {
  2932. CalculatorExpression += "4";
  2933.  
  2934. CalculatorField.setText(CalculatorExpression);
  2935. }
  2936.  
  2937. else if (control == CalculatorFive)
  2938. {
  2939. CalculatorExpression += "5";
  2940.  
  2941. CalculatorField.setText(CalculatorExpression);
  2942. }
  2943.  
  2944. else if (control == CalculatorSix)
  2945. {
  2946. CalculatorExpression += "6";
  2947.  
  2948. CalculatorField.setText(CalculatorExpression);
  2949. }
  2950.  
  2951. else if (control == CalculatorSeven)
  2952. {
  2953. CalculatorExpression += "7";
  2954.  
  2955. CalculatorField.setText(CalculatorExpression);
  2956. }
  2957.  
  2958. else if (control == CalculatorEight)
  2959. {
  2960. CalculatorExpression += "8";
  2961.  
  2962. CalculatorField.setText(CalculatorExpression);
  2963. }
  2964.  
  2965. else if (control == CalculatorNine)
  2966. {
  2967. CalculatorExpression += "9";
  2968.  
  2969. CalculatorField.setText(CalculatorExpression);
  2970. }
  2971.  
  2972. else if (control == CalculatorAdd)
  2973. {
  2974. CalculatorExpression += "+";
  2975.  
  2976. CalculatorField.setText(CalculatorExpression);
  2977. }
  2978.  
  2979. else if (control == CalculatorSubtract)
  2980. {
  2981. CalculatorExpression += "-";
  2982.  
  2983. CalculatorField.setText(CalculatorExpression);
  2984. }
  2985.  
  2986. else if (control == CalculatorMultiply)
  2987. {
  2988. CalculatorExpression += "*";
  2989.  
  2990. CalculatorField.setText(CalculatorExpression);
  2991. }
  2992.  
  2993. else if (control == CalculatorDivide)
  2994. {
  2995. CalculatorExpression += "/";
  2996.  
  2997. CalculatorField.setText(CalculatorExpression);
  2998. }
  2999.  
  3000. else if (control == CalculatorPercent)
  3001. {
  3002. CalculatorExpression += "%";
  3003.  
  3004. CalculatorField.setText(CalculatorExpression);
  3005. }
  3006.  
  3007. else if (control == CalculatorOpenP)
  3008. {
  3009. CalculatorExpression += "(";
  3010.  
  3011. CalculatorField.setText(CalculatorExpression);
  3012. }
  3013.  
  3014. else if (control == CalculatorCloseP)
  3015. {
  3016. CalculatorExpression += ")";
  3017.  
  3018. CalculatorField.setText(CalculatorExpression);
  3019. }
  3020.  
  3021. else if (control == CalculatorDecimal)
  3022. {
  3023. CalculatorExpression += ".";
  3024.  
  3025. CalculatorField.setText(CalculatorExpression);
  3026. }
  3027.  
  3028. else if (control == CalculatorClear)
  3029. {
  3030. CalculatorExpression = "";
  3031.  
  3032. CalculatorField.setText("");
  3033. }
  3034.  
  3035. else if (control == CalculatorEquals)
  3036. {
  3037. ScriptEngineManager mgr = new ScriptEngineManager();
  3038.  
  3039. ScriptEngine engine = mgr.getEngineByName("JavaScript");
  3040.  
  3041. try
  3042. {
  3043. Object result = engine.eval(CalculatorExpression);
  3044.  
  3045. CalculatorField.setText(result.toString());
  3046.  
  3047. CalculatorExpression = "";
  3048. }
  3049.  
  3050. catch (Exception e)
  3051. {
  3052. QBox("That isn't a valid expression.");
  3053. }
  3054. }
  3055.  
  3056. else if (control == TTT1 && TTT1.getText().isEmpty())
  3057. {
  3058. if (CurrentPlayerTurn == PlayerX)
  3059. {
  3060. TTT1.setText("X");
  3061.  
  3062. TTT1.setForeground(RegularRed);
  3063.  
  3064. TTT1.setFont(new Font("HeadPlane",Font.BOLD,25));
  3065.  
  3066. CurrentPlayerTurn = PlayerO;
  3067.  
  3068. UpdatePlayerTurnLabel();
  3069.  
  3070. TTTCheckWin();
  3071. }
  3072.  
  3073. else
  3074. {
  3075. TTT1.setText("O");
  3076.  
  3077. TTT1.setForeground(TTTBlue);
  3078.  
  3079. TTT1.setFont(new Font("HeadPlane",Font.BOLD,25));
  3080.  
  3081. CurrentPlayerTurn = PlayerX;
  3082.  
  3083. UpdatePlayerTurnLabel();
  3084.  
  3085. TTTCheckWin();
  3086. }
  3087. }
  3088.  
  3089. else if (control == TTT2 && TTT2.getText().isEmpty())
  3090. {
  3091. if (CurrentPlayerTurn == PlayerX)
  3092. {
  3093. TTT2.setText("X");
  3094.  
  3095. TTT2.setForeground(RegularRed);
  3096.  
  3097. TTT2.setFont(new Font("HeadPlane",Font.BOLD,25));
  3098.  
  3099. CurrentPlayerTurn = PlayerO;
  3100.  
  3101. UpdatePlayerTurnLabel();
  3102.  
  3103. TTTCheckWin();
  3104. }
  3105.  
  3106. else
  3107. {
  3108. TTT2.setText("O");
  3109.  
  3110. TTT2.setForeground(TTTBlue);
  3111.  
  3112. TTT2.setFont(new Font("HeadPlane",Font.BOLD,25));
  3113.  
  3114. CurrentPlayerTurn = PlayerX;
  3115.  
  3116. UpdatePlayerTurnLabel();
  3117.  
  3118. TTTCheckWin();
  3119. }
  3120. }
  3121.  
  3122. else if (control == TTT3 && TTT3.getText().isEmpty())
  3123. {
  3124. if (CurrentPlayerTurn == PlayerX)
  3125. {
  3126. TTT3.setText("X");
  3127.  
  3128. TTT3.setForeground(RegularRed);
  3129.  
  3130. TTT3.setFont(new Font("HeadPlane",Font.BOLD,25));
  3131.  
  3132. CurrentPlayerTurn = PlayerO;
  3133.  
  3134. UpdatePlayerTurnLabel();
  3135.  
  3136. TTTCheckWin();
  3137. }
  3138.  
  3139. else
  3140. {
  3141. TTT3.setText("O");
  3142.  
  3143. TTT3.setForeground(TTTBlue);
  3144.  
  3145. TTT3.setFont(new Font("HeadPlane",Font.BOLD,25));
  3146.  
  3147. CurrentPlayerTurn = PlayerX;
  3148.  
  3149. UpdatePlayerTurnLabel();
  3150.  
  3151. TTTCheckWin();
  3152. }
  3153. }
  3154.  
  3155. else if (control == TTT4 && TTT4.getText().isEmpty())
  3156. {
  3157. if (CurrentPlayerTurn == PlayerX)
  3158. {
  3159. TTT4.setText("X");
  3160.  
  3161. TTT4.setForeground(RegularRed);
  3162.  
  3163. TTT4.setFont(new Font("HeadPlane",Font.BOLD,25));
  3164.  
  3165. CurrentPlayerTurn = PlayerO;
  3166.  
  3167. UpdatePlayerTurnLabel();
  3168.  
  3169. TTTCheckWin();
  3170. }
  3171.  
  3172. else
  3173. {
  3174. TTT4.setText("O");
  3175.  
  3176. TTT4.setForeground(TTTBlue);
  3177.  
  3178. TTT4.setFont(new Font("HeadPlane",Font.BOLD,25));
  3179.  
  3180. CurrentPlayerTurn = PlayerX;
  3181.  
  3182. UpdatePlayerTurnLabel();
  3183.  
  3184. TTTCheckWin();
  3185. }
  3186. }
  3187.  
  3188. else if (control == TTT5 && TTT5.getText().isEmpty())
  3189. {
  3190. if (CurrentPlayerTurn == PlayerX)
  3191. {
  3192. TTT5.setText("X");
  3193.  
  3194. TTT5.setForeground(RegularRed);
  3195.  
  3196. TTT5.setFont(new Font("HeadPlane",Font.BOLD,25));
  3197.  
  3198. CurrentPlayerTurn = PlayerO;
  3199.  
  3200. UpdatePlayerTurnLabel();
  3201.  
  3202. TTTCheckWin();
  3203. }
  3204.  
  3205. else
  3206. {
  3207. TTT5.setText("O");
  3208.  
  3209. TTT5.setForeground(TTTBlue);
  3210.  
  3211. TTT5.setFont(new Font("HeadPlane",Font.BOLD,25));
  3212.  
  3213. CurrentPlayerTurn = PlayerX;
  3214.  
  3215. UpdatePlayerTurnLabel();
  3216.  
  3217. TTTCheckWin();
  3218. }
  3219. }
  3220.  
  3221. else if (control == TTT6 && TTT6.getText().isEmpty())
  3222. {
  3223. if (CurrentPlayerTurn == PlayerX)
  3224. {
  3225. TTT6.setText("X");
  3226.  
  3227. TTT6.setForeground(RegularRed);
  3228.  
  3229. TTT6.setFont(new Font("HeadPlane",Font.BOLD,25));
  3230.  
  3231. CurrentPlayerTurn = PlayerO;
  3232.  
  3233. UpdatePlayerTurnLabel();
  3234.  
  3235. TTTCheckWin();
  3236. }
  3237.  
  3238. else
  3239. {
  3240. TTT6.setText("O");
  3241.  
  3242. TTT6.setForeground(TTTBlue);
  3243.  
  3244. TTT6.setFont(new Font("HeadPlane",Font.BOLD,25));
  3245.  
  3246. CurrentPlayerTurn = PlayerX;
  3247.  
  3248. UpdatePlayerTurnLabel();
  3249.  
  3250. TTTCheckWin();
  3251. }
  3252. }
  3253.  
  3254. else if (control == TTT7 && TTT7.getText().isEmpty())
  3255. {
  3256. if (CurrentPlayerTurn == PlayerX)
  3257. {
  3258. TTT7.setText("X");
  3259.  
  3260. TTT7.setForeground(RegularRed);
  3261.  
  3262. TTT7.setFont(new Font("HeadPlane",Font.BOLD,25));
  3263.  
  3264. CurrentPlayerTurn = PlayerO;
  3265.  
  3266. UpdatePlayerTurnLabel();
  3267.  
  3268. TTTCheckWin();
  3269. }
  3270.  
  3271. else
  3272. {
  3273. TTT7.setText("O");
  3274.  
  3275. TTT7.setForeground(TTTBlue);
  3276.  
  3277. TTT7.setFont(new Font("HeadPlane",Font.BOLD,25));
  3278.  
  3279. CurrentPlayerTurn = PlayerX;
  3280.  
  3281. UpdatePlayerTurnLabel();
  3282.  
  3283. TTTCheckWin();
  3284. }
  3285. }
  3286.  
  3287. else if (control == TTT8 && TTT8.getText().isEmpty())
  3288. {
  3289. if (CurrentPlayerTurn == PlayerX)
  3290. {
  3291. TTT8.setText("X");
  3292.  
  3293. TTT8.setForeground(RegularRed);
  3294.  
  3295. TTT8.setFont(new Font("HeadPlane",Font.BOLD,25));
  3296.  
  3297. CurrentPlayerTurn = PlayerO;
  3298.  
  3299. UpdatePlayerTurnLabel();
  3300.  
  3301. TTTCheckWin();
  3302. }
  3303.  
  3304. else
  3305. {
  3306. TTT8.setText("O");
  3307.  
  3308. TTT8.setForeground(TTTBlue);
  3309.  
  3310. TTT8.setFont(new Font("HeadPlane",Font.BOLD,25));
  3311.  
  3312. CurrentPlayerTurn = PlayerX;
  3313.  
  3314. UpdatePlayerTurnLabel();
  3315.  
  3316. TTTCheckWin();
  3317. }
  3318. }
  3319.  
  3320. else if (control == TTT9 && TTT9.getText().isEmpty())
  3321. {
  3322. if (CurrentPlayerTurn == PlayerX)
  3323. {
  3324. TTT9.setText("X");
  3325.  
  3326. TTT9.setForeground(RegularRed);
  3327.  
  3328. TTT9.setFont(new Font("HeadPlane",Font.BOLD,25));
  3329.  
  3330. CurrentPlayerTurn = PlayerO;
  3331.  
  3332. UpdatePlayerTurnLabel();
  3333.  
  3334. TTTCheckWin();
  3335. }
  3336.  
  3337. else
  3338. {
  3339. TTT9.setText("O");
  3340.  
  3341. TTT9.setForeground(TTTBlue);
  3342.  
  3343. TTT9.setFont(new Font("HeadPlane",Font.BOLD,25));
  3344.  
  3345. CurrentPlayerTurn = PlayerX;
  3346.  
  3347. UpdatePlayerTurnLabel();
  3348.  
  3349. TTTCheckWin();
  3350. }
  3351. }
  3352.  
  3353. else if (control == TTTReset)
  3354. {
  3355. TTTBoardReset();
  3356. }
  3357.  
  3358. else if (control == AddNote)
  3359. {
  3360. AddNote();
  3361. }
  3362.  
  3363. else if (control == DeleteNote)
  3364. {
  3365. List<?> ClickedSelectionList = FileSelectionList.getSelectedValuesList();
  3366.  
  3367. if (!ClickedSelectionList.isEmpty())
  3368. {
  3369. String ClickedSelection = ClickedSelectionList.get(0).toString();
  3370.  
  3371. File ClickedSelectionPath = null;
  3372.  
  3373. for (int i = 0 ; i < NoteNameList.size() ; i++)
  3374. {
  3375. if (ClickedSelection.equals(NoteNameList.get(i)))
  3376. {
  3377. ClickedSelectionPath = NoteList.get(i);
  3378.  
  3379. break;
  3380. }
  3381. }
  3382.  
  3383. ClickedSelectionPath.delete();
  3384.  
  3385. InitializeNotesList();
  3386.  
  3387. NoteListScroll.setViewportView(FileSelectionList);
  3388.  
  3389. NoteListScroll.revalidate();
  3390. }
  3391. }
  3392.  
  3393. else if (control == OpenNote)
  3394. {
  3395. List<?> ClickedSelectionList = FileSelectionList.getSelectedValuesList();
  3396.  
  3397. if (!ClickedSelectionList.isEmpty())
  3398. {
  3399. String ClickedSelection = ClickedSelectionList.get(0).toString();
  3400.  
  3401. File ClickedSelectionPath = null;
  3402.  
  3403. for (int i = 0 ; i < NoteNameList.size() ; i++)
  3404. {
  3405. if (ClickedSelection.equals(NoteNameList.get(i)))
  3406. {
  3407. ClickedSelectionPath = NoteList.get(i);
  3408.  
  3409. break;
  3410. }
  3411. }
  3412.  
  3413. OpenNote(ClickedSelectionPath);
  3414. }
  3415. }
  3416.  
  3417. else if (control == SubmitNewNote)
  3418. {
  3419. try
  3420. {
  3421. BufferedWriter NoteWriter = new BufferedWriter
  3422. (new FileWriter("JesseUsers\\" + Username + "\\Notes\\" + NewNoteField.getText() + ".txt",true));
  3423.  
  3424. NewNoteArea.write(NoteWriter);
  3425.  
  3426. NoteWriter.close();
  3427. }
  3428.  
  3429. catch (Exception e)
  3430. {
  3431. LogError(e);
  3432. }
  3433.  
  3434. CloseAnimation(NewNoteFrame);
  3435.  
  3436. NewNoteFrame.dispose();
  3437.  
  3438. InitializeNotesList();
  3439.  
  3440. NoteListScroll.setViewportView(FileSelectionList);
  3441.  
  3442. NoteListScroll.revalidate();
  3443. }
  3444.  
  3445. else if (control == YTTNField)
  3446. {
  3447. GetYTTN.doClick();
  3448. }
  3449.  
  3450. else if (control == GetYTTN)
  3451. {
  3452. CloseAnimation(YTTNFrame);
  3453.  
  3454. YTTNFrame.dispose();
  3455.  
  3456. String YouTubeID = YTTNField.getText();
  3457.  
  3458. if (YouTubeID.length() < 11)
  3459. {
  3460. QBox("Sorry, " + Username + ", but that's not a valid YouTube video ID.");
  3461. }
  3462.  
  3463. else
  3464. {
  3465. String YouTubeURL = "https://img.youtube.com/vi/REPLACE/hqdefault.jpg";
  3466.  
  3467. YouTubeURL = YouTubeURL.replace("REPLACE", YouTubeID);
  3468.  
  3469. URL url;
  3470.  
  3471. try
  3472. {
  3473. url = new URL(YouTubeURL);
  3474.  
  3475. BufferedImage Thumbnail = ImageIO.read(url);
  3476.  
  3477. JLabel PictureLabel = new JLabel(new ImageIcon(Thumbnail));
  3478.  
  3479. JFrame ThumbnailFrame = new JFrame();
  3480.  
  3481. ThumbnailFrame.setTitle("YouTube Thumbnail");
  3482.  
  3483. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\youtube.png");
  3484.  
  3485. PictureLabel.addMouseListener(new MouseAdapter()
  3486. {
  3487. public void mouseClicked(MouseEvent e)
  3488. {
  3489. InternetConnect("https://www.youtube.com/watch?v=" + YouTubeID);
  3490. }
  3491. });
  3492.  
  3493. PictureLabel.setToolTipText("Click To Open Video");
  3494.  
  3495. ThumbnailFrame.setIconImage(img.getImage());
  3496.  
  3497. ThumbnailFrame.setResizable(false);
  3498.  
  3499. ThumbnailFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  3500.  
  3501. ThumbnailFrame.getContentPane().add(PictureLabel);
  3502.  
  3503. ThumbnailFrame.pack();
  3504.  
  3505. ThumbnailFrame.setLocationRelativeTo(null);
  3506.  
  3507. ThumbnailFrame.setVisible(true);
  3508. }
  3509.  
  3510. catch (Exception e)
  3511. {
  3512. QBox("Sorry, " + Username + ", but that's not a valid YouTube video ID.");
  3513. }
  3514. }
  3515. }
  3516.  
  3517. else if (control == ApproveImage)
  3518. {
  3519. try
  3520. {
  3521. ImageIO.write(ReturnImage, "png", new File("C:\\Users\\" + CUsername + "\\Downloads\\" + NewName));
  3522. }
  3523.  
  3524. catch (Exception e)
  3525. {
  3526. LogError(e);
  3527. }
  3528.  
  3529. CloseAnimation(PixelFrame);
  3530.  
  3531. PixelFrame.dispose();
  3532.  
  3533. QBox("The distorted image has been saved to your Downloads folder.");
  3534. }
  3535.  
  3536. else if (control == CloseMusic)
  3537. {
  3538. if (MP3Player != null)
  3539. {
  3540. MP3Player.close();
  3541. }
  3542.  
  3543. MP3Player = null;
  3544.  
  3545. CloseAnimation(MusicFrame);
  3546.  
  3547. MusicVolumeSlider.setValue(100);
  3548.  
  3549. MusicFrame.dispose();
  3550. }
  3551.  
  3552. else if (control == PlayPauseMusic)
  3553. {
  3554. if (MP3Player != null)
  3555. {
  3556. if (!PlayIcon)
  3557. {
  3558. PlayPauseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Play.png"));
  3559.  
  3560. PlayPauseMusic.setToolTipText("Play");
  3561.  
  3562. PlayIcon = true;
  3563. }
  3564.  
  3565. else
  3566. {
  3567. PlayPauseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Pause.png"));
  3568.  
  3569. PlayPauseMusic.setToolTipText("Pause");
  3570.  
  3571. PlayIcon = false;
  3572. }
  3573.  
  3574. if (PlayIcon)
  3575. {
  3576. try
  3577. {
  3578. PauseLocation = FIS.available();
  3579. }
  3580.  
  3581. catch (Exception e)
  3582. {
  3583.  
  3584. }
  3585.  
  3586. MP3Player.close();
  3587. }
  3588.  
  3589. else
  3590. {
  3591. if (MusicStopped)
  3592. {
  3593. MusicStopped = false;
  3594.  
  3595. Play(MusicFiles[CurrentMusicIndex]);
  3596. }
  3597.  
  3598. else
  3599. {
  3600. try
  3601. {
  3602. FIS = new FileInputStream(MusicFiles[CurrentMusicIndex]);
  3603.  
  3604. BIS = new BufferedInputStream(FIS);
  3605.  
  3606. MP3Player = new Player(BIS);
  3607.  
  3608. FIS.skip(SongTotalLength - PauseLocation);
  3609.  
  3610. MusicTitleLabel.setText(MusicFiles[CurrentMusicIndex].getName().replace(".mp3", ""));
  3611.  
  3612. ResumeMusic();
  3613. }
  3614.  
  3615. catch (Exception e)
  3616. {
  3617. LogError(e);
  3618. }
  3619. }
  3620. }
  3621. }
  3622. }
  3623.  
  3624. else if (control == LastMusic)
  3625. {
  3626. if (MP3Player != null)
  3627. {
  3628. if (CurrentMusicIndex - 1 >= 0)
  3629. {
  3630. CurrentMusicIndex -= 1;
  3631.  
  3632. MP3Player.close();
  3633.  
  3634. MP3Player = null;
  3635.  
  3636. Play(MusicFiles[CurrentMusicIndex]);
  3637. }
  3638.  
  3639. else if (CurrentMusicIndex == 0)
  3640. {
  3641. CurrentMusicIndex = MusicFiles.length - 1;
  3642.  
  3643. MP3Player.close();
  3644.  
  3645. MP3Player = null;
  3646.  
  3647. Play(MusicFiles[CurrentMusicIndex]);
  3648. }
  3649. }
  3650. }
  3651.  
  3652. else if (control == NextMusic)
  3653. {
  3654. if (MP3Player != null)
  3655. {
  3656. if (CurrentMusicIndex + 1 <= MusicFiles.length - 1)
  3657. {
  3658. CurrentMusicIndex += 1;
  3659.  
  3660. MP3Player.close();
  3661.  
  3662. MP3Player = null;
  3663.  
  3664. Play(MusicFiles[CurrentMusicIndex]);
  3665. }
  3666.  
  3667. else if (CurrentMusicIndex + 1 == MusicFiles.length)
  3668. {
  3669. CurrentMusicIndex = 0;
  3670.  
  3671. MP3Player.close();
  3672.  
  3673. MP3Player = null;
  3674.  
  3675. Play(MusicFiles[CurrentMusicIndex]);
  3676. }
  3677. }
  3678. }
  3679.  
  3680. else if (control == LoopMusic)
  3681. {
  3682. if (!RepeatAudio)
  3683. {
  3684. LoopMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Repeat.png"));
  3685.  
  3686. LoopMusic.setToolTipText("Don't Loop Audio");
  3687.  
  3688. RepeatAudio = true;
  3689. }
  3690.  
  3691. else
  3692. {
  3693. LoopMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\NoRepeat.png"));
  3694.  
  3695. LoopMusic.setToolTipText("Loop Audio");
  3696.  
  3697. RepeatAudio = false;
  3698. }
  3699. }
  3700.  
  3701. else if (control == StopMusic)
  3702. {
  3703. if (MP3Player != null)
  3704. {
  3705. MP3Player.close();
  3706.  
  3707. MusicTitleLabel.setText("No audio currently playing");
  3708.  
  3709. PlayPauseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Play.png"));
  3710.  
  3711. PlayPauseMusic.setToolTipText("Play");
  3712.  
  3713. PlayIcon = true;
  3714.  
  3715. PauseLocation = 0;
  3716.  
  3717. SongTotalLength = 0;
  3718.  
  3719. MusicStopped = true;
  3720. }
  3721. }
  3722.  
  3723. else if (control == SelectMusicDir)
  3724. {
  3725. WindowsFeel(ConsoleFrame);
  3726.  
  3727. File SelectedFile = GetFile("Select any mp3 file");
  3728.  
  3729. SwingFeel(ConsoleFrame);
  3730.  
  3731. if ((SelectedFile == null || !SelectedFile.toString().endsWith("mp3")))
  3732. {
  3733. if (SelectedFile == null)
  3734. {
  3735.  
  3736. }
  3737.  
  3738. else if (MP3Player == null)
  3739. {
  3740. QBox("Sorry, " + Username + ", but that's not an mp3 file.");
  3741. }
  3742. }
  3743.  
  3744. else
  3745. {
  3746. File[] SelectedFileDir = SelectedFile.getParentFile().listFiles();
  3747.  
  3748. ArrayList<File> ValidFiles = new ArrayList<File>();
  3749.  
  3750. for (int i = 0 ; i < SelectedFileDir.length ; i++)
  3751. {
  3752. if (SelectedFileDir[i].toString().endsWith(".mp3"))
  3753. {
  3754. ValidFiles.add(SelectedFileDir[i]);
  3755.  
  3756. if (ValidFiles.get(i).equals(SelectedFile))
  3757. {
  3758. CurrentMusicIndex = i;
  3759. }
  3760. }
  3761. }
  3762.  
  3763. MusicFiles = ValidFiles.toArray(new File[ValidFiles.size()]);
  3764.  
  3765. Play(MusicFiles[CurrentMusicIndex]);
  3766. }
  3767. }
  3768.  
  3769. else if (control == SaveNote)
  3770. {
  3771. try
  3772. {
  3773. BufferedWriter SaveWriter = new BufferedWriter(new FileWriter(CurrentUserNote,false));
  3774.  
  3775. SaveWriter.write(NoteEditArea.getText());
  3776.  
  3777. SaveWriter.close();
  3778.  
  3779. QBox(CurrentUserNote.getName().replace(".txt", "") + " has been successfully saved.");
  3780.  
  3781. CloseAnimation(NoteEditorFrame);
  3782.  
  3783. NoteEditorFrame.dispose();
  3784. }
  3785.  
  3786. catch (Exception e)
  3787. {
  3788. LogError(e);
  3789. }
  3790. }
  3791.  
  3792. else if (control == AddBackground)
  3793. {
  3794. try
  3795. {
  3796. WindowsFeel(ConsoleFrame);
  3797.  
  3798. File AddBackground = GetFile("Select a png file");
  3799.  
  3800. SwingFeel(ConsoleFrame);
  3801.  
  3802. if (AddMusic.getName() != null && AddMusic.getName().endsWith(".png"))
  3803. {
  3804. File Destination = new File("JesseUsers\\" + Username + "\\Backgrounds\\" + AddBackground.getName());
  3805.  
  3806. Files.copy(new File(AddBackground.getAbsolutePath()).toPath(), Destination.toPath());
  3807.  
  3808. InitializeBackgroundsList();
  3809.  
  3810. BackgroundListScroll.setViewportView(BackgroundSelectionList);
  3811.  
  3812. BackgroundListScroll.revalidate();
  3813. }
  3814. }
  3815.  
  3816. catch (Exception e)
  3817. {
  3818. LogError(e);
  3819. }
  3820. }
  3821.  
  3822. else if (control == DeleteBackground)
  3823. {
  3824. boolean FollowThrough = YesOrNo("You are about to delete a background file.\n"
  3825. + "This action cannot be undone.\n"
  3826. + "Are you sure you wish to continue?");
  3827.  
  3828. if (FollowThrough)
  3829. {
  3830. List<?> ClickedSelectionListBackground = BackgroundSelectionList.getSelectedValuesList();
  3831.  
  3832. if (!ClickedSelectionListBackground.isEmpty())
  3833. {
  3834. String ClickedSelection = ClickedSelectionListBackground.get(0).toString();
  3835.  
  3836. File ClickedSelectionPath = null;
  3837.  
  3838. for (int i = 0 ; i < BackgroundsNameList.size() ; i++)
  3839. {
  3840. if (ClickedSelection.equals(BackgroundsNameList.get(i)))
  3841. {
  3842. ClickedSelectionPath = BackgroundsList.get(i);
  3843.  
  3844. break;
  3845. }
  3846. }
  3847.  
  3848. ClickedSelectionPath.delete();
  3849.  
  3850. InitializeBackgroundsList();
  3851.  
  3852. BackgroundListScroll.setViewportView(BackgroundSelectionList);
  3853.  
  3854. BackgroundListScroll.revalidate();
  3855. }
  3856. }
  3857. }
  3858.  
  3859. else if (control == OpenBackground)
  3860. {
  3861. List<?> ClickedSelectionList = BackgroundSelectionList.getSelectedValuesList();
  3862.  
  3863. if (!ClickedSelectionList.isEmpty())
  3864. {
  3865. String ClickedSelection = ClickedSelectionList.get(0).toString();
  3866.  
  3867. File ClickedSelectionPath = null;
  3868.  
  3869. for (int i = 0 ; i < BackgroundsNameList.size() ; i++)
  3870. {
  3871. if (ClickedSelection.equals(BackgroundsNameList.get(i)))
  3872. {
  3873. ClickedSelectionPath = BackgroundsList.get(i);
  3874.  
  3875. break;
  3876. }
  3877. }
  3878.  
  3879. draw(ClickedSelectionPath.toString());
  3880. }
  3881. }
  3882.  
  3883. else if (control == AddMusic)
  3884. {
  3885. try
  3886. {
  3887. WindowsFeel(ConsoleFrame);
  3888.  
  3889. File AddMusic = GetFile("Select an mp3 file");
  3890.  
  3891. SwingFeel(ConsoleFrame);
  3892.  
  3893. if (AddMusic != null && AddMusic.getName().endsWith(".mp3"))
  3894. {
  3895. File Destination = new File("JesseUsers\\" + Username + "\\Music\\" + AddMusic.getName());
  3896.  
  3897. Files.copy(new File(AddMusic.getAbsolutePath()).toPath(), Destination.toPath());
  3898.  
  3899. InitializeMusicList();
  3900.  
  3901. MusicListScroll.setViewportView(MusicSelectionList);
  3902.  
  3903. MusicListScroll.revalidate();
  3904. }
  3905. }
  3906.  
  3907. catch (Exception e)
  3908. {
  3909. LogError(e);
  3910. }
  3911. }
  3912.  
  3913. else if (control == DeleteMusic)
  3914. {
  3915. boolean FollowThrough = YesOrNo("You are about to delete a music file.\n"
  3916. + "This action cannot be undone.\n"
  3917. + "Are you sure you wish to continue?");
  3918.  
  3919. if (FollowThrough)
  3920. {
  3921. List<?> ClickedSelectionListMusic = MusicSelectionList.getSelectedValuesList();
  3922.  
  3923. if (!ClickedSelectionListMusic.isEmpty())
  3924. {
  3925. String ClickedSelection = ClickedSelectionListMusic.get(0).toString();
  3926.  
  3927. File ClickedSelectionPath = null;
  3928.  
  3929. for (int i = 0 ; i < MusicNameList.size() ; i++)
  3930. {
  3931. if (ClickedSelection.equals(MusicNameList.get(i)))
  3932. {
  3933. ClickedSelectionPath = MusicList.get(i);
  3934.  
  3935. break;
  3936. }
  3937. }
  3938.  
  3939. ClickedSelectionPath.delete();
  3940.  
  3941. InitializeMusicList();
  3942.  
  3943. MusicListScroll.setViewportView(MusicSelectionList);
  3944.  
  3945. MusicListScroll.revalidate();
  3946. }
  3947. }
  3948. }
  3949.  
  3950. else if (control == OpenMusic)
  3951. {
  3952. List<?> ClickedSelectionList = MusicSelectionList.getSelectedValuesList();
  3953.  
  3954. if (!ClickedSelectionList.isEmpty())
  3955. {
  3956. String ClickedSelection = ClickedSelectionList.get(0).toString();
  3957.  
  3958. File ClickedSelectionPath = null;
  3959.  
  3960. for (int i = 0 ; i < MusicNameList.size() ; i++)
  3961. {
  3962. if (ClickedSelection.equals(MusicNameList.get(i)))
  3963. {
  3964. ClickedSelectionPath = MusicList.get(i);
  3965.  
  3966. break;
  3967. }
  3968. }
  3969.  
  3970. WindowsFeel(ConsoleFrame);
  3971.  
  3972. mp3(ClickedSelectionPath);
  3973.  
  3974. SwingFeel(ConsoleFrame);
  3975. }
  3976. }
  3977.  
  3978. else if (control == Facebook)
  3979. {
  3980. InternetConnect("https://www.facebook.com/");
  3981. }
  3982.  
  3983. else if (control == Twitter)
  3984. {
  3985. InternetConnect("https://twitter.com/");
  3986. }
  3987.  
  3988. else if (control == Instagram)
  3989. {
  3990. InternetConnect("https://www.instagram.com/");
  3991. }
  3992.  
  3993. else if (control == YouTube)
  3994. {
  3995. InternetConnect("https://www.youtube.com/");
  3996. }
  3997.  
  3998. else if (control == CloseWeather)
  3999. {
  4000. CloseAnimation(WeatherFrame);
  4001.  
  4002. WeatherFrame.dispose();
  4003.  
  4004. UpdateWeather = false;
  4005.  
  4006. UpdateClock = false;
  4007. }
  4008.  
  4009. else if (control == MinimizeWeather)
  4010. {
  4011. WeatherRestoreX = WeatherFrame.getX();
  4012.  
  4013. WeatherRestoreY = WeatherFrame.getY();
  4014.  
  4015. MinimizeAnimation(WeatherFrame);
  4016.  
  4017. WeatherFrame.setState(Frame.ICONIFIED);
  4018. }
  4019.  
  4020. else if (control == DebugButton)
  4021. {
  4022. if (DebugMode)
  4023. {
  4024. Debug();
  4025. }
  4026.  
  4027. else
  4028. {
  4029. println("Sorry, " + Username + ", but you do not have permission to use that feature.");
  4030. }
  4031. }
  4032.  
  4033. else if (control == CloseDebug)
  4034. {
  4035. CloseAnimation(DebugFrame);
  4036.  
  4037. DebugFrame.dispose();
  4038. }
  4039.  
  4040. else if (control == HangmanA)
  4041. {
  4042. LetterChosen("a");
  4043.  
  4044. HangmanA.setEnabled(false);
  4045.  
  4046. HangmanA.setForeground(RegularRed);
  4047. }
  4048.  
  4049. else if (control == HangmanB)
  4050. {
  4051. LetterChosen("b");
  4052.  
  4053. HangmanB.setEnabled(false);
  4054.  
  4055. HangmanB.setForeground(RegularRed);
  4056. }
  4057.  
  4058. else if (control == HangmanC)
  4059. {
  4060. LetterChosen("c");
  4061.  
  4062. HangmanC.setEnabled(false);
  4063.  
  4064. HangmanC.setForeground(RegularRed);
  4065. }
  4066.  
  4067. else if (control == HangmanD)
  4068. {
  4069. LetterChosen("d");
  4070.  
  4071. HangmanD.setEnabled(false);
  4072.  
  4073. HangmanD.setForeground(RegularRed);
  4074. }
  4075.  
  4076. else if (control == HangmanE)
  4077. {
  4078. LetterChosen("e");
  4079.  
  4080. HangmanE.setEnabled(false);
  4081.  
  4082. HangmanE.setForeground(RegularRed);
  4083. }
  4084.  
  4085. else if (control == HangmanF)
  4086. {
  4087. LetterChosen("f");
  4088.  
  4089. HangmanF.setEnabled(false);
  4090.  
  4091. HangmanF.setForeground(RegularRed);
  4092. }
  4093.  
  4094. else if (control == HangmanG)
  4095. {
  4096. LetterChosen("g");
  4097.  
  4098. HangmanG.setEnabled(false);
  4099.  
  4100. HangmanG.setForeground(RegularRed);
  4101. }
  4102.  
  4103. else if (control == HangmanH)
  4104. {
  4105. LetterChosen("h");
  4106.  
  4107. HangmanH.setEnabled(false);
  4108.  
  4109. HangmanH.setForeground(RegularRed);
  4110. }
  4111.  
  4112. else if (control == HangmanI)
  4113. {
  4114. LetterChosen("i");
  4115.  
  4116. HangmanI.setEnabled(false);
  4117.  
  4118. HangmanI.setForeground(RegularRed);
  4119. }
  4120.  
  4121. else if (control == HangmanJ)
  4122. {
  4123. LetterChosen("j");
  4124.  
  4125. HangmanJ.setEnabled(false);
  4126.  
  4127. HangmanJ.setForeground(RegularRed);
  4128. }
  4129.  
  4130. else if (control == HangmanK)
  4131. {
  4132. LetterChosen("k");
  4133.  
  4134. HangmanK.setEnabled(false);
  4135.  
  4136. HangmanK.setForeground(RegularRed);
  4137. }
  4138.  
  4139. else if (control == HangmanL)
  4140. {
  4141. LetterChosen("l");
  4142.  
  4143. HangmanL.setEnabled(false);
  4144.  
  4145. HangmanL.setForeground(RegularRed);
  4146. }
  4147.  
  4148. else if (control == HangmanM)
  4149. {
  4150. LetterChosen("m");
  4151.  
  4152. HangmanM.setEnabled(false);
  4153.  
  4154. HangmanM.setForeground(RegularRed);
  4155. }
  4156.  
  4157. else if (control == HangmanN)
  4158. {
  4159. LetterChosen("n");
  4160.  
  4161. HangmanN.setEnabled(false);
  4162.  
  4163. HangmanN.setForeground(RegularRed);
  4164. }
  4165.  
  4166. else if (control == HangmanO)
  4167. {
  4168. LetterChosen("o");
  4169.  
  4170. HangmanO.setEnabled(false);
  4171.  
  4172. HangmanO.setForeground(RegularRed);
  4173. }
  4174.  
  4175. else if (control == HangmanP)
  4176. {
  4177. LetterChosen("p");
  4178.  
  4179. HangmanP.setEnabled(false);
  4180.  
  4181. HangmanP.setForeground(RegularRed);
  4182. }
  4183.  
  4184. else if (control == HangmanQ)
  4185. {
  4186. LetterChosen("q");
  4187.  
  4188. HangmanQ.setEnabled(false);
  4189.  
  4190. HangmanQ.setForeground(RegularRed);
  4191. }
  4192.  
  4193. else if (control == HangmanR)
  4194. {
  4195. LetterChosen("r");
  4196.  
  4197. HangmanR.setEnabled(false);
  4198.  
  4199. HangmanR.setForeground(RegularRed);
  4200. }
  4201.  
  4202. else if (control == HangmanS)
  4203. {
  4204. LetterChosen("s");
  4205.  
  4206. HangmanS.setEnabled(false);
  4207.  
  4208. HangmanS.setForeground(RegularRed);
  4209. }
  4210.  
  4211. else if (control == HangmanT)
  4212. {
  4213. LetterChosen("t");
  4214.  
  4215. HangmanT.setEnabled(false);
  4216.  
  4217. HangmanT.setForeground(RegularRed);
  4218. }
  4219.  
  4220. else if (control == HangmanU)
  4221. {
  4222. LetterChosen("u");
  4223.  
  4224. HangmanU.setEnabled(false);
  4225.  
  4226. HangmanU.setForeground(RegularRed);
  4227. }
  4228.  
  4229. else if (control == HangmanV)
  4230. {
  4231. LetterChosen("v");
  4232.  
  4233. HangmanV.setEnabled(false);
  4234.  
  4235. HangmanV.setForeground(RegularRed);
  4236. }
  4237.  
  4238. else if (control == HangmanW)
  4239. {
  4240. LetterChosen("w");
  4241.  
  4242. HangmanW.setEnabled(false);
  4243.  
  4244. HangmanW.setForeground(RegularRed);
  4245. }
  4246.  
  4247. else if (control == HangmanX)
  4248. {
  4249. LetterChosen("x");
  4250.  
  4251. HangmanX.setEnabled(false);
  4252.  
  4253. HangmanX.setForeground(RegularRed);
  4254. }
  4255.  
  4256. else if (control == HangmanY)
  4257. {
  4258. LetterChosen("y");
  4259.  
  4260. HangmanY.setEnabled(false);
  4261.  
  4262. HangmanY.setForeground(RegularRed);
  4263. }
  4264.  
  4265. else if (control == HangmanZ)
  4266. {
  4267. LetterChosen("z");
  4268.  
  4269. HangmanZ.setEnabled(false);
  4270.  
  4271. HangmanZ.setForeground(RegularRed);
  4272. }
  4273.  
  4274. else if (control == HangmanReset)
  4275. {
  4276. StartHangman();
  4277. }
  4278. }
  4279.  
  4280. public void Test()
  4281. {
  4282.  
  4283. }
  4284.  
  4285. public void print(String Usage)
  4286. {
  4287. OutputArea.append(Usage);
  4288.  
  4289. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4290. }
  4291.  
  4292. public void print(int Usage)
  4293. {
  4294. OutputArea.append(Usage + "");
  4295.  
  4296. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4297. }
  4298.  
  4299. public void print(double Usage)
  4300. {
  4301. OutputArea.append(Usage + "");
  4302.  
  4303. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4304. }
  4305.  
  4306. public void print(boolean Usage)
  4307. {
  4308. OutputArea.append(Usage + "");
  4309.  
  4310. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4311. }
  4312.  
  4313. public void print(float Usage)
  4314. {
  4315. OutputArea.append(Usage + "");
  4316.  
  4317. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4318. }
  4319.  
  4320. public void print(long Usage)
  4321. {
  4322. OutputArea.append(Usage + "");
  4323.  
  4324. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4325. }
  4326.  
  4327. public void print(char Usage)
  4328. {
  4329. OutputArea.append(Usage + "");
  4330.  
  4331. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4332. }
  4333.  
  4334. public void print(Object Usage)
  4335. {
  4336. OutputArea.append(Usage + "");
  4337.  
  4338. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4339. }
  4340.  
  4341. public void println(String Usage)
  4342. {
  4343. OutputArea.append(Usage + "\n");
  4344.  
  4345. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4346. }
  4347.  
  4348. public void println(int Usage)
  4349. {
  4350. OutputArea.append(Usage + "\n");
  4351.  
  4352. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4353. }
  4354.  
  4355. public void println(double Usage)
  4356. {
  4357. OutputArea.append(Usage + "\n");
  4358.  
  4359. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4360. }
  4361.  
  4362. public void println(boolean Usage)
  4363. {
  4364. OutputArea.append(Usage + "\n");
  4365.  
  4366. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4367. }
  4368.  
  4369. public void println(float Usage)
  4370. {
  4371. OutputArea.append(Usage + "\n");
  4372.  
  4373. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4374. }
  4375.  
  4376. public void println(long Usage)
  4377. {
  4378. OutputArea.append(Usage + "\n");
  4379.  
  4380. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4381. }
  4382.  
  4383. public void println(char Usage)
  4384. {
  4385. OutputArea.append(Usage + "\n");
  4386.  
  4387. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4388. }
  4389.  
  4390. public void println(Object Usage)
  4391. {
  4392. OutputArea.append(Usage + "\n");
  4393.  
  4394. OutputArea.setCaretPosition(OutputArea.getDocument().getLength());
  4395. }
  4396.  
  4397. public void draw(String ImageName)
  4398. {
  4399. SwingFeel(ConsoleFrame);
  4400.  
  4401. if (PictureFrame != null)
  4402. {
  4403. CloseAnimation(PictureFrame);
  4404.  
  4405. PictureFrame.dispose();
  4406. }
  4407.  
  4408. BufferedImage Image = null;
  4409.  
  4410. try
  4411. {
  4412. Image = ImageIO.read(new File(ImageName));
  4413. }
  4414.  
  4415. catch (Exception ex)
  4416. {
  4417. LogError(ex);
  4418. }
  4419.  
  4420. PictureFrame = new JFrame();
  4421.  
  4422. PictureFrame.setUndecorated(true);
  4423.  
  4424. PictureFrame.setTitle(new File(ImageName).getName().replace(".png", ""));
  4425.  
  4426. PictureFrame.addMouseMotionListener(this);
  4427.  
  4428. PictureFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  4429.  
  4430. JPanel ParentPanel = new JPanel();
  4431.  
  4432. ParentPanel.setLayout(new BorderLayout());
  4433.  
  4434. PictureFrame.setContentPane(ParentPanel);
  4435.  
  4436. JLabel PictureLabel = new JLabel(new ImageIcon(Image));
  4437.  
  4438. ParentPanel.add(PictureLabel, BorderLayout.PAGE_START);
  4439.  
  4440. CloseDraw = new JButton("Close");
  4441.  
  4442. CloseDraw.setFocusPainted(false);
  4443.  
  4444. CloseDraw.setBackground(new Color(223,85,83));
  4445.  
  4446. CloseDraw.setFont(ButtonFont);
  4447.  
  4448. CloseDraw.addActionListener(this);
  4449.  
  4450. CloseDraw.setSize(PictureFrame.getX(),20);
  4451.  
  4452. ParentPanel.add(CloseDraw,BorderLayout.PAGE_END);
  4453.  
  4454. ParentPanel.repaint();
  4455.  
  4456. PictureFrame.pack();
  4457.  
  4458. PictureFrame.setVisible(true);
  4459.  
  4460. PictureFrame.setLocationRelativeTo(null);
  4461.  
  4462. PictureFrame.setAlwaysOnTop(true);
  4463.  
  4464. PictureFrame.setAlwaysOnTop(false);
  4465.  
  4466. PictureFrame.setResizable(false);
  4467.  
  4468. PictureFrame.setIconImage(SASIDIcon.getImage());
  4469. }
  4470.  
  4471. public void draw(BufferedImage ImageName)
  4472. {
  4473. if (PictureFrame != null)
  4474. {
  4475. CloseAnimation(PictureFrame);
  4476.  
  4477. PictureFrame.dispose();
  4478. }
  4479.  
  4480. BufferedImage Image = null;
  4481.  
  4482. try
  4483. {
  4484. Image = ImageName;
  4485. }
  4486.  
  4487. catch (Exception ex)
  4488. {
  4489. LogError(ex);
  4490. }
  4491.  
  4492. PictureFrame = new JFrame();
  4493.  
  4494. PictureFrame.setUndecorated(true);
  4495.  
  4496. PictureFrame.addMouseMotionListener(this);
  4497.  
  4498. PictureFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  4499.  
  4500. JPanel ParentPanel = new JPanel();
  4501.  
  4502. ParentPanel.setLayout(new BorderLayout());
  4503.  
  4504. PictureFrame.setContentPane(ParentPanel);
  4505.  
  4506. JLabel PictureLabel = new JLabel(new ImageIcon(Image));
  4507.  
  4508. ParentPanel.add(PictureLabel, BorderLayout.PAGE_START);
  4509.  
  4510. CloseDraw = new JButton("Close");
  4511.  
  4512. CloseDraw.setFocusPainted(false);
  4513.  
  4514. CloseDraw.setBackground(new Color(223,85,83));
  4515.  
  4516. CloseDraw.setFont(ButtonFont);
  4517.  
  4518. CloseDraw.addActionListener(this);
  4519.  
  4520. CloseDraw.setSize(PictureFrame.getX(),20);
  4521.  
  4522. ParentPanel.add(CloseDraw,BorderLayout.PAGE_END);
  4523.  
  4524. ParentPanel.repaint();
  4525.  
  4526. PictureFrame.pack();
  4527.  
  4528. PictureFrame.setVisible(true);
  4529.  
  4530. PictureFrame.setLocationRelativeTo(null);
  4531.  
  4532. PictureFrame.setAlwaysOnTop(true);
  4533.  
  4534. PictureFrame.setAlwaysOnTop(false);
  4535.  
  4536. PictureFrame.setResizable(false);
  4537.  
  4538. PictureFrame.setIconImage(SASIDIcon.getImage());
  4539. }
  4540.  
  4541. public void Temperature()
  4542. {
  4543. if (TemperatureFrame != null)
  4544. {
  4545. CloseAnimation(TemperatureFrame);
  4546.  
  4547. TemperatureFrame.dispose();
  4548. }
  4549.  
  4550. TemperatureFrame = new JFrame();
  4551.  
  4552. TemperatureFrame.setTitle("Temperature Converter");
  4553.  
  4554. TemperatureFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  4555.  
  4556. JPanel ParentPanel = (JPanel)TemperatureFrame.getContentPane();
  4557.  
  4558. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  4559.  
  4560. ParentPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  4561.  
  4562. JPanel Value = new JPanel();
  4563.  
  4564. JLabel ValueLabel = new JLabel("Measurement: ");
  4565.  
  4566. StartingValue = new JTextField(20);
  4567.  
  4568. StartingValue.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  4569.  
  4570. Value.add(ValueLabel);
  4571.  
  4572. Value.add(StartingValue);
  4573.  
  4574. ParentPanel.add(Value);
  4575.  
  4576. JPanel RadioCurrentValue = new JPanel();
  4577.  
  4578. JLabel CurrentValue = new JLabel("Current Temperature Unit: ");
  4579.  
  4580. RadioCurrentValue.add(CurrentValue);
  4581.  
  4582. OldFahrenheit = new JRadioButton("Fahrenheit");
  4583.  
  4584. OldCelsius = new JRadioButton("Celsius");
  4585.  
  4586. OldKelvin = new JRadioButton("Kelvin");
  4587.  
  4588. RadioCurrentValueGroup = new ButtonGroup();
  4589.  
  4590. RadioCurrentValueGroup.add(OldFahrenheit);
  4591.  
  4592. RadioCurrentValueGroup.add(OldCelsius);
  4593.  
  4594. RadioCurrentValueGroup.add(OldKelvin);
  4595.  
  4596. ParentPanel.add(RadioCurrentValue);
  4597.  
  4598. RadioCurrentValue.add(OldFahrenheit);
  4599.  
  4600. RadioCurrentValue.add(OldCelsius);
  4601.  
  4602. RadioCurrentValue.add(OldKelvin);
  4603.  
  4604. JPanel RadioNewValue = new JPanel();
  4605.  
  4606. JLabel NewValue = new JLabel("Conversion Temperature Unit: ");
  4607.  
  4608. RadioNewValue.add(NewValue);
  4609.  
  4610. NewFahrenheit = new JRadioButton("Fahrenheit");
  4611.  
  4612. NewCelsius = new JRadioButton("Celsius");
  4613.  
  4614. NewKelvin = new JRadioButton("Kelvin");
  4615.  
  4616. RadioNewValueGroup = new ButtonGroup();
  4617.  
  4618. RadioNewValueGroup.add(NewFahrenheit);
  4619.  
  4620. RadioNewValueGroup.add(NewCelsius);
  4621.  
  4622. RadioNewValueGroup.add(NewKelvin);
  4623.  
  4624. ParentPanel.add(RadioNewValue);
  4625.  
  4626. RadioNewValue.add(NewFahrenheit);
  4627.  
  4628. RadioNewValue.add(NewCelsius);
  4629.  
  4630. RadioNewValue.add(NewKelvin);
  4631.  
  4632. JPanel BottomButtons = new JPanel();
  4633.  
  4634. Calculate = new JButton ("Calculate");
  4635.  
  4636. Calculate.addActionListener(this);
  4637.  
  4638. ResetValues = new JButton ("Reset Values");
  4639.  
  4640. ResetValues.addActionListener(this);
  4641.  
  4642. Calculate.setFocusPainted(false);
  4643.  
  4644. Calculate.setBackground(new Color(223,85,83));
  4645.  
  4646. Calculate.setFont(ButtonFont);
  4647.  
  4648. ResetValues.setFocusPainted(false);
  4649.  
  4650. ResetValues.setBackground(new Color(223,85,83));
  4651.  
  4652. ResetValues.setFont(ButtonFont);
  4653.  
  4654. BottomButtons.add(Calculate);
  4655.  
  4656. BottomButtons.add(ResetValues);
  4657.  
  4658. ParentPanel.add(BottomButtons);
  4659.  
  4660. TemperatureFrame.pack();
  4661.  
  4662. TemperatureFrame.setVisible(true);
  4663.  
  4664. TemperatureFrame.setLocationRelativeTo(null);
  4665.  
  4666. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\temperature.png");
  4667.  
  4668. TemperatureFrame.setIconImage(img.getImage());
  4669.  
  4670. TemperatureFrame.setAlwaysOnTop(true);
  4671.  
  4672. TemperatureFrame.setAlwaysOnTop(false);
  4673. }
  4674.  
  4675. public void ClickMe()
  4676. {
  4677. if (ClickMeFrame != null)
  4678. {
  4679. ClickMeFrame.dispose();
  4680. }
  4681.  
  4682. ClickMeFrame = new JFrame();
  4683.  
  4684. ClickMeFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  4685.  
  4686. ClickMeFrame.setIconImage(SASIDIcon.getImage());
  4687.  
  4688. JPanel ParentPanel = (JPanel) ClickMeFrame.getContentPane();
  4689.  
  4690. ClickMe = new JButton("Click Me!");
  4691.  
  4692. ClickMe.setFocusPainted(false);
  4693.  
  4694. ClickMe.setBackground(new Color(223,85,83));
  4695.  
  4696. ClickMe.setFont(ButtonFont);
  4697.  
  4698. ClickMe.addActionListener(this);
  4699.  
  4700. ParentPanel.add(ClickMe);
  4701.  
  4702. ClickMeFrame.pack();
  4703.  
  4704. ClickMeFrame.setVisible(true);
  4705.  
  4706. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  4707.  
  4708. GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
  4709.  
  4710. Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
  4711.  
  4712. int X = (int) rect.getMaxX() - 120;
  4713.  
  4714. int Y = (int) rect.getMaxY() - 120;
  4715.  
  4716. int RandomX = RI(80,X);
  4717.  
  4718. int RandomY = RI(80,Y);
  4719.  
  4720. ClickMeFrame.setResizable(false);
  4721.  
  4722. ClickMeFrame.setLocation(RandomX,RandomY);
  4723.  
  4724. ClickMeFrame.setAlwaysOnTop(true);
  4725. }
  4726.  
  4727. WindowAdapter ConsoleEcho = new WindowAdapter()
  4728. {
  4729. public void windowOpened(WindowEvent e)
  4730. {
  4731. InputField.requestFocus();
  4732.  
  4733. if (IsChristmas() && !ChristmasEcho)
  4734. {
  4735. println("Merry Christmas!");
  4736.  
  4737. ChristmasEcho = true;
  4738. }
  4739.  
  4740. if (IsHalloween() && !HalloweenEcho)
  4741. {
  4742. println("Happy Halloween!");
  4743.  
  4744. HalloweenEcho = true;
  4745. }
  4746.  
  4747. if (IsIndependenceDay() && !IndependenceDayEcho)
  4748. {
  4749. println("Happy 4th of July!");
  4750.  
  4751. IndependenceDayEcho = true;
  4752. }
  4753.  
  4754. if (IsThanksgiving() && !ThanksgivingEcho)
  4755. {
  4756. println("Happy Thanksgiving!");
  4757.  
  4758. ThanksgivingEcho = true;
  4759. }
  4760.  
  4761. if (IsAprilFoolsDay() && !AprilFoolsDayEcho)
  4762. {
  4763. println("Happy April Fools Day!");
  4764.  
  4765. AprilFoolsDayEcho = true;
  4766. }
  4767. }
  4768. };
  4769.  
  4770. KeyListener CommandScrolling = new KeyListener()
  4771. {
  4772. @Override
  4773. public void keyPressed(java.awt.event.KeyEvent event)
  4774. {
  4775. int code = event.getKeyCode();
  4776.  
  4777. try
  4778. {
  4779. if (code == KeyEvent.VK_UP)
  4780. {
  4781. if (ScrollingIndex + 1 < OperationList.size())
  4782. {
  4783. ScrollingIndex = ScrollingIndex + 1;
  4784.  
  4785. InputField.setText(OperationList.get(ScrollingIndex));
  4786. }
  4787. }
  4788.  
  4789. else if (code == KeyEvent.VK_DOWN)
  4790. {
  4791. boolean Found = false;
  4792.  
  4793. for (int i = 0 ; i < OperationList.size() ; i++)
  4794. {
  4795. if (OperationList.get(i).equals(InputField.getText()))
  4796. {
  4797. Found = true;
  4798.  
  4799. break;
  4800. }
  4801.  
  4802. else if (!OperationList.get(i).equals(InputField.getText()) && i == OperationList.size() - 1)
  4803. {
  4804. Found = false;
  4805.  
  4806. break;
  4807. }
  4808. }
  4809.  
  4810. if (InputField.getText() == null || InputField.getText().equals(""))
  4811. {
  4812. CurrentDowns = 0;
  4813. }
  4814.  
  4815. else if (!Found)
  4816. {
  4817. CurrentDowns = 0;
  4818. }
  4819.  
  4820. if (ScrollingIndex - 1 >= 0)
  4821. {
  4822. if (CurrentDowns != 0)
  4823. {
  4824. ScrollingIndex = ScrollingIndex - 1;
  4825. }
  4826.  
  4827. InputField.setText(OperationList.get(ScrollingIndex));
  4828.  
  4829. CurrentDowns++;
  4830. }
  4831.  
  4832. if (OperationList.size() == 1)
  4833. {
  4834. InputField.setText(OperationList.get(0));
  4835. }
  4836. }
  4837.  
  4838. for (int i = 61440 ; i < 61452 ; i++)
  4839. {
  4840. if (code == i)
  4841. {
  4842. println("Interesting F" + (i - 61427) + " key.");
  4843. }
  4844. }
  4845. }
  4846.  
  4847. catch (Exception e)
  4848. {
  4849. LogError(e);
  4850. }
  4851. }
  4852.  
  4853. @Override
  4854. public void keyReleased(java.awt.event.KeyEvent event)
  4855. {
  4856.  
  4857. }
  4858.  
  4859. @Override
  4860. public void keyTyped(java.awt.event.KeyEvent event)
  4861. {
  4862.  
  4863. }
  4864. };
  4865.  
  4866. Action InputFieldAction = new AbstractAction()
  4867. {
  4868. private static final long serialVersionUID = 1L;
  4869.  
  4870. @Override
  4871. public void actionPerformed(ActionEvent e)
  4872. {
  4873. OriginalOperation = InputField.getText().trim();
  4874.  
  4875. operation = InputField.getText().trim();
  4876.  
  4877. if (!MathShellMode)
  4878. {
  4879. operation = operation.replace(".","");
  4880. }
  4881.  
  4882. if (!operation.equals(""))
  4883. {
  4884. OperationList.add(operation);
  4885.  
  4886. ScrollingIndex = OperationList.size() - 1;
  4887.  
  4888. CurrentDowns = 0;
  4889.  
  4890. if (MathShellMode != true)
  4891. {
  4892. try
  4893. {
  4894. Handle(operation);
  4895. }
  4896.  
  4897. catch (Exception ex)
  4898. {
  4899. LogError(ex);
  4900. }
  4901. }
  4902.  
  4903. else
  4904. {
  4905. MathShell(operation);
  4906. }
  4907. }
  4908.  
  4909. InputField.setText("");
  4910. }
  4911. };
  4912.  
  4913. public int RI(int min, int max)
  4914. {
  4915. Random rand = new Random();
  4916.  
  4917. int randomNum = rand.nextInt((max - min) + 1) + min;
  4918.  
  4919. return randomNum;
  4920. }
  4921.  
  4922. public void PizzaPlace()
  4923. {
  4924. if (PizzaFrame != null)
  4925. {
  4926. CloseAnimation(PizzaFrame);
  4927.  
  4928. PizzaFrame.dispose();
  4929. }
  4930.  
  4931. PizzaFrame = new JFrame();
  4932.  
  4933. PizzaFrame.setTitle("Pizza Orderer");
  4934.  
  4935. PizzaFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  4936.  
  4937. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\pizza.png");
  4938.  
  4939. PizzaFrame.setIconImage(img.getImage());
  4940.  
  4941. PizzaFrame.setResizable(false);
  4942.  
  4943. JPanel PizzaPanel = (JPanel)PizzaFrame.getContentPane();
  4944.  
  4945. PizzaPanel.setLayout(new BoxLayout(PizzaPanel,BoxLayout.Y_AXIS));
  4946.  
  4947. PizzaPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  4948.  
  4949. JPanel Customer = new JPanel();
  4950.  
  4951. JLabel CustomerName = new JLabel("Name: ");
  4952.  
  4953. EnterName = new JTextField(20);
  4954.  
  4955. EnterName.addKeyListener(new KeyListener()
  4956. {
  4957. @Override
  4958. public void keyPressed(java.awt.event.KeyEvent e)
  4959. {
  4960. if (EnterName.getText().length() == 1)
  4961. {
  4962. EnterName.setText(EnterName.getText().toUpperCase());
  4963. }
  4964. }
  4965.  
  4966. @Override
  4967. public void keyReleased(java.awt.event.KeyEvent e)
  4968. {
  4969. if (EnterName.getText().length() == 1)
  4970. {
  4971. EnterName.setText(EnterName.getText().toUpperCase());
  4972. }
  4973. }
  4974.  
  4975. @Override
  4976. public void keyTyped(java.awt.event.KeyEvent e)
  4977. {
  4978. if (EnterName.getText().length() == 1)
  4979. {
  4980. EnterName.setText(EnterName.getText().toUpperCase());
  4981. }
  4982. }
  4983. });
  4984.  
  4985. EnterName.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  4986.  
  4987. Customer.add(CustomerName);
  4988.  
  4989. Customer.add(EnterName);
  4990.  
  4991. PizzaPanel.add(Customer);
  4992.  
  4993. JPanel RadioPizzaSize = new JPanel();
  4994.  
  4995. JLabel PizzaSize = new JLabel("Pizza Size: ");
  4996.  
  4997. RadioPizzaSize.add(PizzaSize);
  4998.  
  4999. Small = new JRadioButton("Small");
  5000.  
  5001. Medium = new JRadioButton("Medium");
  5002.  
  5003. Large = new JRadioButton("Large");
  5004.  
  5005. ButtonGroup RadioPizzaGroup = new ButtonGroup();
  5006.  
  5007. RadioPizzaGroup.add(Small);
  5008.  
  5009. RadioPizzaGroup.add(Medium);
  5010.  
  5011. RadioPizzaGroup.add(Large);
  5012.  
  5013. PizzaPanel.add(RadioPizzaSize);
  5014.  
  5015. RadioPizzaSize.add(Small);
  5016.  
  5017. RadioPizzaSize.add(Medium);
  5018.  
  5019. RadioPizzaSize.add(Large);
  5020.  
  5021. JPanel PizzaCrust = new JPanel();
  5022.  
  5023. JLabel CrustType = new JLabel("Crust Type: ");
  5024.  
  5025. PizzaCrust.add(CrustType);
  5026.  
  5027. String[] CrustTypeChoice = {"Thin", "Thick", "Deep Dish"};
  5028.  
  5029. PizzaCrustCombo = new JComboBox(CrustTypeChoice);
  5030.  
  5031. PizzaCrust.add(PizzaCrustCombo);
  5032.  
  5033. PizzaPanel.add(PizzaCrust);
  5034.  
  5035. JPanel PizzaTopings = new JPanel();
  5036.  
  5037. JLabel Topings = new JLabel("Topings: ");
  5038.  
  5039. PizzaTopings.add(Topings);
  5040.  
  5041. String[] PizzaTopingsChoice = {"Pepperoni", "Sausage", "Green Peppers",
  5042. "Onions", "Tomatoes", "Anchovies", "Bacon","Chicken", "Beef",
  5043. "Olives", "Mushrooms"};
  5044.  
  5045. JList jList = new JList(PizzaTopingsChoice);
  5046.  
  5047. PizzaTopingsList = jList;
  5048.  
  5049. PizzaTopingsList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  5050.  
  5051. JScrollPane PizzaTopingsListScroll = new JScrollPane(PizzaTopingsList,
  5052. JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  5053. JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  5054.  
  5055. PizzaTopings.add(PizzaTopingsListScroll);
  5056.  
  5057. PizzaPanel.add(PizzaTopings);
  5058.  
  5059. JPanel ExtraItems = new JPanel();
  5060.  
  5061. JLabel Extra = new JLabel("Extras: ");
  5062.  
  5063. ExtraItems.add(Extra);
  5064.  
  5065. BreadSticks = new JCheckBox("BreadSticks");
  5066.  
  5067. Salad = new JCheckBox("Salad");
  5068.  
  5069. Soda = new JCheckBox("Soda");
  5070.  
  5071. ExtraItems.add(BreadSticks);
  5072.  
  5073. ExtraItems.add(Salad);
  5074.  
  5075. ExtraItems.add(Soda);
  5076.  
  5077. PizzaPanel.add(ExtraItems);
  5078.  
  5079. JPanel AdditionalComments = new JPanel();
  5080.  
  5081. JLabel OrderComments = new JLabel("Order Comments: ");
  5082.  
  5083. AdditionalComments.add(OrderComments);
  5084.  
  5085. OrderCommentsTextArea = new JTextArea(5,20);
  5086.  
  5087. OrderCommentsTextArea.setLineWrap(true);
  5088.  
  5089. JScrollPane OrderCommentsTextAreaScroll = new JScrollPane
  5090. (OrderCommentsTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  5091.  
  5092. AdditionalComments.add(OrderCommentsTextAreaScroll);
  5093.  
  5094. PizzaPanel.add(AdditionalComments);
  5095.  
  5096. JPanel BottomButtons = new JPanel();
  5097.  
  5098. PlaceOrder = new JButton ("Place Order");
  5099.  
  5100. PlaceOrder.addActionListener(this);
  5101.  
  5102. ResetPizza = new JButton ("Reset Values");
  5103.  
  5104. ResetPizza.addActionListener(this);
  5105.  
  5106. ResetPizza.setFocusPainted(false);
  5107.  
  5108. ResetPizza.setBackground(new Color(223,85,83));
  5109.  
  5110. ResetPizza.setFont(ButtonFont);
  5111.  
  5112. PlaceOrder.setFocusPainted(false);
  5113.  
  5114. PlaceOrder.setBackground(new Color(223,85,83));
  5115.  
  5116. PlaceOrder.setFont(ButtonFont);
  5117.  
  5118. BottomButtons.add(PlaceOrder);
  5119.  
  5120. BottomButtons.add(ResetPizza);
  5121.  
  5122. PizzaPanel.add(BottomButtons);
  5123.  
  5124. PizzaFrame.pack();
  5125.  
  5126. PizzaFrame.setVisible(true);
  5127.  
  5128. PizzaFrame.setLocationRelativeTo(null);
  5129. }
  5130.  
  5131. public void PhoneDialer()
  5132. {
  5133. if (PhoneFrame != null)
  5134. {
  5135. CloseAnimation(PhoneFrame);
  5136.  
  5137. PhoneFrame.dispose();
  5138. }
  5139.  
  5140. PhoneFrame = new JFrame();
  5141.  
  5142. PhoneFrame.setTitle("Phone");
  5143.  
  5144. PhoneFrame.setLocationRelativeTo(null);
  5145.  
  5146. PhoneFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  5147.  
  5148. JPanel MyPanel = (JPanel)PhoneFrame.getContentPane();
  5149.  
  5150. MyPanel.setLayout(new BoxLayout(MyPanel, BoxLayout.Y_AXIS));
  5151.  
  5152. JPanel topPanel = new JPanel();
  5153.  
  5154. NumberLabel = new JLabel("Enter a Number to Call");
  5155.  
  5156. topPanel.add(NumberLabel);
  5157.  
  5158. JPanel ButtonsPanel = new JPanel();
  5159.  
  5160. GridLayout layout3 = new GridLayout(4,3,5,5);
  5161.  
  5162. ButtonsPanel.setLayout(layout3);
  5163.  
  5164. Border myBorder = BorderFactory.createEmptyBorder(5,5,5,5);
  5165.  
  5166. MyPanel.setBorder(myBorder);
  5167.  
  5168. Zero = new JButton("0");
  5169.  
  5170. One = new JButton("1");
  5171.  
  5172. Two = new JButton("2");
  5173.  
  5174. Three = new JButton("3");
  5175.  
  5176. Four = new JButton("4");
  5177.  
  5178. Five = new JButton("5");
  5179.  
  5180. Six = new JButton("6");
  5181.  
  5182. Seven = new JButton("7");
  5183.  
  5184. Eight = new JButton("8");
  5185.  
  5186. Nine = new JButton("9");
  5187.  
  5188. Back = new JButton("<X");
  5189.  
  5190. DialNumber = new JButton("Call");
  5191.  
  5192. ButtonsPanel.add(One);
  5193.  
  5194. ButtonsPanel.add(Two);
  5195.  
  5196. ButtonsPanel.add(Three);
  5197.  
  5198. ButtonsPanel.add(Four);
  5199.  
  5200. ButtonsPanel.add(Five);
  5201.  
  5202. ButtonsPanel.add(Six);
  5203.  
  5204. ButtonsPanel.add(Seven);
  5205.  
  5206. ButtonsPanel.add(Eight);
  5207.  
  5208. ButtonsPanel.add(Nine);
  5209.  
  5210. ButtonsPanel.add(DialNumber);
  5211.  
  5212. ButtonsPanel.add(Zero);
  5213.  
  5214. ButtonsPanel.add(Back);
  5215.  
  5216. MyPanel.add(topPanel);
  5217.  
  5218. MyPanel.add(ButtonsPanel);
  5219.  
  5220. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\phone.png");
  5221.  
  5222. PhoneFrame.setIconImage(img.getImage());
  5223.  
  5224. PhoneFrame.setVisible(true);
  5225.  
  5226. PhoneFrame.setAlwaysOnTop(true);
  5227.  
  5228. PhoneFrame.setAlwaysOnTop(false);
  5229.  
  5230. One.addActionListener(this);
  5231.  
  5232. Two.addActionListener(this);
  5233.  
  5234. Three.addActionListener(this);
  5235.  
  5236. Four.addActionListener(this);
  5237.  
  5238. Five.addActionListener(this);
  5239.  
  5240. Six.addActionListener(this);
  5241.  
  5242. Seven.addActionListener(this);
  5243.  
  5244. Eight.addActionListener(this);
  5245.  
  5246. Nine.addActionListener(this);
  5247.  
  5248. Zero.addActionListener(this);
  5249.  
  5250. Back.addActionListener(this);
  5251.  
  5252. One.setFocusPainted(false);
  5253.  
  5254. One.setBackground(new Color(223,85,83));
  5255.  
  5256. One.setFont(ButtonFont);
  5257.  
  5258. Two.setFocusPainted(false);
  5259.  
  5260. Two.setBackground(new Color(223,85,83));
  5261.  
  5262. Two.setFont(ButtonFont);
  5263.  
  5264. Three.setFocusPainted(false);
  5265.  
  5266. Three.setBackground(new Color(223,85,83));
  5267.  
  5268. Three.setFont(ButtonFont);
  5269.  
  5270. Four.setFocusPainted(false);
  5271.  
  5272. Four.setBackground(new Color(223,85,83));
  5273.  
  5274. Four.setFont(ButtonFont);
  5275.  
  5276. Five.setFocusPainted(false);
  5277.  
  5278. Five.setBackground(new Color(223,85,83));
  5279.  
  5280. Five.setFont(ButtonFont);
  5281.  
  5282. Six.setFocusPainted(false);
  5283.  
  5284. Six.setBackground(new Color(223,85,83));
  5285.  
  5286. Six.setFont(ButtonFont);
  5287.  
  5288. Seven.setFocusPainted(false);
  5289.  
  5290. Seven.setBackground(new Color(223,85,83));
  5291.  
  5292. Seven.setFont(ButtonFont);
  5293.  
  5294. Eight.setFocusPainted(false);
  5295.  
  5296. Eight.setBackground(new Color(223,85,83));
  5297.  
  5298. Eight.setFont(ButtonFont);
  5299.  
  5300. Nine.setFocusPainted(false);
  5301.  
  5302. Nine.setBackground(new Color(223,85,83));
  5303.  
  5304. Nine.setFont(ButtonFont);
  5305.  
  5306. Zero.setFocusPainted(false);
  5307.  
  5308. Zero.setBackground(new Color(223,85,83));
  5309.  
  5310. Zero.setFont(ButtonFont);
  5311.  
  5312. Back.setFocusPainted(false);
  5313.  
  5314. Back.setBackground(new Color(223,85,83));
  5315.  
  5316. Back.setFont(ButtonFont);
  5317.  
  5318. DialNumber.setFocusPainted(false);
  5319.  
  5320. DialNumber.setBackground(new Color(223,85,83));
  5321.  
  5322. DialNumber.setFont(ButtonFont);
  5323.  
  5324. DialNumber.addActionListener(this);
  5325.  
  5326. PhoneFrame.pack();
  5327.  
  5328. PhoneFrame.setVisible(true);
  5329.  
  5330. PhoneFrame.setResizable(false);
  5331.  
  5332. PhoneFrame.setLocationRelativeTo(null);
  5333. }
  5334.  
  5335. public static boolean StringCompareArray(String operation, String[] array)
  5336. {
  5337. return Arrays.stream(array).parallel().anyMatch(operation::contains);
  5338. }
  5339.  
  5340. public void ResetMouse()
  5341. {
  5342. try
  5343. {
  5344. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  5345. int centerX = screenSize.width/2;
  5346. int centerY = screenSize.height/2;
  5347. Rob = new Robot();
  5348. Rob.mouseMove(centerX, centerY);
  5349. }
  5350.  
  5351. catch (Exception ex)
  5352. {
  5353. LogError(ex);
  5354. }
  5355. }
  5356.  
  5357. public void CLC()
  5358. {
  5359. OutputArea.setText("");
  5360.  
  5361. InputField.setText("");
  5362. }
  5363.  
  5364. public void PlayMusic(String FilePath)
  5365. {
  5366. try
  5367. {
  5368. StopMusic();
  5369.  
  5370. FileInputStream FileInputStream = new FileInputStream(FilePath);
  5371.  
  5372. Player = new Player(FileInputStream);
  5373.  
  5374. Thread MusicThread = new Thread()
  5375. {
  5376. @Override
  5377. public void run()
  5378. {
  5379. try
  5380. {
  5381. Player.play();
  5382. }
  5383.  
  5384. catch (Exception e)
  5385. {
  5386. LogError(e);
  5387. }
  5388. }
  5389. };
  5390.  
  5391. MusicThread.start();
  5392. }
  5393.  
  5394. catch(Exception e)
  5395. {
  5396. LogError(e);
  5397. }
  5398. }
  5399.  
  5400. public void StopMusic()
  5401. {
  5402. try
  5403. {
  5404. if (!Player.isComplete())
  5405. {
  5406. Player.close();
  5407. }
  5408.  
  5409. Player = null;
  5410. }
  5411.  
  5412. catch (Exception e)
  5413. {
  5414.  
  5415. }
  5416. }
  5417.  
  5418. public String ErrorTime()
  5419. {
  5420. DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy--h-mm-aa");
  5421.  
  5422. Date date = new Date();
  5423.  
  5424. return dateFormat.format(date);
  5425. }
  5426.  
  5427. public String UserTime()
  5428. {
  5429. Date Time = new Date();
  5430.  
  5431. SimpleDateFormat dateFormatter = new SimpleDateFormat("EEEEEEEEE, MM/dd/yyyy hh:mmaa zzz");
  5432.  
  5433. return dateFormatter.format(Time);
  5434. }
  5435.  
  5436. public String WeatherTime()
  5437. {
  5438. Date Time = new Date();
  5439.  
  5440. SimpleDateFormat dateFormatter = new SimpleDateFormat("h:mm:ss aa zzz EEEEEEEEEEEEE MMMMMMMMMMMMMMMMMM dd, yyyy");
  5441.  
  5442. return dateFormatter.format(Time);
  5443. }
  5444.  
  5445. public void QBox(String Message)
  5446. {
  5447. if (ConsoleFrame != null)
  5448. {
  5449. WindowsFeel(ConsoleFrame);
  5450.  
  5451. JOptionPane.showMessageDialog(null, Message, "", JOptionPane.PLAIN_MESSAGE, SASIDIcon);
  5452.  
  5453. SwingFeel(ConsoleFrame);
  5454. }
  5455.  
  5456. else if (LoginFrame != null)
  5457. {
  5458. WindowsFeel(LoginFrame);
  5459.  
  5460. JOptionPane.showMessageDialog(null, Message, "", JOptionPane.PLAIN_MESSAGE, SASIDIcon);
  5461.  
  5462. SwingFeel(LoginFrame);
  5463. }
  5464.  
  5465. else
  5466. {
  5467. JFrame myFrame = new JFrame();
  5468.  
  5469. WindowsFeel(myFrame);
  5470.  
  5471. JOptionPane.showMessageDialog(null, Message, "", JOptionPane.PLAIN_MESSAGE, SASIDIcon);
  5472.  
  5473. SwingFeel(myFrame);
  5474. }
  5475. }
  5476.  
  5477. public boolean has(String compare)
  5478. {
  5479. String ThisComp = compare.toLowerCase();
  5480.  
  5481. String ThisOp = operation.toLowerCase();
  5482.  
  5483. if (ThisOp.contains(ThisComp))
  5484. {
  5485. return true;
  5486. }
  5487.  
  5488. return false;
  5489. }
  5490.  
  5491. public boolean hasWord(String compare)
  5492. {
  5493. String ThisComp = compare.toLowerCase();
  5494.  
  5495. String ThisOp = operation.toLowerCase();
  5496.  
  5497. if (ThisOp.equals(ThisComp))
  5498. {
  5499. return true;
  5500. }
  5501.  
  5502. else if (ThisOp.contains(" " + ThisComp + " "))
  5503. {
  5504. return true;
  5505. }
  5506.  
  5507. else if (endsWith(ThisOp, ThisComp))
  5508. {
  5509. return true;
  5510. }
  5511.  
  5512. else if (startsWith(ThisOp,ThisComp))
  5513. {
  5514. return true;
  5515. }
  5516.  
  5517. return false;
  5518. }
  5519.  
  5520. public boolean startsWith(String op, String comp)
  5521. {
  5522. char[] opA = op.toLowerCase().toCharArray();
  5523.  
  5524. char[] compA = comp.toLowerCase().toCharArray();
  5525.  
  5526. for (int i = 0 ; i < comp.length() ; i++)
  5527. {
  5528. if (compA[i] != opA[i])
  5529. {
  5530. return false;
  5531. }
  5532.  
  5533. else if (compA[i] == opA[i] && i == compA.length - 1 && opA[i+1] == ' ')
  5534. {
  5535. return true;
  5536. }
  5537. }
  5538.  
  5539. return false;
  5540. }
  5541.  
  5542. public boolean endsWith(String op, String comp)
  5543. {
  5544. char[] opA = reverseArray(op.toLowerCase().toCharArray());
  5545.  
  5546. char[] compA = reverseArray(comp.toLowerCase().toCharArray());
  5547.  
  5548. for (int i = 0 ; i < comp.length() ; i++)
  5549. {
  5550. if (compA[i] != opA[i])
  5551. {
  5552. return false;
  5553. }
  5554.  
  5555. else if (compA[i] == opA[i] && i == compA.length - 1 && opA[i+1] == ' ')
  5556. {
  5557. return true;
  5558. }
  5559. }
  5560.  
  5561. return false;
  5562. }
  5563.  
  5564. public char[] reverseArray(char[] Array)
  5565. {
  5566. String reverse = new StringBuilder(new String(Array)).reverse().toString();
  5567.  
  5568. return reverse.toCharArray();
  5569. }
  5570.  
  5571. public void Login(boolean AlreadyOpen)
  5572. {
  5573. if (LoginFrame != null)
  5574. {
  5575. CloseAnimation(LoginFrame);
  5576.  
  5577. LoginFrame.dispose();
  5578. }
  5579.  
  5580. LoginFrame = new JFrame();
  5581.  
  5582. LoginFrame.setUndecorated(true);
  5583.  
  5584. if (!AlreadyOpen)
  5585. {
  5586. LoginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  5587. }
  5588.  
  5589. else if (AlreadyOpen)
  5590. {
  5591. LoginFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  5592. }
  5593.  
  5594. LoginFrame.setBounds(0, 0, 375, 391);
  5595.  
  5596. LoginFrame.setTitle("SASID Login");
  5597.  
  5598. LoginFrame.setIconImage(SASIDIcon.getImage());
  5599.  
  5600. ParentPanel = new JPanel();
  5601.  
  5602. LoginFrame.setContentPane(ParentPanel);
  5603.  
  5604. ParentPanel.setLayout(null);
  5605.  
  5606. JLabel LoginLabel = new JLabel("");
  5607.  
  5608. LoginLabel.setVerticalTextPosition(SwingConstants.TOP);
  5609.  
  5610. LoginLabel.setVerticalAlignment(SwingConstants.TOP);
  5611.  
  5612. LoginLabel.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Login.png"));
  5613.  
  5614. LoginLabel.setBounds(0, 0, 375, 391);
  5615.  
  5616. LoginLabel.addMouseMotionListener(this);
  5617.  
  5618. ImageIcon GifIcon = new ImageIcon("SASIDFiles\\Video\\Splash.gif");
  5619.  
  5620. SplashLabel = new JLabel(GifIcon);
  5621.  
  5622. SplashLabel.setToolTipText("Click to see the most recent SASID video!");
  5623.  
  5624. SplashLabel.addMouseListener(this);
  5625.  
  5626. SplashLabel.setBounds(67, 98, 286, 53);
  5627.  
  5628. NameField = new JTextField(20);
  5629.  
  5630. NameField.setToolTipText("Username");
  5631.  
  5632. NameField.setBounds(60,202,260,41);
  5633.  
  5634. NameField.setBackground(new Color(26,32,51));
  5635.  
  5636. NameField.setSelectionColor(new Color(204,153,0));
  5637.  
  5638. NameField.setBorder(null);
  5639.  
  5640. NameField.setFont(new Font("Comic Sans MS",Font.BOLD, 25));
  5641.  
  5642. NameField.setForeground(Vanila);
  5643.  
  5644. NameField.setCaretColor(NameField.getBackground());
  5645.  
  5646. NameField.addActionListener(new ActionListener()
  5647. {
  5648. @Override
  5649. public void actionPerformed(ActionEvent e)
  5650. {
  5651. NameField.requestFocusInWindow();
  5652. }
  5653. });
  5654.  
  5655. NameField.addKeyListener(new KeyListener()
  5656. {
  5657. @Override
  5658. public void keyPressed(java.awt.event.KeyEvent e)
  5659. {
  5660. if (NameField.getText().length() == 1)
  5661. {
  5662. NameField.setText(NameField.getText().toUpperCase());
  5663. }
  5664. }
  5665.  
  5666. @Override
  5667. public void keyReleased(java.awt.event.KeyEvent e)
  5668. {
  5669. if (NameField.getText().length() == 1)
  5670. {
  5671. NameField.setText(NameField.getText().toUpperCase());
  5672. }
  5673. }
  5674.  
  5675. @Override
  5676. public void keyTyped(java.awt.event.KeyEvent e)
  5677. {
  5678. if (NameField.getText().length() == 1)
  5679. {
  5680. NameField.setText(NameField.getText().toUpperCase());
  5681. }
  5682. }
  5683. });
  5684.  
  5685. NameField.addKeyListener(new java.awt.event.KeyAdapter()
  5686. {
  5687. public void keyTyped(java.awt.event.KeyEvent evt)
  5688. {
  5689. if (NameField.getText().length() > 15)
  5690. {
  5691. evt.consume();
  5692. }
  5693.  
  5694. if (evt.getKeyChar() == KeyEvent.VK_ENTER)
  5695. {
  5696. pass.requestFocus();
  5697. }
  5698. }
  5699. });
  5700.  
  5701. NameField.setBorder(BorderFactory.createEmptyBorder());
  5702.  
  5703. CloseLog = new JButton("");
  5704.  
  5705. CloseLog.addActionListener(this);
  5706.  
  5707. CloseLog.addMouseListener(this);
  5708.  
  5709. CloseLog.setBounds(350,3,22,22);
  5710.  
  5711. CloseLog.setFocusable(false);
  5712.  
  5713. CloseLog.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close1.png"));
  5714.  
  5715. LoginLabel.add(CloseLog);
  5716.  
  5717. CloseLog.setContentAreaFilled(false);
  5718.  
  5719. CloseLog.setBorderPainted(false);
  5720.  
  5721. CloseLog.setToolTipText("Close");
  5722.  
  5723. pass = new JPasswordField();
  5724.  
  5725. pass.setToolTipText("Password");
  5726.  
  5727. pass.setBounds(59,272,262,40);
  5728.  
  5729. pass.setBackground(new Color(26,32,51));
  5730.  
  5731. pass.setSelectionColor(new Color(204,153,0));
  5732.  
  5733. pass.setBorder(null);
  5734.  
  5735. pass.setFont(DefaultFont);
  5736.  
  5737. pass.setForeground(Vanila);
  5738.  
  5739. pass.setCaretColor(NameField.getBackground());
  5740.  
  5741. pass.addActionListener(new ActionListener()
  5742. {
  5743. @Override
  5744. public void actionPerformed(ActionEvent e)
  5745. {
  5746. Username = NameField.getText().trim();
  5747.  
  5748. Username = Username.substring(0, 1).toUpperCase() + Username.substring(1);
  5749.  
  5750. String Password = new String(pass.getPassword());
  5751.  
  5752. if (Username != null && !Username.equals(""))
  5753. {
  5754. Recognize(Username, Password);
  5755. }
  5756. }
  5757. });
  5758.  
  5759. pass.addKeyListener(new java.awt.event.KeyAdapter()
  5760. {
  5761. public void keyTyped(java.awt.event.KeyEvent evt)
  5762. {
  5763. if (pass.getPassword().length > 15)
  5764. {
  5765. evt.consume();
  5766. }
  5767. }
  5768. });
  5769.  
  5770. pass.setBorder(BorderFactory.createEmptyBorder());
  5771.  
  5772. NewUserLabel = new JLabel("Don't have an account?", SwingConstants.CENTER);
  5773.  
  5774. NewUserLabel.setFont(new Font("Tahoma",Font.BOLD,18));
  5775.  
  5776. NewUserLabel.setForeground(Vanila);
  5777.  
  5778. NewUserLabel.addMouseListener(this);
  5779.  
  5780. NewUserLabel.setBounds(59,333,262,33);
  5781.  
  5782. LoginLabel.add(NameField);
  5783.  
  5784. LoginLabel.add(pass);
  5785.  
  5786. LoginLabel.add(SplashLabel);
  5787.  
  5788. LoginLabel.add(NewUserLabel);
  5789.  
  5790. ParentPanel.add(LoginLabel);
  5791.  
  5792. LoginFrame.setLocationRelativeTo(null);
  5793.  
  5794. LoginFrame.setVisible(true);
  5795.  
  5796. LoginFrame.setAlwaysOnTop(true);
  5797.  
  5798. LoginFrame.setAlwaysOnTop(false);
  5799.  
  5800. LoginFrame.addWindowListener( new WindowAdapter()
  5801. {
  5802. public void windowOpened(WindowEvent e)
  5803. {
  5804. NameField.requestFocus();
  5805. }
  5806. });
  5807. }
  5808.  
  5809. public void Recognize(String Username, String Password)
  5810. {
  5811. File UserDir = new File("JesseUsers\\" + Username.toLowerCase());
  5812.  
  5813. if (UserDir.isDirectory() && CheckPassword(Password))
  5814. {
  5815. CloseAnimation(LoginFrame);
  5816.  
  5817. LoginFrame.dispose();
  5818.  
  5819. if (ConsoleFrame != null)
  5820. {
  5821. CloseAnimation(ConsoleFrame);
  5822.  
  5823. ConsoleFrame.dispose();
  5824. }
  5825.  
  5826. Console();
  5827.  
  5828. if (GetPreference("PlayMusic") == 1)
  5829. {
  5830. LinkedList<String> MusicList = new LinkedList<String>();
  5831.  
  5832. File UserMusicDir = new File("JesseUsers\\" + Username + "\\Music");
  5833.  
  5834. String[] FileNames = UserMusicDir.list();
  5835.  
  5836. for (int i = 0; i < FileNames.length; i++)
  5837. {
  5838. if (FileNames[i].endsWith(".mp3"))
  5839. {
  5840. MusicList.add(FileNames[i]);
  5841. }
  5842. }
  5843.  
  5844. if (!MusicList.isEmpty())
  5845. {
  5846. PlayMusic("JesseUsers\\" + Username + "\\Music\\" + FileNames[RI(0,FileNames.length - 1)]);
  5847. }
  5848. }
  5849.  
  5850. if (GetPreference("SystemPropertiesOnStart") == 1)
  5851. {
  5852. ShowProperties();
  5853. }
  5854. }
  5855.  
  5856. else
  5857. {
  5858. NameField.setText("");
  5859.  
  5860. pass.setText("");
  5861.  
  5862. NameField.requestFocusInWindow();
  5863. }
  5864. }
  5865.  
  5866. public boolean CheckPassword(String Password)
  5867. {
  5868. try
  5869. {
  5870. BufferedReader PasswordReader = new BufferedReader(new FileReader("JesseUsers\\" + Username + "\\Password.txt"));
  5871.  
  5872. String RealPassword = PasswordReader.readLine();
  5873.  
  5874. PasswordReader.close();
  5875.  
  5876. if (RealPassword.equals(Hash(Password)))
  5877. {
  5878. return true;
  5879. }
  5880. }
  5881.  
  5882. catch (Exception e)
  5883. {
  5884. LogError(e);
  5885. }
  5886.  
  5887. return false;
  5888. }
  5889.  
  5890. public String Hash(String QuestionPassword)
  5891. {
  5892. try
  5893. {
  5894. String HashedPassword = null;
  5895.  
  5896. MessageDigest MesDig = MessageDigest.getInstance("MD5");
  5897.  
  5898. MesDig.update(QuestionPassword.getBytes());
  5899.  
  5900. byte[] bytes = MesDig.digest();
  5901.  
  5902. StringBuilder SringB = new StringBuilder();
  5903.  
  5904. for(int i = 0 ; i < bytes.length ; i++)
  5905. {
  5906. SringB.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
  5907. }
  5908.  
  5909. HashedPassword = SringB.toString();
  5910.  
  5911. return HashedPassword;
  5912. }
  5913.  
  5914. catch (Exception e)
  5915. {
  5916. LogError(e);
  5917. }
  5918.  
  5919. return null;
  5920. }
  5921.  
  5922. public void LogError(Exception e)
  5923. {
  5924. try
  5925. {
  5926. String WriteTo = "SASIDFiles\\Errors\\" + ErrorTime() + ".txt";
  5927.  
  5928. File Create = new File(WriteTo);
  5929.  
  5930. Create.createNewFile();
  5931.  
  5932. BufferedWriter ErrorOut = new BufferedWriter(new FileWriter(WriteTo));
  5933.  
  5934. StringWriter ErrorWriter = new StringWriter();
  5935.  
  5936. e.printStackTrace(new PrintWriter(ErrorWriter));
  5937.  
  5938. ErrorOut.write(ErrorWriter.toString());
  5939.  
  5940. ErrorOut.flush();
  5941.  
  5942. ErrorOut.close();
  5943.  
  5944. DisplayError(e);
  5945. }
  5946.  
  5947. catch (Exception ex) {}
  5948. }
  5949.  
  5950. public void DisplayError(Exception e)
  5951. {
  5952. TrayIcon.displayMessage(e.toString(), "Error thrown by line: " + e.getStackTrace()[0].getLineNumber(), MessageType.ERROR);
  5953. }
  5954.  
  5955. public String FirstNumber(String Search)
  5956. {
  5957. Pattern Pat = Pattern.compile("\\d+");
  5958.  
  5959. Matcher m = Pat.matcher(Search);
  5960.  
  5961. return m.find() ? m.group() : null;
  5962. }
  5963.  
  5964. public boolean YesOrNo(String Message)
  5965. {
  5966. WindowsFeel(ConsoleFrame);
  5967.  
  5968. int dialogueButton = JOptionPane.YES_NO_OPTION;
  5969.  
  5970. int dialogueResult = JOptionPane.showConfirmDialog(null, Message, "", dialogueButton, dialogueButton, SASIDIcon);
  5971.  
  5972. SwingFeel(ConsoleFrame);
  5973.  
  5974. if (dialogueResult == JOptionPane.YES_OPTION)
  5975. {
  5976. return true;
  5977. }
  5978.  
  5979. return false;
  5980. }
  5981.  
  5982. public String GetInput(String Message)
  5983. {
  5984. WindowsFeel(ConsoleFrame);
  5985.  
  5986. String WhatToDo = (String) JOptionPane.showInputDialog(null, Message, "", JOptionPane.PLAIN_MESSAGE, SASIDIcon, null, "");
  5987.  
  5988. SwingFeel(ConsoleFrame);
  5989.  
  5990. if (WhatToDo == null || WhatToDo == "" || WhatToDo.length() == 0)
  5991. {
  5992. return "";
  5993. }
  5994.  
  5995. return WhatToDo;
  5996. }
  5997.  
  5998. public void Help()
  5999. {
  6000. String[] Helps = {"Pixalte a Picture","Home","Mathsh","Pizza","Vexento","Youtube","Note","Create a User"
  6001. ,"Binary","Font","Color","Preferences","Hash","Directory Search","Tic Tac Toe","Youtube Thumbnail","Java"
  6002. ,"Tell me a story","Coffee","Papers Please","Delete User","YouTube Word Search","System Properties","Donuts"
  6003. ,"System Sounds","Weather","Music","mp3"};
  6004.  
  6005. ArrayList<Integer> UniqueIndexes = new ArrayList<Integer>();
  6006.  
  6007. for (int i = 0 ; i < Helps.length ; i++)
  6008. {
  6009. UniqueIndexes.add(i);
  6010. }
  6011.  
  6012. Collections.shuffle(UniqueIndexes);
  6013.  
  6014. println("Try typing:");
  6015.  
  6016. for (int i = 0 ; i < 10 ; i++)
  6017. {
  6018. println(Helps[UniqueIndexes.get(i)]);
  6019. }
  6020. }
  6021.  
  6022. public boolean EIC(String EIC)
  6023. {
  6024. if (operation.equalsIgnoreCase(EIC))
  6025. {
  6026. return true;
  6027. }
  6028.  
  6029. return false;
  6030.  
  6031. }
  6032.  
  6033. public boolean Filter(String FilterWord)
  6034. {
  6035. try
  6036. {
  6037. FilterWord = FilterWord.replace("1","i").replace("!","i").replace("3","e")
  6038. .replace("4","a").replace("@","a").replace("5","s").replace("7","t")
  6039. .replace("0","o").replace("9","g").replace("%", "i").replace("#","h").replace("$","s");
  6040.  
  6041. String fileName = "SASIDFiles\\Text\\Avoid.csv";
  6042.  
  6043. CSVreader = new BufferedReader(new FileReader(fileName));
  6044.  
  6045. while((fileName = CSVreader.readLine()) != null)
  6046. {
  6047. String[] result = fileName.split(",");
  6048.  
  6049. for (int i = 0 ; i < result.length ; i++)
  6050. {
  6051. if (FilterWord.contains(result[i]))
  6052. {
  6053. return true;
  6054. }
  6055. }
  6056. }
  6057.  
  6058. return false;
  6059. }
  6060.  
  6061. catch (Exception ex)
  6062. {
  6063. LogError(ex);
  6064. }
  6065.  
  6066. return false;
  6067. }
  6068.  
  6069. public String FirstWord(String Word)
  6070. {
  6071. String sentences[] = Word.split(" ");
  6072.  
  6073. return sentences[0];
  6074. }
  6075.  
  6076. public String ToBinary(int value)
  6077. {
  6078. String binaryResult = "";
  6079.  
  6080. if (value > 0)
  6081. {
  6082. int columnExponent = 0;
  6083.  
  6084. int remainingValue = value;
  6085.  
  6086. while (Math.pow(2,columnExponent) <= value)
  6087. {
  6088. columnExponent = columnExponent + 1;
  6089.  
  6090. }
  6091.  
  6092. String binaryResultUse = "";
  6093.  
  6094. do
  6095. {
  6096. columnExponent = columnExponent - 1;
  6097.  
  6098. int columnWeight = (int) Math.pow(2,columnExponent);
  6099.  
  6100. if (columnWeight <= remainingValue)
  6101. {
  6102. binaryResultUse = binaryResultUse + "1";
  6103.  
  6104. remainingValue = remainingValue - columnWeight;
  6105. }
  6106. else
  6107. {
  6108.  
  6109. binaryResultUse = binaryResultUse + "0";
  6110. }
  6111. }
  6112. while (columnExponent > 0);
  6113.  
  6114.  
  6115. return binaryResultUse;
  6116. }
  6117.  
  6118. binaryResult = "0";
  6119.  
  6120. return binaryResult;
  6121. }
  6122.  
  6123. public void CloseCD(String drive)
  6124. {
  6125. try
  6126. {
  6127. File file = File.createTempFile("realhowto",".vbs");
  6128.  
  6129. file.deleteOnExit();
  6130.  
  6131. FileWriter fw = new FileWriter(file);
  6132.  
  6133. String vbs = "Set wmp = CreateObject(\"WMPlayer.OCX\") \n"
  6134. + "Set cd = wmp.cdromCollection.getByDriveSpecifier(\""
  6135. + drive + "\") \n"
  6136. + "cd.Eject \n "
  6137. + "cd.Eject ";
  6138.  
  6139. fw.write(vbs);
  6140.  
  6141. fw.close();
  6142.  
  6143. Runtime.getRuntime().exec("wscript " + file.getPath()).waitFor();
  6144. }
  6145.  
  6146. catch (Exception ex)
  6147. {
  6148. LogError(ex);
  6149. }
  6150. }
  6151.  
  6152. public void OpenCD(String drive)
  6153. {
  6154. try
  6155. {
  6156. File file = File.createTempFile("realhowto",".vbs");
  6157.  
  6158. file.deleteOnExit();
  6159.  
  6160. FileWriter fw = new java.io.FileWriter(file);
  6161.  
  6162. String vbs = "Set wmp = CreateObject(\"WMPlayer.OCX\") \n"
  6163. + "Set cd = wmp.cdromCollection.getByDriveSpecifier(\""
  6164. + drive + "\") \n"
  6165. + "cd.Eject";
  6166.  
  6167. fw.write(vbs);
  6168.  
  6169. fw.close();
  6170.  
  6171. Runtime.getRuntime().exec("wscript " + file.getPath()).waitFor();
  6172. }
  6173.  
  6174. catch (Exception ex)
  6175. {
  6176. LogError(ex);
  6177. }
  6178. }
  6179.  
  6180. public void Color()
  6181. {
  6182. if (ColorFrame != null)
  6183. {
  6184. CloseAnimation(ColorFrame);
  6185.  
  6186. ColorFrame.dispose();
  6187. }
  6188.  
  6189. ColorFrame = new JFrame();
  6190.  
  6191. ColorFrame.setSize(500, 500);
  6192.  
  6193. ColorFrame.setTitle("Color Picker");
  6194.  
  6195. JPanel ParentPanel = new JPanel();
  6196.  
  6197. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  6198.  
  6199. ParentPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  6200.  
  6201. JPanel One = new JPanel();
  6202.  
  6203. JLabel Top = new JLabel("Specify the RGB value of your desired color.");
  6204.  
  6205. One.add(Top);
  6206.  
  6207. ParentPanel.add(One);
  6208.  
  6209. JPanel Two = new JPanel();
  6210.  
  6211. Two.setLayout(new BoxLayout(Two,BoxLayout.X_AXIS));
  6212.  
  6213. JLabel RedLabel = new JLabel("R value");
  6214.  
  6215. Red = new JTextField();
  6216.  
  6217. Red.addKeyListener(new java.awt.event.KeyAdapter()
  6218. {
  6219. public void keyTyped(java.awt.event.KeyEvent evt)
  6220. {
  6221. if (!Character.isDigit(evt.getKeyChar()) || Red.getText().length() > 2)
  6222. {
  6223. evt.consume();
  6224.  
  6225. beep();
  6226. }
  6227. }
  6228. });
  6229.  
  6230. Red.setBounds(63,112,348,43);
  6231.  
  6232. Red.setFont(DefaultFontSmall);
  6233.  
  6234. Two.add(RedLabel);
  6235.  
  6236. Two.add(Red);
  6237.  
  6238. ParentPanel.add(Two);
  6239.  
  6240. JPanel Three = new JPanel();
  6241.  
  6242. Three.setLayout(new BoxLayout(Three,BoxLayout.X_AXIS));
  6243.  
  6244. JLabel GreenLabel = new JLabel("G value");
  6245.  
  6246. Green = new JTextField();
  6247.  
  6248. Green.addKeyListener(new java.awt.event.KeyAdapter()
  6249. {
  6250. public void keyTyped(java.awt.event.KeyEvent evt)
  6251. {
  6252. if (!Character.isDigit(evt.getKeyChar()) || Green.getText().length() > 2)
  6253. {
  6254. evt.consume();
  6255.  
  6256. beep();
  6257. }
  6258. }
  6259. });
  6260.  
  6261. Green.setBounds(63,142,348,43);
  6262.  
  6263. Green.setFont(DefaultFontSmall);
  6264.  
  6265. Three.add(GreenLabel);
  6266.  
  6267. Three.add(Green);
  6268.  
  6269. ParentPanel.add(Three);
  6270.  
  6271. JPanel Four = new JPanel();
  6272.  
  6273. Four.setLayout(new BoxLayout(Four,BoxLayout.X_AXIS));
  6274.  
  6275. JLabel BlueLabel = new JLabel("B value");
  6276.  
  6277. Blue = new JTextField();
  6278.  
  6279. Blue.addKeyListener(new java.awt.event.KeyAdapter()
  6280. {
  6281. public void keyTyped(java.awt.event.KeyEvent evt)
  6282. {
  6283. if (!Character.isDigit(evt.getKeyChar()) || Blue.getText().length() > 2)
  6284. {
  6285. evt.consume();
  6286.  
  6287. beep();
  6288. }
  6289. }
  6290. });
  6291.  
  6292. Blue.addActionListener(new ActionListener()
  6293. {
  6294. @Override
  6295. public void actionPerformed(ActionEvent e)
  6296. {
  6297. int RedValue = Integer.parseInt(Red.getText());
  6298.  
  6299. int GreenValue = Integer.parseInt(Green.getText());
  6300.  
  6301. int BlueValue = Integer.parseInt(Blue.getText());
  6302.  
  6303. if ((RedValue > 255) || (BlueValue > 255) || (GreenValue > 255))
  6304. {
  6305. beep();
  6306. }
  6307.  
  6308. else
  6309. {
  6310. OutputArea.setForeground(new Color(RedValue,GreenValue,BlueValue));
  6311.  
  6312. InputField.setForeground(new Color(RedValue,GreenValue,BlueValue));
  6313.  
  6314. CloseAnimation(ColorFrame);
  6315.  
  6316. ColorFrame.dispose();
  6317.  
  6318. println("The color [" + RedValue + "," + GreenValue + "," + BlueValue + "] has been applied.");
  6319. }
  6320. }
  6321. });
  6322.  
  6323. Blue.setBounds(63,172,348,43);
  6324.  
  6325. Blue.setFont(DefaultFontSmall);
  6326.  
  6327. Four.add(BlueLabel);
  6328.  
  6329. Four.add(Blue);
  6330.  
  6331. ParentPanel.add(Four);
  6332.  
  6333. JPanel Five = new JPanel();
  6334.  
  6335. Five.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  6336.  
  6337. Five.setLayout(new BoxLayout(Five,BoxLayout.X_AXIS));
  6338.  
  6339. Apply = new JButton("Apply");
  6340.  
  6341. Apply.setFocusPainted(false);
  6342.  
  6343. Apply.setBackground(new Color(223,85,83));
  6344.  
  6345. Apply.setFont(ButtonFont);
  6346.  
  6347. Apply.addActionListener(this);
  6348.  
  6349. Five.add(Apply);
  6350.  
  6351. ParentPanel.add(Five);
  6352.  
  6353. ColorFrame.setResizable(false);
  6354.  
  6355. ColorFrame.add(ParentPanel);
  6356.  
  6357. ColorFrame.pack();
  6358.  
  6359. ColorFrame.setLocationRelativeTo(null);
  6360.  
  6361. ColorFrame.setVisible(true);
  6362.  
  6363. ColorFrame.setAlwaysOnTop(true);
  6364.  
  6365. ColorFrame.setAlwaysOnTop(false);
  6366.  
  6367. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\color.png");
  6368.  
  6369. ColorFrame.setIconImage(img.getImage());
  6370. }
  6371.  
  6372. @Override
  6373. public void mouseDragged(java.awt.event.MouseEvent e)
  6374. {
  6375. int x = e.getXOnScreen();
  6376.  
  6377. int y = e .getYOnScreen();
  6378.  
  6379. if (ConsoleFrame != null && ConsoleFrame.isFocused())
  6380. {
  6381. ConsoleFrame.setLocation(x - xMouse, y - yMouse);
  6382. }
  6383.  
  6384. if (LoginFrame != null && LoginFrame.isFocused())
  6385. {
  6386. LoginFrame.setLocation(x - xMouse, y - yMouse);
  6387. }
  6388.  
  6389. if (PictureFrame != null && PictureFrame.isFocused())
  6390. {
  6391. PictureFrame.setLocation(x - xMouse, y - yMouse);
  6392. }
  6393.  
  6394. if (PixelFrame != null && PixelFrame.isFocused())
  6395. {
  6396. PixelFrame.setLocation(x - xMouse, y - yMouse);
  6397. }
  6398.  
  6399. if (MusicFrame != null && MusicFrame.isFocused())
  6400. {
  6401. MusicFrame.setLocation(x - xMouse, y - yMouse);
  6402. }
  6403.  
  6404. if (MediaFrame != null && MediaFrame.isFocused())
  6405. {
  6406. MediaFrame.setLocation(x - xMouse, y - yMouse);
  6407. }
  6408.  
  6409. if (WeatherFrame != null && WeatherFrame.isFocused())
  6410. {
  6411. WeatherFrame.setLocation(x - xMouse, y - yMouse);
  6412. }
  6413.  
  6414. if (DebugFrame != null && DebugFrame.isFocused())
  6415. {
  6416. DebugFrame.setLocation(x - xMouse, y - yMouse);
  6417. }
  6418. }
  6419.  
  6420. @Override
  6421. public void mouseMoved(java.awt.event.MouseEvent e)
  6422. {
  6423. xMouse = e.getX();
  6424.  
  6425. yMouse = e.getY();
  6426.  
  6427. if (PositionMode)
  6428. {
  6429. println(xMouse + "," + yMouse);
  6430. }
  6431. }
  6432.  
  6433. public void LogToDo(String WhatToDo)
  6434. {
  6435. try
  6436. {
  6437. if (WhatToDo != null && !WhatToDo.equals("") && !Filter(WhatToDo))
  6438. {
  6439. BufferedWriter TextOut = new BufferedWriter(new FileWriter("SASIDFiles\\Text\\Add.txt", true));
  6440.  
  6441. TextOut.write("The input: " + operation);
  6442.  
  6443. TextOut.write(System.getProperty("line.separator"));
  6444.  
  6445. TextOut.write("Should: " + WhatToDo);
  6446.  
  6447. TextOut.write(System.getProperty("line.separator"));
  6448.  
  6449. TextOut.write(System.getProperty("line.separator"));
  6450.  
  6451. TextOut.flush();
  6452.  
  6453. QBox("Request completed; Nathan will consider it.");
  6454.  
  6455. TextOut.close();
  6456. }
  6457. }
  6458.  
  6459. catch (Exception ex)
  6460. {
  6461. LogError(ex);
  6462. }
  6463. }
  6464.  
  6465. public void font()
  6466. {
  6467. if (FontFrame != null)
  6468. {
  6469. CloseAnimation(FontFrame);
  6470.  
  6471. FontFrame.dispose();
  6472. }
  6473.  
  6474. FontFrame = new JFrame();
  6475.  
  6476. FontFrame.setSize(250, 270);
  6477.  
  6478. FontFrame.setTitle("Font Picker");
  6479.  
  6480. FontFrame.setResizable(false);
  6481.  
  6482. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\font.png");
  6483.  
  6484. FontFrame.setIconImage(img.getImage());
  6485.  
  6486. ParentPanel = new JPanel();
  6487.  
  6488. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  6489.  
  6490. ParentPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  6491.  
  6492. ParentPanel = new JPanel();
  6493.  
  6494. JLabel Top = new JLabel("Select your desired font");
  6495.  
  6496. ParentPanel.add(Top);
  6497.  
  6498. String[] Fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
  6499.  
  6500. FontList = new JList(Fonts);
  6501.  
  6502. FontList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  6503.  
  6504. JScrollPane FontListScroll = new JScrollPane(FontList,
  6505. JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  6506. JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  6507.  
  6508. ParentPanel.add(FontListScroll);
  6509.  
  6510. ApplyFont = new JButton("Apply");
  6511.  
  6512. ApplyFont.setFocusPainted(false);
  6513.  
  6514. ApplyFont.setBackground(RegularRed);
  6515.  
  6516. ApplyFont.addActionListener(this);
  6517.  
  6518. ParentPanel.add(ApplyFont);
  6519.  
  6520. FontFrame.add(ParentPanel);
  6521.  
  6522. FontFrame.setLocationRelativeTo(null);
  6523.  
  6524. FontFrame.setVisible(true);
  6525.  
  6526. FontFrame.setAlwaysOnTop(true);
  6527.  
  6528. FontFrame.setAlwaysOnTop(false);
  6529. }
  6530.  
  6531. public void beep()
  6532. {
  6533. Toolkit.getDefaultToolkit().beep();
  6534. }
  6535.  
  6536. public static void SBeep()
  6537. {
  6538. Toolkit.getDefaultToolkit().beep();
  6539. }
  6540.  
  6541. public boolean IsChristmas()
  6542. {
  6543. Calendar Checker = Calendar.getInstance();
  6544.  
  6545. int Month = Checker.get(Calendar.MONTH) + 1;
  6546.  
  6547. int Date = Checker.get(Calendar.DATE);
  6548.  
  6549. if (Month == 12 && Date == 25)
  6550. {
  6551. return true;
  6552. }
  6553.  
  6554. return false;
  6555. }
  6556.  
  6557. public boolean IsHalloween()
  6558. {
  6559. Calendar Checker = Calendar.getInstance();
  6560.  
  6561. int Month = Checker.get(Calendar.MONTH) + 1;
  6562.  
  6563. int Date = Checker.get(Calendar.DATE);
  6564.  
  6565. if (Month == 10 && Date == 31)
  6566. {
  6567. return true;
  6568. }
  6569.  
  6570. return false;
  6571. }
  6572.  
  6573. public boolean IsIndependenceDay()
  6574. {
  6575. Calendar Checker = Calendar.getInstance();
  6576.  
  6577. int Month = Checker.get(Calendar.MONTH) + 1;
  6578.  
  6579. int Date = Checker.get(Calendar.DATE);
  6580.  
  6581. if (Month == 7 && Date == 4)
  6582. {
  6583. return true;
  6584. }
  6585.  
  6586. return false;
  6587. }
  6588.  
  6589. public boolean IsThanksgiving()
  6590. {
  6591. Calendar Checker = Calendar.getInstance();
  6592.  
  6593. int year = Calendar.getInstance().get(Calendar.YEAR);
  6594.  
  6595. int Month = Checker.get(Calendar.MONTH) + 1;
  6596.  
  6597. int Date = Checker.get(Calendar.DATE);
  6598.  
  6599. LocalDate RealTG = LocalDate.of(year, 11, 1).with(TemporalAdjusters.dayOfWeekInMonth(4, DayOfWeek.THURSDAY));
  6600.  
  6601. if (Month == 11 && Date == RealTG.getDayOfMonth())
  6602. {
  6603. return true;
  6604. }
  6605.  
  6606. return false;
  6607. }
  6608.  
  6609. public boolean IsAprilFoolsDay()
  6610. {
  6611. Calendar Checker = Calendar.getInstance();
  6612.  
  6613. int Month = Checker.get(Calendar.MONTH) + 1;
  6614.  
  6615. int Date = Checker.get(Calendar.DATE);
  6616.  
  6617. if (Month == 4 && Date == 1)
  6618. {
  6619. return true;
  6620. }
  6621.  
  6622. return false;
  6623. }
  6624.  
  6625. public void Disco(int iterations)
  6626. {
  6627. Thread DiscoThread = new Thread()
  6628. {
  6629. public void run()
  6630. {
  6631. try
  6632. {
  6633. boolean Fixed = false;
  6634. boolean NumOn = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_NUM_LOCK);
  6635. boolean CapsOn = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
  6636. boolean ScrollOn = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_SCROLL_LOCK);
  6637.  
  6638. for (int i = 1; i < iterations ; i++)
  6639. {
  6640. Robot Rob = new Robot();
  6641.  
  6642. if (!Fixed)
  6643. {
  6644. Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_NUM_LOCK, false);
  6645. Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
  6646. Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, false);
  6647.  
  6648. Fixed = true;
  6649. }
  6650.  
  6651. Rob.keyPress(KeyEvent.VK_NUM_LOCK);
  6652. Rob.keyRelease(KeyEvent.VK_NUM_LOCK);
  6653.  
  6654. Thread.sleep(170);
  6655.  
  6656. Rob.keyPress(KeyEvent.VK_CAPS_LOCK);
  6657. Rob.keyRelease(KeyEvent.VK_CAPS_LOCK);
  6658.  
  6659. Thread.sleep(170);
  6660.  
  6661. Rob.keyPress(KeyEvent.VK_SCROLL_LOCK);
  6662. Rob.keyRelease(KeyEvent.VK_SCROLL_LOCK);
  6663.  
  6664. Thread.sleep(170);
  6665.  
  6666. Rob.keyPress(KeyEvent.VK_NUM_LOCK);
  6667. Rob.keyRelease(KeyEvent.VK_NUM_LOCK);
  6668.  
  6669. Thread.sleep(170);
  6670.  
  6671. Rob.keyPress(KeyEvent.VK_CAPS_LOCK);
  6672. Rob.keyRelease(KeyEvent.VK_CAPS_LOCK);
  6673.  
  6674. Thread.sleep(170);
  6675.  
  6676. Rob.keyPress(KeyEvent.VK_SCROLL_LOCK);
  6677. Rob.keyRelease(KeyEvent.VK_SCROLL_LOCK);
  6678.  
  6679. Thread.sleep(170);
  6680. }
  6681.  
  6682. Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_NUM_LOCK, NumOn);
  6683.  
  6684. Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, CapsOn);
  6685.  
  6686. Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, ScrollOn);
  6687. }
  6688.  
  6689. catch (Exception ex)
  6690. {
  6691. LogError(ex);
  6692. }
  6693. }
  6694. };
  6695.  
  6696. DiscoThread.start();
  6697. }
  6698.  
  6699. public void MathShell(String op)
  6700. {
  6701. if (!OneMathPrint)
  6702. {
  6703. println("Enter a math function in the following format:");
  6704. println("<operation>(<parameter1>,<parameter2>) (parameter2 is optional)");
  6705. println("Type \"quit\" to exit the math shell.");
  6706.  
  6707. OneMathPrint = true;
  6708. }
  6709.  
  6710. if (op.equalsIgnoreCase("quit"))
  6711. {
  6712. CLC();
  6713.  
  6714. OneMathPrint = false;
  6715.  
  6716. MathShellMode = false;
  6717. }
  6718.  
  6719. else if (op.equalsIgnoreCase("clc"))
  6720. {
  6721. CLC();
  6722. }
  6723.  
  6724. else
  6725. {
  6726. int firstParen = op.indexOf("(");
  6727. int comma = op.indexOf(",");
  6728. int lastParen = op.indexOf(")");
  6729.  
  6730. String operation = "";
  6731. double param1 = 0.0;
  6732. double param2 = 0.0;
  6733.  
  6734. try
  6735. {
  6736. if (firstParen != -1)
  6737. {
  6738. operation = op.substring(0,firstParen);
  6739.  
  6740. if (comma != -1)
  6741. {
  6742. param1 = Double.parseDouble(op.substring(firstParen+1,comma));
  6743.  
  6744. if (lastParen != -1)
  6745. {
  6746. param2 = Double.parseDouble(op.substring(comma+1,lastParen));
  6747. }
  6748. }
  6749.  
  6750. else if (lastParen != -1)
  6751. {
  6752. param1 = Double.parseDouble(op.substring(firstParen+1,lastParen));
  6753. }
  6754.  
  6755. Math(operation,param1,param2);
  6756. }
  6757.  
  6758. else
  6759. {
  6760. Math("help",0,0);
  6761. }
  6762. }
  6763.  
  6764. catch(Exception e)
  6765. {
  6766. LogError(e);
  6767. }
  6768.  
  6769. }
  6770. }
  6771.  
  6772. public void Math(String operation, double param1, double param2)
  6773. {
  6774.  
  6775. if (operation.equalsIgnoreCase("abs"))
  6776. {
  6777. println(Math.abs(param1));
  6778. }
  6779.  
  6780. else if (operation.equalsIgnoreCase("ceil"))
  6781. {
  6782. println(Math.ceil(param1));
  6783. }
  6784.  
  6785. else if (operation.equalsIgnoreCase("floor"))
  6786. {
  6787. println(Math.floor(param1));
  6788. }
  6789.  
  6790. else if (operation.equalsIgnoreCase("log"))
  6791. {
  6792. println(Math.log(param1));
  6793. }
  6794.  
  6795. else if (operation.equalsIgnoreCase("log10"))
  6796. {
  6797. println(Math.log10(param1));
  6798. }
  6799.  
  6800. else if (operation.equalsIgnoreCase("max"))
  6801. {
  6802. println(Math.max(param1,param2));
  6803. }
  6804.  
  6805. else if (operation.equalsIgnoreCase("min"))
  6806. {
  6807. println(Math.min(param1,param2));
  6808. }
  6809.  
  6810. else if (operation.equalsIgnoreCase("pow"))
  6811. {
  6812. println(Math.pow(param1,param2));
  6813. }
  6814.  
  6815. else if (operation.equalsIgnoreCase("round"))
  6816. {
  6817. println(Math.round(param1));
  6818. }
  6819.  
  6820. else if (operation.equalsIgnoreCase("sqrt"))
  6821. {
  6822. println(Math.sqrt(param1));
  6823. }
  6824.  
  6825. else if (operation.equalsIgnoreCase("convert2"))
  6826. {
  6827. println(ToBinary((int)(param1)));
  6828. }
  6829.  
  6830. else if (operation.toLowerCase().contains("help"))
  6831. {
  6832. println("\nValid expressions:\nabs(arg), ceil(arg), floor(arg), log(arg, arg2), log10(arg),"
  6833. + " max(arg, arg2), min(arg, arg2), pow(arg, arg2), round(arg), sqrt(arg), convert2(arg)");
  6834. }
  6835. }
  6836.  
  6837. public void exit()
  6838. {
  6839. SaveFontColor();
  6840.  
  6841. CloseAnimation(ConsoleFrame);
  6842.  
  6843. if (HideOnClose.getState() == true)
  6844. {
  6845. ConsoleFrame.setVisible(false);
  6846. }
  6847.  
  6848. else
  6849. {
  6850. System.exit(0);
  6851. }
  6852. }
  6853.  
  6854. public static void SExit()
  6855. {
  6856. System.exit(0);
  6857. }
  6858.  
  6859. Runnable CloseRunable = new Runnable()
  6860. {
  6861. @Override
  6862. public void run()
  6863. {
  6864. CloseAnimation(ConsoleFrame);
  6865.  
  6866. ConsoleFrame.dispose();
  6867.  
  6868. exit();
  6869. }
  6870. };
  6871.  
  6872. public void CloseAtHourMinute(int Hour, int Minute)
  6873. {
  6874. Calendar CloseCalendar = Calendar.getInstance();
  6875.  
  6876. CloseCalendar.add(Calendar.DAY_OF_MONTH, 0);
  6877.  
  6878. CloseCalendar.set(Calendar.HOUR_OF_DAY, Hour);
  6879.  
  6880. CloseCalendar.set(Calendar.MINUTE, Minute);
  6881.  
  6882. CloseCalendar.set(Calendar.SECOND, 0);
  6883.  
  6884. CloseCalendar.set(Calendar.MILLISECOND, 0);
  6885.  
  6886. long HowMany = (CloseCalendar.getTimeInMillis() - System.currentTimeMillis());
  6887.  
  6888. ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
  6889.  
  6890. scheduler.schedule(CloseRunable ,HowMany, TimeUnit.MILLISECONDS);
  6891. }
  6892.  
  6893. public void GetName()
  6894. {
  6895. CUsername = System.getProperty("user.name");
  6896.  
  6897. OS = System.getProperty("os.name");
  6898. }
  6899.  
  6900. public void ShowProperties()
  6901. {
  6902. PropertiesList = new ArrayList<String>();
  6903.  
  6904. Properties Props = System.getProperties();
  6905.  
  6906. Enumeration<?> keys = Props.keys();
  6907.  
  6908. while (keys.hasMoreElements())
  6909. {
  6910. String key = (String) keys.nextElement();
  6911.  
  6912. String value = (String) Props.get(key);
  6913.  
  6914. PropertiesList.add(key + ": " + value);
  6915. }
  6916.  
  6917. File file = null;
  6918.  
  6919. BufferedWriter fw = null;
  6920.  
  6921. try
  6922. {
  6923. file = File.createTempFile("Properties",".txt");
  6924.  
  6925. file.deleteOnExit();
  6926.  
  6927. fw = new BufferedWriter(new FileWriter(file));
  6928.  
  6929. for (int i = 1 ; i < PropertiesList.size() ; i++)
  6930. {
  6931. String Line = PropertiesList.get(i);
  6932.  
  6933. fw.write(Line);
  6934.  
  6935. fw.write(System.getProperty("line.separator"));
  6936. }
  6937.  
  6938. fw.close();
  6939.  
  6940. Desktop.getDesktop().open(file);
  6941. }
  6942.  
  6943. catch (Exception ex)
  6944. {
  6945. LogError(ex);
  6946. }
  6947. }
  6948.  
  6949. public void Preferences()
  6950. {
  6951. if (PreferencesFrame != null)
  6952. {
  6953. CloseAnimation(PreferencesFrame);
  6954.  
  6955. PreferencesFrame.dispose();
  6956. }
  6957.  
  6958. PreferencesFrame = new JFrame();
  6959.  
  6960. PreferencesFrame.setTitle("Preferences");
  6961.  
  6962. PreferencesFrame.setResizable(false);
  6963.  
  6964. PreferencesFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  6965.  
  6966. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\preferences.png");
  6967.  
  6968. PreferencesFrame.setIconImage(img.getImage());
  6969.  
  6970. ParentPanel = new JPanel();
  6971.  
  6972. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  6973.  
  6974. ParentPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  6975.  
  6976. JPanel TopPanel = new JPanel();
  6977.  
  6978. TopPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  6979.  
  6980. JLabel Top = new JLabel("Intro Music");
  6981.  
  6982. TopPanel.add(Top);
  6983.  
  6984. ParentPanel.add(TopPanel);
  6985.  
  6986. JPanel MusicPanel = new JPanel();
  6987.  
  6988. MusicPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  6989.  
  6990. MusicOnStart = new JCheckBox("");
  6991.  
  6992. if (GetPreference("PlayMusic") == 0)
  6993. {
  6994. MusicOnStart.setSelected(false);
  6995. }
  6996.  
  6997. else if (GetPreference("PlayMusic") == 1)
  6998. {
  6999. MusicOnStart.setSelected(true);
  7000. }
  7001.  
  7002. MusicOnStart.setFocusPainted(false);
  7003.  
  7004. MusicPanel.add(MusicOnStart);
  7005.  
  7006. ParentPanel.add(MusicPanel);
  7007.  
  7008. JPanel SystemPropertiesLabelPanel = new JPanel();
  7009.  
  7010. SystemPropertiesLabelPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  7011.  
  7012. JLabel SystemPropertiesLabel = new JLabel("Dump System Props On Start");
  7013.  
  7014. SystemPropertiesLabelPanel.add(SystemPropertiesLabel);
  7015.  
  7016. ParentPanel.add(SystemPropertiesLabelPanel);
  7017.  
  7018. JPanel SPOSPanel= new JPanel();
  7019.  
  7020. SPOSPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  7021.  
  7022. SPOS = new JCheckBox("");
  7023.  
  7024. if (GetPreference("SystemPropertiesOnStart") == 0)
  7025. {
  7026. SPOS.setSelected(false);
  7027. }
  7028.  
  7029. else if (GetPreference("SystemPropertiesOnStart") == 1)
  7030. {
  7031. SPOS.setSelected(true);
  7032. }
  7033.  
  7034. SPOS.setFocusPainted(false);
  7035.  
  7036. SPOSPanel.add(SPOS);
  7037.  
  7038. ParentPanel.add(SPOSPanel);
  7039.  
  7040. JPanel BottomPanel = new JPanel();
  7041.  
  7042. ApplyPreferences = new JButton("Apply");
  7043.  
  7044. ApplyPreferences.addActionListener(this);
  7045.  
  7046. ApplyPreferences.setBackground(RegularRed);
  7047.  
  7048. ApplyPreferences.setFocusPainted(false);
  7049.  
  7050. BottomPanel.add(ApplyPreferences);
  7051.  
  7052. ParentPanel.add(BottomPanel);
  7053.  
  7054. PreferencesFrame.add(ParentPanel);
  7055.  
  7056. PreferencesFrame.pack();
  7057.  
  7058. PreferencesFrame.setLocationRelativeTo(null);
  7059.  
  7060. PreferencesFrame.setVisible(true);
  7061.  
  7062. PreferencesFrame.setAlwaysOnTop(true);
  7063.  
  7064. PreferencesFrame.setAlwaysOnTop(false);
  7065. }
  7066.  
  7067. public int GetPreference(String Preference)
  7068. {
  7069. ReadPreferences();
  7070.  
  7071. for (int i = 0 ; i < PreferencesList.size() ; i++)
  7072. {
  7073. if (PreferencesList.get(i).Name.equalsIgnoreCase(Preference))
  7074. {
  7075. return Integer.parseInt(PreferencesList.get(i).Binary);
  7076. }
  7077. }
  7078.  
  7079. return 0;
  7080. }
  7081.  
  7082. public void ReadPreferences()
  7083. {
  7084. String[] Parts;
  7085.  
  7086. try
  7087. {
  7088. PreferencesList.clear();
  7089.  
  7090. CSVreader = new BufferedReader(new FileReader("JesseUsers\\" + Username + "\\Preferences.csv"));
  7091.  
  7092. String Line;
  7093.  
  7094. Line = CSVreader.readLine();
  7095.  
  7096. while(Line != null)
  7097. {
  7098. Parts = Line.split(",");
  7099.  
  7100. if (Parts.length >= 1)
  7101. {
  7102. PreferencesList.add(new Preference(Parts[0],Parts[1]));
  7103. }
  7104.  
  7105. Line = CSVreader.readLine();
  7106. }
  7107.  
  7108. CSVreader.close();
  7109. }
  7110.  
  7111. catch(Exception e)
  7112. {
  7113. LogError(e);
  7114. }
  7115. }
  7116.  
  7117. public void WritePreferences(String Name, String ChangeBinary)
  7118. {
  7119. ReadPreferences();
  7120.  
  7121. try
  7122. {
  7123. CSVwriter = new BufferedWriter(new FileWriter("JesseUsers\\" + Username + "\\Preferences.csv"));
  7124.  
  7125. for (int i = 0 ; i < PreferencesList.size() ; i++)
  7126. {
  7127. if (PreferencesList.get(i).Name.equalsIgnoreCase(Name))
  7128. {
  7129. PreferencesList.get(i).Binary = ChangeBinary;
  7130. }
  7131.  
  7132. CSVwriter.write(PreferencesList.get(i).Name + "," + PreferencesList.get(i).Binary);
  7133.  
  7134. CSVwriter.write("\r\n");
  7135.  
  7136. CSVwriter.flush();
  7137. }
  7138.  
  7139. CSVwriter.close();
  7140. }
  7141.  
  7142. catch (Exception e)
  7143. {
  7144. LogError(e);
  7145. }
  7146. }
  7147.  
  7148. public void GetBackgroundSize()
  7149. {
  7150. ImageIcon Size = new ImageIcon(GetCurrentBackground().toString());
  7151.  
  7152. BackGroundX = Size.getIconWidth();
  7153.  
  7154. BackGroundY = Size.getIconHeight();
  7155. }
  7156.  
  7157. public File GetCurrentBackground()
  7158. {
  7159. return ValidBackgroundPaths[CurrentBackgroundIndex];
  7160. }
  7161.  
  7162. public File[] GetBackgrounds()
  7163. {
  7164. File dir = new File("JesseUsers\\" + Username + "\\Backgrounds");
  7165.  
  7166. FilenameFilter PNGFilter = new FilenameFilter()
  7167. {
  7168. public boolean accept(File dir, String filename)
  7169. {
  7170. return filename.endsWith(".png");
  7171. }
  7172. };
  7173.  
  7174. ValidBackgroundPaths = dir.listFiles(PNGFilter);
  7175.  
  7176. return dir.listFiles(PNGFilter);
  7177. }
  7178.  
  7179. public void GetScreenSize()
  7180. {
  7181. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  7182.  
  7183. ScreenX = (int) screenSize.getWidth();
  7184.  
  7185. ScreenY = (int) screenSize.getHeight();
  7186. }
  7187.  
  7188. public void InternetConnect(String URL)
  7189. {
  7190. Desktop Internet = Desktop.getDesktop();
  7191.  
  7192. try
  7193. {
  7194. Internet.browse(new URI(URL));
  7195. }
  7196.  
  7197. catch (Exception ex)
  7198. {
  7199. LogError(ex);
  7200. }
  7201. }
  7202.  
  7203. public void InternetConnect(URI URI)
  7204. {
  7205. Desktop Internet = Desktop.getDesktop();
  7206.  
  7207. try
  7208. {
  7209. Internet.browse(URI);
  7210. }
  7211.  
  7212. catch (Exception ex)
  7213. {
  7214. LogError(ex);
  7215. }
  7216. }
  7217.  
  7218. public void OpenFile(String FilePath)
  7219. {
  7220. Desktop OpenFile = Desktop.getDesktop();
  7221.  
  7222. try
  7223. {
  7224. File FileToOpen = new File(FilePath);
  7225.  
  7226. URI FileURI = FileToOpen.toURI();
  7227.  
  7228. OpenFile.browse(FileURI);
  7229. }
  7230.  
  7231. catch (Exception e)
  7232. {
  7233. try
  7234. {
  7235. QBox("I wasn't sure how to open that so here it is in your file explorer.");
  7236.  
  7237. Runtime.getRuntime().exec("explorer.exe /select," + FilePath);
  7238. }
  7239.  
  7240. catch(Exception ex)
  7241. {
  7242. LogError(ex);
  7243. }
  7244. }
  7245. }
  7246.  
  7247. public boolean ShouldISwitch()
  7248. {
  7249. try
  7250. {
  7251. if (ValidBackgroundPaths.length > CurrentBackgroundIndex + 1 && ValidBackgroundPaths.length > 1)
  7252. {
  7253. return true;
  7254. }
  7255. }
  7256.  
  7257. catch (Exception e)
  7258. {
  7259. return false;
  7260. }
  7261.  
  7262. return false;
  7263. }
  7264.  
  7265. public void CreateHash()
  7266. {
  7267. if (HashFrame != null)
  7268. {
  7269. CloseAnimation(HashFrame);
  7270.  
  7271. HashFrame.dispose();
  7272. }
  7273.  
  7274. HashFrame = new JFrame();
  7275.  
  7276. HashFrame.setResizable(false);
  7277.  
  7278. HashFrame.setTitle("Hasher");
  7279.  
  7280. HashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  7281.  
  7282. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\hash.png");
  7283.  
  7284. HashFrame.setIconImage(img.getImage());
  7285.  
  7286. ParentPanel = new JPanel();
  7287.  
  7288. ParentPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
  7289.  
  7290. ParentPanel.setLayout(new BoxLayout(ParentPanel, BoxLayout.Y_AXIS));
  7291.  
  7292. JPanel InstPanel = new JPanel();
  7293.  
  7294. InstPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  7295.  
  7296. JLabel Instructions = new JLabel("Enter your password to be hashed");
  7297.  
  7298. InstPanel.add(Instructions);
  7299.  
  7300. ParentPanel.add(InstPanel);
  7301.  
  7302. HashField = new JPasswordField(20);
  7303.  
  7304. HashField.setFont(DefaultFontSmall);
  7305.  
  7306. HashField.addActionListener(new ActionListener()
  7307. {
  7308. @Override
  7309. public void actionPerformed(ActionEvent e)
  7310. {
  7311. String Hash = new String(HashField.getPassword());
  7312.  
  7313. if (Hash.length() > 0)
  7314. {
  7315. String PrintHash = Hash(new String(HashField.getPassword()));
  7316.  
  7317. CloseAnimation(HashFrame);
  7318.  
  7319. HashFrame.dispose();
  7320.  
  7321. QBox("Your hashed password is: " + PrintHash + "\nIt has also been copied to your clipboard.");
  7322.  
  7323. StringSelection selection = new StringSelection(PrintHash);
  7324.  
  7325. java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  7326.  
  7327. clipboard.setContents(selection, selection);
  7328. }
  7329. }
  7330. });
  7331.  
  7332. JPanel FieldPanel = new JPanel();
  7333.  
  7334. FieldPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  7335.  
  7336. FieldPanel.add(HashField);
  7337.  
  7338. ParentPanel.add(FieldPanel);
  7339.  
  7340. JPanel ButtonPanel = new JPanel();
  7341.  
  7342. ButtonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  7343.  
  7344. HashButton = new JButton("Hash Password");
  7345.  
  7346. HashButton.addActionListener(this);
  7347.  
  7348. HashButton.setFocusPainted(false);
  7349.  
  7350. HashButton.setBackground(RegularRed);
  7351.  
  7352. ButtonPanel.add(HashButton);
  7353.  
  7354. ParentPanel.add(ButtonPanel);
  7355.  
  7356. HashFrame.add(ParentPanel);
  7357.  
  7358. HashFrame.pack();
  7359.  
  7360. HashFrame.setLocationRelativeTo(null);
  7361.  
  7362. HashFrame.setVisible(true);
  7363.  
  7364. HashFrame.setAlwaysOnTop(true);
  7365. }
  7366.  
  7367. public void DirectorySearch()
  7368. {
  7369. WindowsFeel(ConsoleFrame);
  7370.  
  7371. File OpenFile = GetFile("");
  7372.  
  7373. SwingFeel(ConsoleFrame);
  7374.  
  7375. if (OpenFile != null)
  7376. {
  7377. OpenFile(OpenFile.toString());
  7378. }
  7379. }
  7380.  
  7381. public void SwitchBackground()
  7382. {
  7383. CurrentBackgroundIndex++;
  7384.  
  7385. GetBackgroundSize();
  7386.  
  7387. ImageIcon NewIcon = null;
  7388.  
  7389. NewIcon = new ImageIcon(ValidBackgroundPaths[CurrentBackgroundIndex].toString());
  7390.  
  7391. ConsoleFrame.setBounds(0, 0, BackGroundX, BackGroundY);
  7392.  
  7393. ParentPanel.setBounds(0, 0, BackGroundX, BackGroundY);
  7394.  
  7395. ParentLabel.setBounds(0, 0, BackGroundX, BackGroundY);
  7396.  
  7397. ParentLabel.setIcon(NewIcon);
  7398.  
  7399. ParentLabel.setToolTipText(ValidBackgroundPaths[CurrentBackgroundIndex].getName().replace(".png", ""));
  7400.  
  7401. OutputArea.setBounds(0, 0, BackGroundX - 20, BackGroundY - 204);
  7402.  
  7403. OutputScroll.setBounds(10, 62, BackGroundX - 20, BackGroundY - 204);
  7404.  
  7405. InputField.setBounds(10, 82 + OutputArea.getHeight(), BackGroundX - 20, BackGroundY - (OutputArea.getHeight() + 62 + 40));
  7406.  
  7407. ConsoleDragLabel.setBounds(0,0,BackGroundX,30);
  7408.  
  7409. minimize.setBounds(BackGroundX - 81, 4, 22, 20);
  7410.  
  7411. ChangeSize.setBounds(BackGroundX - 54, 4, 22, 20);
  7412.  
  7413. close.setBounds(BackGroundX - 27, 4, 22, 20);
  7414.  
  7415. ConsoleFrame.repaint();
  7416.  
  7417. ConsoleFrame.setLocationRelativeTo(null);
  7418.  
  7419. ConsoleFrame.setVisible(true);
  7420.  
  7421. ConsoleFrame.requestFocus();
  7422.  
  7423. InputField.requestFocus();
  7424. }
  7425.  
  7426. public void here()
  7427. {
  7428. QBox("Here");
  7429. }
  7430.  
  7431. public void Calculator()
  7432. {
  7433. if (CalculatorFrame != null)
  7434. {
  7435. CloseAnimation(CalculatorFrame);
  7436.  
  7437. CalculatorFrame.dispose();
  7438. }
  7439.  
  7440. CalculatorFrame = new JFrame();
  7441.  
  7442. CalculatorFrame.setResizable(false);
  7443.  
  7444. CalculatorFrame.setTitle("Calculator");
  7445.  
  7446. CalculatorFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  7447.  
  7448. CalculatorFrame.setResizable(false);
  7449.  
  7450. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\Calculator.png");
  7451.  
  7452. CalculatorFrame.setIconImage(img.getImage());
  7453.  
  7454. ParentPanel = new JPanel();
  7455.  
  7456. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  7457.  
  7458. CalculatorField = new JTextField(20);
  7459.  
  7460. CalculatorField.setText("");
  7461.  
  7462. CalculatorField.addActionListener(this);
  7463.  
  7464. CalculatorField.setEditable(false);
  7465.  
  7466. CalculatorField.setFont(ButtonFont);
  7467.  
  7468. ParentPanel.add(CalculatorField);
  7469.  
  7470. GridLayout ButtonLayout = new GridLayout(5,4,5,5);
  7471.  
  7472. JPanel CalcButtonPanel = new JPanel();
  7473.  
  7474. CalcButtonPanel.setLayout(ButtonLayout);
  7475.  
  7476. CalculatorAdd = new JButton("+");
  7477.  
  7478. CalcButtonPanel.add(CalculatorAdd);
  7479.  
  7480. CalculatorAdd.setFocusPainted(false);
  7481.  
  7482. CalculatorAdd.setBackground(CalculatorOrange);
  7483.  
  7484. CalculatorAdd.setFont(ButtonFont);
  7485.  
  7486. CalculatorAdd.addActionListener(this);
  7487.  
  7488. CalculatorSubtract = new JButton("-");
  7489.  
  7490. CalcButtonPanel.add(CalculatorSubtract);
  7491.  
  7492. CalculatorSubtract.setFocusPainted(false);
  7493.  
  7494. CalculatorSubtract.setBackground(CalculatorOrange);
  7495.  
  7496. CalculatorSubtract.setFont(ButtonFont);
  7497.  
  7498. CalculatorSubtract.addActionListener(this);
  7499.  
  7500. CalculatorMultiply = new JButton("*");
  7501.  
  7502. CalcButtonPanel.add(CalculatorMultiply);
  7503.  
  7504. CalculatorMultiply.setFocusPainted(false);
  7505.  
  7506. CalculatorMultiply.setBackground(CalculatorOrange);
  7507.  
  7508. CalculatorMultiply.setFont(ButtonFont);
  7509.  
  7510. CalculatorMultiply.addActionListener(this);
  7511.  
  7512. CalculatorDivide = new JButton("/");
  7513.  
  7514. CalcButtonPanel.add(CalculatorDivide);
  7515.  
  7516. CalculatorDivide.setFocusPainted(false);
  7517.  
  7518. CalculatorDivide.setBackground(CalculatorOrange);
  7519.  
  7520. CalculatorDivide.setFont(ButtonFont);
  7521.  
  7522. CalculatorDivide.addActionListener(this);
  7523.  
  7524. CalculatorSeven = new JButton("7");
  7525.  
  7526. CalcButtonPanel.add(CalculatorSeven);
  7527.  
  7528. CalculatorSeven.setFocusPainted(false);
  7529.  
  7530. CalculatorSeven.setBackground(CalculatorOrange);
  7531.  
  7532. CalculatorSeven.setFont(ButtonFont);
  7533.  
  7534. CalculatorSeven.addActionListener(this);
  7535.  
  7536. CalculatorEight = new JButton("8");
  7537.  
  7538. CalcButtonPanel.add(CalculatorEight);
  7539.  
  7540. CalculatorEight.setFocusPainted(false);
  7541.  
  7542. CalculatorEight.setBackground(CalculatorOrange);
  7543.  
  7544. CalculatorEight.setFont(ButtonFont);
  7545.  
  7546. CalculatorEight.addActionListener(this);
  7547.  
  7548. CalculatorNine = new JButton("9");
  7549.  
  7550. CalcButtonPanel.add(CalculatorNine);
  7551.  
  7552. CalculatorNine.setFocusPainted(false);
  7553.  
  7554. CalculatorNine.setBackground(CalculatorOrange);
  7555.  
  7556. CalculatorNine.setFont(ButtonFont);
  7557.  
  7558. CalculatorNine.addActionListener(this);
  7559.  
  7560. CalculatorEquals = new JButton("=");
  7561.  
  7562. CalcButtonPanel.add(CalculatorEquals);
  7563.  
  7564. CalculatorEquals.setFocusPainted(false);
  7565.  
  7566. CalculatorEquals.setBackground(CalculatorOrange);
  7567.  
  7568. CalculatorEquals.setFont(ButtonFont);
  7569.  
  7570. CalculatorEquals.addActionListener(this);
  7571.  
  7572. CalculatorFour = new JButton("4");
  7573.  
  7574. CalcButtonPanel.add(CalculatorFour);
  7575.  
  7576. CalculatorFour.setFocusPainted(false);
  7577.  
  7578. CalculatorFour.setBackground(CalculatorOrange);
  7579.  
  7580. CalculatorFour.setFont(ButtonFont);
  7581.  
  7582. CalculatorFour.addActionListener(this);
  7583.  
  7584. CalculatorFive = new JButton("5");
  7585.  
  7586. CalcButtonPanel.add(CalculatorFive);
  7587.  
  7588. CalculatorFive.setFocusPainted(false);
  7589.  
  7590. CalculatorFive.setBackground(CalculatorOrange);
  7591.  
  7592. CalculatorFive.setFont(ButtonFont);
  7593.  
  7594. CalculatorFive.addActionListener(this);
  7595.  
  7596. CalculatorSix = new JButton("6");
  7597.  
  7598. CalcButtonPanel.add(CalculatorSix);
  7599.  
  7600. CalculatorSix.setFocusPainted(false);
  7601.  
  7602. CalculatorSix.setBackground(CalculatorOrange);
  7603.  
  7604. CalculatorSix.setFont(ButtonFont);
  7605.  
  7606. CalculatorSix.addActionListener(this);
  7607.  
  7608. CalculatorClear = new JButton("CE");
  7609.  
  7610. CalcButtonPanel.add(CalculatorClear);
  7611.  
  7612. CalculatorClear.setFocusPainted(false);
  7613.  
  7614. CalculatorClear.setBackground(CalculatorOrange);
  7615.  
  7616. CalculatorClear.setFont(ButtonFont);
  7617.  
  7618. CalculatorClear.addActionListener(this);
  7619.  
  7620. CalculatorOne = new JButton("1");
  7621.  
  7622. CalcButtonPanel.add(CalculatorOne);
  7623.  
  7624. CalculatorOne.setFocusPainted(false);
  7625.  
  7626. CalculatorOne.setBackground(CalculatorOrange);
  7627.  
  7628. CalculatorOne.setFont(ButtonFont);
  7629.  
  7630. CalculatorOne.addActionListener(this);
  7631.  
  7632. CalculatorTwo = new JButton("2");
  7633.  
  7634. CalcButtonPanel.add(CalculatorTwo);
  7635.  
  7636. CalculatorTwo.setFocusPainted(false);
  7637.  
  7638. CalculatorTwo.setBackground(CalculatorOrange);
  7639.  
  7640. CalculatorTwo.setFont(ButtonFont);
  7641.  
  7642. CalculatorTwo.addActionListener(this);
  7643.  
  7644. CalculatorThree = new JButton("3");
  7645.  
  7646. CalcButtonPanel.add(CalculatorThree);
  7647.  
  7648. CalculatorThree.setFocusPainted(false);
  7649.  
  7650. CalculatorThree.setBackground(CalculatorOrange);
  7651.  
  7652. CalculatorThree.setFont(ButtonFont);
  7653.  
  7654. CalculatorThree.addActionListener(this);
  7655.  
  7656. CalculatorPercent = new JButton("%");
  7657.  
  7658. CalcButtonPanel.add(CalculatorPercent);
  7659.  
  7660. CalculatorPercent.setFocusPainted(false);
  7661.  
  7662. CalculatorPercent.setBackground(CalculatorOrange);
  7663.  
  7664. CalculatorPercent.setFont(ButtonFont);
  7665.  
  7666. CalculatorPercent.addActionListener(this);
  7667.  
  7668. CalculatorZero = new JButton("0");
  7669.  
  7670. CalcButtonPanel.add(CalculatorZero);
  7671.  
  7672. CalculatorZero.setFocusPainted(false);
  7673.  
  7674. CalculatorZero.setBackground(CalculatorOrange);
  7675.  
  7676. CalculatorZero.setFont(ButtonFont);
  7677.  
  7678. CalculatorZero.addActionListener(this);
  7679.  
  7680. CalculatorDecimal = new JButton(".");
  7681.  
  7682. CalcButtonPanel.add(CalculatorDecimal);
  7683.  
  7684. CalculatorDecimal.setFocusPainted(false);
  7685.  
  7686. CalculatorDecimal.setBackground(CalculatorOrange);
  7687.  
  7688. CalculatorDecimal.setFont(ButtonFont);
  7689.  
  7690. CalculatorDecimal.addActionListener(this);
  7691.  
  7692. CalculatorOpenP = new JButton("(");
  7693.  
  7694. CalcButtonPanel.add(CalculatorOpenP);
  7695.  
  7696. CalculatorOpenP.setFocusPainted(false);
  7697.  
  7698. CalculatorOpenP.setBackground(CalculatorOrange);
  7699.  
  7700. CalculatorOpenP.setFont(ButtonFont);
  7701.  
  7702. CalculatorOpenP.addActionListener(this);
  7703.  
  7704. CalculatorCloseP = new JButton(")");
  7705.  
  7706. CalcButtonPanel.add(CalculatorCloseP);
  7707.  
  7708. CalculatorCloseP.setFocusPainted(false);
  7709.  
  7710. CalculatorCloseP.setBackground(CalculatorOrange);
  7711.  
  7712. CalculatorCloseP.setFont(ButtonFont);
  7713.  
  7714. CalculatorCloseP.addActionListener(this);
  7715.  
  7716. ParentPanel.add(CalcButtonPanel);
  7717.  
  7718. CalculatorFrame.add(ParentPanel);
  7719.  
  7720. CalculatorFrame.pack();
  7721.  
  7722. CalculatorFrame.setLocationRelativeTo(null);
  7723.  
  7724. CalculatorFrame.setVisible(true);
  7725.  
  7726. CalculatorFrame.setAlwaysOnTop(true);
  7727.  
  7728. CalculatorFrame.setAlwaysOnTop(false);
  7729.  
  7730. CalculatorFrame.requestFocus();
  7731. }
  7732.  
  7733. public void TicTacToe()
  7734. {
  7735. if (TTTFrame != null)
  7736. {
  7737. CloseAnimation(TTTFrame);
  7738.  
  7739. TTTFrame.dispose();
  7740. }
  7741.  
  7742. TTTFrame = new JFrame();
  7743.  
  7744. TTTFrame.setTitle("Tic Tac Toe");
  7745.  
  7746. TTTFrame.setResizable(false);
  7747.  
  7748. TTTFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  7749.  
  7750. TTTFrame.setResizable(false);
  7751.  
  7752. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\ttt.png");
  7753.  
  7754. TTTFrame.setIconImage(img.getImage());
  7755.  
  7756. ParentPanel = new JPanel();
  7757.  
  7758. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  7759.  
  7760. JPanel LabelPanel = new JPanel();
  7761.  
  7762. LabelPanel.setLayout(new BorderLayout());
  7763.  
  7764. TTTLabel = new JLabel();
  7765.  
  7766. LabelPanel.add(TTTLabel, SwingConstants.CENTER);
  7767.  
  7768. LabelPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  7769.  
  7770. ParentPanel.add(LabelPanel,SwingConstants.CENTER);
  7771.  
  7772. JPanel ButtonPanel = new JPanel();
  7773.  
  7774. GridLayout ButtonLayout = new GridLayout(3,3,5,5);
  7775.  
  7776. ButtonPanel.setLayout(ButtonLayout);
  7777.  
  7778. TTT1 = new JButton("");
  7779.  
  7780. TTT1.setPreferredSize(new Dimension(60, 60));
  7781.  
  7782. TTT1.setFocusPainted(false);
  7783.  
  7784. TTT1.setBackground(Vanila);
  7785.  
  7786. TTT1.setFont(ButtonFont);
  7787.  
  7788. TTT1.addActionListener(this);
  7789.  
  7790. ButtonPanel.add(TTT1);
  7791.  
  7792. TTT2 = new JButton("");
  7793.  
  7794. TTT2.setPreferredSize(new Dimension(60, 60));
  7795.  
  7796. TTT2.setFocusPainted(false);
  7797.  
  7798. TTT2.setBackground(Vanila);
  7799.  
  7800. TTT2.setFont(ButtonFont);
  7801.  
  7802. TTT2.addActionListener(this);
  7803.  
  7804. ButtonPanel.add(TTT2);
  7805.  
  7806. TTT3 = new JButton("");
  7807.  
  7808. TTT3.setPreferredSize(new Dimension(60, 60));
  7809.  
  7810. TTT3.setFocusPainted(false);
  7811.  
  7812. TTT3.setBackground(Vanila);
  7813.  
  7814. TTT3.setFont(ButtonFont);
  7815.  
  7816. TTT3.addActionListener(this);
  7817.  
  7818. ButtonPanel.add(TTT3);
  7819.  
  7820. TTT4 = new JButton("");
  7821.  
  7822. TTT4.setPreferredSize(new Dimension(60, 60));
  7823.  
  7824. TTT4.setFocusPainted(false);
  7825.  
  7826. TTT4.setBackground(Vanila);
  7827.  
  7828. TTT4.setFont(ButtonFont);
  7829.  
  7830. TTT4.addActionListener(this);
  7831.  
  7832. ButtonPanel.add(TTT4);
  7833.  
  7834. TTT5 = new JButton("");
  7835.  
  7836. TTT5.setPreferredSize(new Dimension(60, 60));
  7837.  
  7838. TTT5.setFocusPainted(false);
  7839.  
  7840. TTT5.setBackground(Vanila);
  7841.  
  7842. TTT5.setFont(ButtonFont);
  7843.  
  7844. TTT5.addActionListener(this);
  7845.  
  7846. ButtonPanel.add(TTT5);
  7847.  
  7848. TTT6 = new JButton("");
  7849.  
  7850. TTT6.setPreferredSize(new Dimension(60, 60));
  7851.  
  7852. TTT6.setFocusPainted(false);
  7853.  
  7854. TTT6.setBackground(Vanila);
  7855.  
  7856. TTT6.setFont(ButtonFont);
  7857.  
  7858. TTT6.addActionListener(this);
  7859.  
  7860. ButtonPanel.add(TTT6);
  7861.  
  7862. TTT7 = new JButton("");
  7863.  
  7864. TTT7.setPreferredSize(new Dimension(60, 60));
  7865.  
  7866. TTT7.setFocusPainted(false);
  7867.  
  7868. TTT7.setBackground(Vanila);
  7869.  
  7870. TTT7.setFont(ButtonFont);
  7871.  
  7872. TTT7.addActionListener(this);
  7873.  
  7874. ButtonPanel.add(TTT7);
  7875.  
  7876. TTT8 = new JButton("");
  7877.  
  7878. TTT8.setPreferredSize(new Dimension(60, 60));
  7879.  
  7880. TTT8.setFocusPainted(false);
  7881.  
  7882. TTT8.setBackground(Vanila);
  7883.  
  7884. TTT8.setFont(ButtonFont);
  7885.  
  7886. TTT8.addActionListener(this);
  7887.  
  7888. ButtonPanel.add(TTT8);
  7889.  
  7890. TTT9 = new JButton("");
  7891.  
  7892. TTT9.setPreferredSize(new Dimension(60, 60));
  7893.  
  7894. TTT9.setFocusPainted(false);
  7895.  
  7896. TTT9.setBackground(Vanila);
  7897.  
  7898. TTT9.setFont(ButtonFont);
  7899.  
  7900. TTT9.addActionListener(this);
  7901.  
  7902. ButtonPanel.add(TTT9);
  7903.  
  7904. ButtonPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  7905.  
  7906. ParentPanel.add(ButtonPanel);
  7907.  
  7908. JPanel ResetPanel = new JPanel();
  7909.  
  7910. ResetPanel.setLayout(new BorderLayout());
  7911.  
  7912. TTTReset = new JButton("Reset");
  7913.  
  7914. TTTReset.setFocusPainted(false);
  7915.  
  7916. TTTReset.setBackground(RegularRed);
  7917.  
  7918. TTTReset.setFont(ButtonFont);
  7919.  
  7920. TTTReset.addActionListener(this);
  7921.  
  7922. ResetPanel.add(TTTReset, BorderLayout.CENTER);
  7923.  
  7924. ResetPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  7925.  
  7926. ParentPanel.add(ResetPanel);
  7927.  
  7928. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  7929.  
  7930. TTTFrame.add(ParentPanel);
  7931.  
  7932. TTTFrame.pack();
  7933.  
  7934. TTTFrame.setLocationRelativeTo(null);
  7935.  
  7936. TTTFrame.setVisible(true);
  7937.  
  7938. TTTFrame.setAlwaysOnTop(true);
  7939.  
  7940. TTTFrame.setAlwaysOnTop(false);
  7941.  
  7942. TTTFrame.requestFocus();
  7943.  
  7944. CurrentPlayerTurn = PlayerX;
  7945.  
  7946. UpdatePlayerTurnLabel();
  7947. }
  7948.  
  7949. public void UpdatePlayerTurnLabel()
  7950. {
  7951. if (CurrentPlayerTurn == PlayerX)
  7952. {
  7953. TTTLabel.setText("Player Turn: X");
  7954. }
  7955.  
  7956. else
  7957. {
  7958. TTTLabel.setText("Player Turn: O");
  7959. }
  7960. }
  7961.  
  7962. public void TTTBoardReset()
  7963. {
  7964. CurrentPlayerTurn = PlayerX;
  7965.  
  7966. UpdatePlayerTurnLabel();
  7967.  
  7968. TTT1.setText("");
  7969. TTT2.setText("");
  7970. TTT3.setText("");
  7971. TTT4.setText("");
  7972. TTT5.setText("");
  7973. TTT6.setText("");
  7974. TTT7.setText("");
  7975. TTT8.setText("");
  7976. TTT9.setText("");
  7977. }
  7978.  
  7979. public void TTTCheckWin()
  7980. {
  7981. if (HasPlayerWon("X"))
  7982. {
  7983. QBox("X's have won the game! Congratulations!");
  7984.  
  7985. TTTReset.doClick();
  7986. }
  7987.  
  7988. else if (HasPlayerWon("O"))
  7989. {
  7990. QBox("O's have won the game! Congratulations!");
  7991.  
  7992. TTTReset.doClick();
  7993. }
  7994.  
  7995. else if (TTTBoardIsFull())
  7996. {
  7997. QBox("The game ended with no winners.");
  7998.  
  7999. TTTReset.doClick();
  8000. }
  8001. }
  8002.  
  8003. public boolean HasPlayerWon(String Player)
  8004. {
  8005. if (TTT1.getText().equals(Player) && TTT2.getText().equals(Player) && TTT3.getText().equals(Player))
  8006. {
  8007. return true;
  8008. }
  8009.  
  8010. if (TTT4.getText().equals(Player) && TTT5.getText().equals(Player) && TTT6.getText().equals(Player))
  8011. {
  8012. return true;
  8013. }
  8014.  
  8015. if (TTT7.getText().equals(Player) && TTT8.getText().equals(Player) && TTT9.getText().equals(Player))
  8016. {
  8017. return true;
  8018. }
  8019.  
  8020. if (TTT1.getText().equals(Player) && TTT4.getText().equals(Player) && TTT7.getText().equals(Player))
  8021. {
  8022. return true;
  8023. }
  8024.  
  8025. if (TTT2.getText().equals(Player) && TTT5.getText().equals(Player) && TTT8.getText().equals(Player))
  8026. {
  8027. return true;
  8028. }
  8029.  
  8030. if (TTT3.getText().equals(Player) && TTT6.getText().equals(Player) && TTT9.getText().equals(Player))
  8031. {
  8032. return true;
  8033. }
  8034.  
  8035. if (TTT1.getText().equals(Player) && TTT5.getText().equals(Player) && TTT9.getText().equals(Player))
  8036. {
  8037. return true;
  8038. }
  8039.  
  8040. if (TTT3.getText().equals(Player) && TTT5.getText().equals(Player) && TTT7.getText().equals(Player))
  8041. {
  8042. return true;
  8043. }
  8044.  
  8045. return false;
  8046. }
  8047.  
  8048. public boolean TTTBoardIsFull()
  8049. {
  8050. if (!TTT1.getText().isEmpty() && !TTT2.getText().isEmpty() &&
  8051. !TTT3.getText().isEmpty() && !TTT4.getText().isEmpty() &&
  8052. !TTT5.getText().isEmpty() && !TTT6.getText().isEmpty() &&
  8053. !TTT7.getText().isEmpty() && !TTT8.getText().isEmpty() && !TTT9.getText().isEmpty())
  8054. {
  8055. return true;
  8056. }
  8057.  
  8058. return false;
  8059. }
  8060.  
  8061. public void Note()
  8062. {
  8063. if (NoteFrame != null)
  8064. {
  8065. CloseAnimation(NoteFrame);
  8066.  
  8067. NoteFrame.dispose();
  8068. }
  8069.  
  8070. NoteFrame = new JFrame();
  8071.  
  8072. NoteFrame.setResizable(false);
  8073.  
  8074. NoteFrame.setTitle("Note");
  8075.  
  8076. NoteFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  8077.  
  8078. NoteFrame.setResizable(false);
  8079.  
  8080. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\note.png");
  8081.  
  8082. NoteFrame.setIconImage(img.getImage());
  8083.  
  8084. ParentPanel = new JPanel();
  8085.  
  8086. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  8087.  
  8088. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  8089.  
  8090. InitializeNotesList();
  8091.  
  8092. FileSelectionList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  8093.  
  8094. NoteListScroll = new JScrollPane(FileSelectionList,
  8095. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  8096. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  8097.  
  8098. NoteListScroll.setSize(400,400);
  8099.  
  8100. NoteListScroll.setBackground(Vanila);
  8101.  
  8102. ParentPanel.add(NoteListScroll);
  8103.  
  8104. JPanel ButtonPanel = new JPanel();
  8105.  
  8106. ButtonPanel.setLayout(new GridLayout(1,3,5,5));
  8107.  
  8108. ButtonPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  8109.  
  8110. AddNote = new JButton("Add Note");
  8111.  
  8112. ButtonPanel.add(AddNote);
  8113.  
  8114. AddNote.setFocusPainted(false);
  8115.  
  8116. AddNote.setBackground(RegularRed);
  8117.  
  8118. AddNote.setFont(ButtonFont);
  8119.  
  8120. AddNote.addActionListener(this);
  8121.  
  8122. OpenNote = new JButton("Open Note");
  8123.  
  8124. ButtonPanel.add(OpenNote);
  8125.  
  8126. OpenNote.setFocusPainted(false);
  8127.  
  8128. OpenNote.setBackground(RegularRed);
  8129.  
  8130. OpenNote.setFont(ButtonFont);
  8131.  
  8132. OpenNote.addActionListener(this);
  8133.  
  8134. DeleteNote = new JButton("Delete Note");
  8135.  
  8136. ButtonPanel.add(DeleteNote);
  8137.  
  8138. DeleteNote.setFocusPainted(false);
  8139.  
  8140. DeleteNote.setBackground(RegularRed);
  8141.  
  8142. DeleteNote.setFont(ButtonFont);
  8143.  
  8144. DeleteNote.addActionListener(this);
  8145.  
  8146. ParentPanel.add(ButtonPanel);
  8147.  
  8148. NoteFrame.add(ParentPanel);
  8149.  
  8150. NoteFrame.pack();
  8151.  
  8152. NoteFrame.setLocationRelativeTo(null);
  8153.  
  8154. NoteFrame.setVisible(true);
  8155.  
  8156. NoteFrame.setAlwaysOnTop(true);
  8157.  
  8158. NoteFrame.setAlwaysOnTop(false);
  8159.  
  8160. NoteFrame.requestFocus();
  8161. }
  8162.  
  8163. public void InitializeNotesList()
  8164. {
  8165. File dir = new File("JesseUsers\\" + Username + "\\Notes");
  8166.  
  8167. NoteList = new LinkedList<File>();
  8168.  
  8169. NoteNameList = new LinkedList<String>();
  8170.  
  8171. for (File file : dir.listFiles())
  8172. {
  8173. if (file.getName().endsWith((".txt")))
  8174. {
  8175. NoteList.add(file.getAbsoluteFile());
  8176.  
  8177. NoteNameList.add(file.getName().toString().replace(".txt", ""));
  8178. }
  8179. }
  8180.  
  8181. String[] NotesArray = new String[NoteNameList.size()];
  8182.  
  8183. NotesArray = NoteNameList.toArray(NotesArray);
  8184.  
  8185. FileSelectionList = new JList(NotesArray);
  8186.  
  8187. FileSelectionList.addMouseListener(new MouseAdapter()
  8188. {
  8189. public void mouseClicked(MouseEvent evt)
  8190. {
  8191. if (evt.getClickCount() == 2 && FileSelectionList.getSelectedIndex() != -1)
  8192. {
  8193. OpenNote.doClick();
  8194. }
  8195. }
  8196. });
  8197. }
  8198.  
  8199. public void InitializeBackgroundsList()
  8200. {
  8201. File dir = new File("JesseUsers\\" + Username + "\\Backgrounds");
  8202.  
  8203. BackgroundsList = new LinkedList<File>();
  8204.  
  8205. BackgroundsNameList = new LinkedList<String>();
  8206.  
  8207. for (File file : dir.listFiles())
  8208. {
  8209. if (file.getName().endsWith((".png")))
  8210. {
  8211. BackgroundsList.add(file.getAbsoluteFile());
  8212.  
  8213. BackgroundsNameList.add(file.getName().toString().replace(".png", ""));
  8214. }
  8215. }
  8216.  
  8217. String[] BackgroundsArray = new String[BackgroundsNameList.size()];
  8218.  
  8219. BackgroundsArray = BackgroundsNameList.toArray(BackgroundsArray);
  8220.  
  8221. BackgroundSelectionList = new JList(BackgroundsArray);
  8222.  
  8223. BackgroundSelectionList.addMouseListener(new MouseAdapter()
  8224. {
  8225. public void mouseClicked(MouseEvent evt)
  8226. {
  8227. if (evt.getClickCount() == 2 && BackgroundSelectionList.getSelectedIndex() != -1)
  8228. {
  8229. OpenBackground.doClick();
  8230. }
  8231. }
  8232. });
  8233. }
  8234.  
  8235. public void InitializeMusicList()
  8236. {
  8237. File dir = new File("JesseUsers\\" + Username + "\\Music");
  8238.  
  8239. MusicList = new LinkedList<File>();
  8240.  
  8241. MusicNameList = new LinkedList<String>();
  8242.  
  8243. for (File file : dir.listFiles())
  8244. {
  8245. if (file.getName().endsWith((".mp3")))
  8246. {
  8247. MusicList.add(file.getAbsoluteFile());
  8248.  
  8249. MusicNameList.add(file.getName().toString().replace(".mp3", ""));
  8250. }
  8251. }
  8252.  
  8253. String[] MusicArray = new String[MusicNameList.size()];
  8254.  
  8255. MusicArray = MusicNameList.toArray(MusicArray);
  8256.  
  8257. MusicSelectionList = new JList(MusicArray);
  8258.  
  8259. MusicSelectionList.addMouseListener(new MouseAdapter()
  8260. {
  8261. public void mouseClicked(MouseEvent evt)
  8262. {
  8263. if (evt.getClickCount() == 2 && MusicSelectionList.getSelectedIndex() != -1)
  8264. {
  8265. OpenMusic.doClick();
  8266. }
  8267. }
  8268. });
  8269. }
  8270.  
  8271. public void AddNote()
  8272. {
  8273. if (NewNoteFrame != null)
  8274. {
  8275. CloseAnimation(NewNoteFrame);
  8276.  
  8277. NewNoteFrame.dispose();
  8278. }
  8279.  
  8280. NewNoteFrame = new JFrame();
  8281.  
  8282. NewNoteFrame.setResizable(false);
  8283.  
  8284. NewNoteFrame.setBounds(0,0,600,800);
  8285.  
  8286. NewNoteFrame.setTitle("New Note");
  8287.  
  8288. NewNoteFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  8289.  
  8290. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\note.png");
  8291.  
  8292. NewNoteFrame.setIconImage(img.getImage());
  8293.  
  8294. ParentPanel = new JPanel();
  8295.  
  8296. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  8297.  
  8298. JLabel FileNameLabel = new JLabel("Note Title");
  8299.  
  8300. FileNameLabel.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8301.  
  8302. JPanel TopPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8303.  
  8304. TopPanel.add(FileNameLabel,SwingConstants.CENTER);
  8305.  
  8306. ParentPanel.add(TopPanel,SwingConstants.CENTER);
  8307.  
  8308. NewNoteField = new JTextField(30);
  8309.  
  8310. NewNoteField.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8311.  
  8312. JPanel MiddlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8313.  
  8314. MiddlePanel.add(NewNoteField);
  8315.  
  8316. ParentPanel.add(MiddlePanel);
  8317.  
  8318. JLabel NoteTextLabel = new JLabel("Note Contents");
  8319.  
  8320. NoteTextLabel.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8321.  
  8322. JPanel BottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8323.  
  8324. BottomPanel.add(NoteTextLabel);
  8325.  
  8326. ParentPanel.add(BottomPanel);
  8327.  
  8328. NewNoteArea = new JTextArea(20,20);
  8329.  
  8330. NewNoteArea.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8331.  
  8332. NewNoteArea.setAutoscrolls(false);
  8333.  
  8334. NewNoteArea.setLineWrap(true);
  8335.  
  8336. NewNoteArea.setWrapStyleWord(true);
  8337.  
  8338. NewNoteArea.setBorder(new LineBorder(new Color(0, 0, 0)));
  8339.  
  8340. JScrollPane NewNoteScroll = new JScrollPane(NewNoteArea,
  8341. JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  8342. JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  8343.  
  8344. NewNoteScroll.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0));
  8345.  
  8346. NewNoteScroll.getViewport().setBorder(null);
  8347.  
  8348. NewNoteScroll.setViewportBorder(null);
  8349.  
  8350. NewNoteScroll.setBorder(BorderFactory.createEmptyBorder(0,20,20,20));
  8351.  
  8352. NewNoteScroll.setPreferredSize(new Dimension(570,780));
  8353.  
  8354. ParentPanel.add(NewNoteScroll);
  8355.  
  8356. SubmitNewNote = new JButton("Create Note");
  8357.  
  8358. SubmitNewNote.setFocusPainted(false);
  8359.  
  8360. SubmitNewNote.setBackground(RegularRed);
  8361.  
  8362. SubmitNewNote.setFont(ButtonFont);
  8363.  
  8364. SubmitNewNote.addActionListener(this);
  8365.  
  8366. JPanel ButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8367.  
  8368. ButtonPanel.add(SubmitNewNote);
  8369.  
  8370. ButtonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10));
  8371.  
  8372. ParentPanel.add(ButtonPanel);
  8373.  
  8374. ParentPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
  8375.  
  8376. NewNoteFrame.add(ParentPanel);
  8377.  
  8378. NewNoteFrame.setLocationRelativeTo(null);
  8379.  
  8380. NewNoteFrame.setVisible(true);
  8381.  
  8382. NewNoteFrame.setAlwaysOnTop(true);
  8383.  
  8384. NewNoteFrame.setAlwaysOnTop(false);
  8385.  
  8386. NewNoteField.requestFocus();
  8387. }
  8388.  
  8389. public void YouTubeThumbnail()
  8390. {
  8391. if (YTTNFrame != null)
  8392. {
  8393. CloseAnimation(YTTNFrame);
  8394.  
  8395. YTTNFrame.dispose();
  8396. }
  8397.  
  8398. YTTNFrame = new JFrame();
  8399.  
  8400. YTTNFrame.setResizable(false);
  8401.  
  8402. YTTNFrame.setTitle("YouTube Thumbnail");
  8403.  
  8404. YTTNFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  8405.  
  8406. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\youtube.png");
  8407.  
  8408. YTTNFrame.setIconImage(img.getImage());
  8409.  
  8410. ParentPanel = new JPanel();
  8411.  
  8412. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  8413.  
  8414. JLabel VideoID = new JLabel("Enter a valid YouTube video ID");
  8415.  
  8416. VideoID.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8417.  
  8418. JPanel TopPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8419.  
  8420. TopPanel.add(VideoID);
  8421.  
  8422. ParentPanel.add(TopPanel);
  8423.  
  8424. YTTNField = new JTextField(30);
  8425.  
  8426. YTTNField.addActionListener(this);
  8427.  
  8428. YTTNField.addKeyListener(new java.awt.event.KeyAdapter()
  8429. {
  8430. public void keyTyped(java.awt.event.KeyEvent evt)
  8431. {
  8432. if(YTTNField.getText().length() >= 11 && !(evt.getKeyChar()==KeyEvent.VK_DELETE || evt.getKeyChar() == KeyEvent.VK_BACKSPACE))
  8433. {
  8434. beep();
  8435.  
  8436. evt.consume();
  8437. }
  8438. }
  8439. });
  8440.  
  8441. YTTNField.addKeyListener(new java.awt.event.KeyAdapter()
  8442. {
  8443. char[] ValidChars = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
  8444. 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2',
  8445. '3','4','5','6','7','8','9','-','_'};
  8446.  
  8447. public void keyTyped(java.awt.event.KeyEvent evt)
  8448. {
  8449. boolean InArray = false;
  8450.  
  8451. for (char c : ValidChars)
  8452. {
  8453. if (c == evt.getKeyChar())
  8454. {
  8455. InArray = true;
  8456.  
  8457. break;
  8458. }
  8459. }
  8460.  
  8461. if (!InArray)
  8462. {
  8463. evt.consume();
  8464. }
  8465. }
  8466. });
  8467.  
  8468. YTTNField.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8469.  
  8470. YTTNField.setBorder(new LineBorder(new Color(0, 0, 0)));
  8471.  
  8472. JPanel MiddlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8473.  
  8474. MiddlePanel.add(YTTNField);
  8475.  
  8476. ParentPanel.add(MiddlePanel);
  8477.  
  8478. GetYTTN = new JButton("Get Thumbnail");
  8479.  
  8480. GetYTTN.setFocusPainted(false);
  8481.  
  8482. GetYTTN.setBackground(RegularRed);
  8483.  
  8484. GetYTTN.setFont(ButtonFont);
  8485.  
  8486. GetYTTN.addActionListener(this);
  8487.  
  8488. JPanel ButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  8489.  
  8490. ButtonPanel.add(GetYTTN);
  8491.  
  8492. ParentPanel.add(ButtonPanel);
  8493.  
  8494. ParentPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
  8495.  
  8496. YTTNFrame.add(ParentPanel);
  8497.  
  8498. YTTNFrame.pack();
  8499.  
  8500. YTTNFrame.setLocationRelativeTo(null);
  8501.  
  8502. YTTNFrame.setVisible(true);
  8503.  
  8504. YTTNFrame.setAlwaysOnTop(true);
  8505.  
  8506. YTTNFrame.setAlwaysOnTop(false);
  8507.  
  8508. YTTNField.requestFocus();
  8509. }
  8510.  
  8511. public void CreateUser()
  8512. {
  8513. if (LoginFrame != null)
  8514. {
  8515. SwingFeel(LoginFrame);
  8516. }
  8517.  
  8518. else if (ConsoleFrame != null)
  8519. {
  8520. SwingFeel(ConsoleFrame);
  8521. }
  8522.  
  8523. if (CreateUserFrame != null)
  8524. {
  8525. CloseAnimation(CreateUserFrame);
  8526.  
  8527. CreateUserFrame.dispose();
  8528. }
  8529.  
  8530. CreateUserFrame = new JFrame();
  8531.  
  8532. CreateUserFrame.setTitle("Create User");
  8533.  
  8534. CreateUserFrame.setResizable(false);
  8535.  
  8536. CreateUserFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  8537.  
  8538. CreateUserFrame.setIconImage(SASIDIcon.getImage());
  8539.  
  8540. ParentPanel = new JPanel();
  8541.  
  8542. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  8543.  
  8544. JLabel NameLabel = new JLabel("Username: ", SwingConstants.CENTER);
  8545.  
  8546. NameLabel.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8547.  
  8548. JPanel NameLabelPanel = new JPanel();
  8549.  
  8550. NameLabelPanel.add(NameLabel, SwingConstants.CENTER);
  8551.  
  8552. ParentPanel.add(NameLabelPanel);
  8553.  
  8554. NewUserName = new JTextField();
  8555.  
  8556. NewUserName.addActionListener(this);
  8557.  
  8558. NewUserName.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8559.  
  8560. NewUserName.addKeyListener(new java.awt.event.KeyAdapter()
  8561. {
  8562. public void keyTyped(java.awt.event.KeyEvent evt)
  8563. {
  8564. if (NewUserName.getText().length() > 15)
  8565. {
  8566. evt.consume();
  8567. }
  8568. }
  8569. });
  8570.  
  8571. NewUserName.setBorder(new LineBorder(new Color(0, 0, 0)));
  8572.  
  8573. NewUserName.addKeyListener(new KeyListener()
  8574. {
  8575.  
  8576. @Override
  8577. public void keyPressed(java.awt.event.KeyEvent e)
  8578. {
  8579. CreateNewUser.setToolTipText("Finalize the user \"" + NewUserName.getText() + "\"");
  8580.  
  8581. if (NewUserName.getText().length() == 1)
  8582. {
  8583. NewUserName.setText(NewUserName.getText().toUpperCase());
  8584. }
  8585. }
  8586.  
  8587. @Override
  8588. public void keyReleased(java.awt.event.KeyEvent e)
  8589. {
  8590. CreateNewUser.setToolTipText("Finalize the user \"" + NewUserName.getText() + "\"");
  8591.  
  8592. if (NewUserName.getText().length() == 1)
  8593. {
  8594. NewUserName.setText(NewUserName.getText().toUpperCase());
  8595. }
  8596. }
  8597.  
  8598. @Override
  8599. public void keyTyped(java.awt.event.KeyEvent e)
  8600. {
  8601. CreateNewUser.setToolTipText("Finalize the user \"" + NewUserName.getText() + "\"");
  8602.  
  8603. if (NewUserName.getText().length() == 1)
  8604. {
  8605. NewUserName.setText(NewUserName.getText().toUpperCase());
  8606. }
  8607. }
  8608. });
  8609.  
  8610. ParentPanel.add(NewUserName);
  8611.  
  8612. JLabel PasswordLabel = new JLabel("Password: ", SwingConstants.CENTER);
  8613.  
  8614. PasswordLabel.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8615.  
  8616. JLabel PasswordConfLabel = new JLabel("Re-enter pass: ", SwingConstants.CENTER);
  8617.  
  8618. PasswordConfLabel.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8619.  
  8620. NewUserPassword = new JPasswordField(15);
  8621.  
  8622. NewUserPassword.setFont(DefaultFontSmall);
  8623.  
  8624. NewUserPassword.addActionListener(this);
  8625.  
  8626. NewUserPassword.setBorder(new LineBorder(new Color(0, 0, 0)));
  8627.  
  8628. NewUserPasswordconf = new JPasswordField(15);
  8629.  
  8630. NewUserPasswordconf.setFont(DefaultFontSmall);
  8631.  
  8632. NewUserPasswordconf.addActionListener(this);
  8633.  
  8634. NewUserPasswordconf.setBorder(new LineBorder(new Color(0, 0, 0)));
  8635.  
  8636. JPanel PasswordLabelPanel = new JPanel();
  8637.  
  8638. PasswordLabelPanel.add(PasswordLabel, SwingConstants.CENTER);
  8639.  
  8640. ParentPanel.add(PasswordLabelPanel);
  8641.  
  8642. ParentPanel.add(NewUserPassword);
  8643.  
  8644. JPanel PasswordConfLabelPanel = new JPanel();
  8645.  
  8646. PasswordConfLabelPanel.add(PasswordConfLabel,SwingConstants.CENTER);
  8647.  
  8648. ParentPanel.add(PasswordConfLabelPanel);
  8649.  
  8650. ParentPanel.add(NewUserPasswordconf);
  8651.  
  8652. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  8653.  
  8654. ChooseBackground = new JLabel("Choose background", SwingConstants.CENTER);
  8655.  
  8656. ChooseBackground.setToolTipText("Click me to choose a background");
  8657.  
  8658. ChooseBackground.setFont(new Font("Tahoma",Font.BOLD,18));
  8659.  
  8660. ChooseBackground.setForeground(new Color(75,75,75));
  8661.  
  8662. ChooseBackground.addMouseListener(this);
  8663.  
  8664. ChooseBackground.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  8665.  
  8666. ChooseBackground.setFont(ButtonFont);
  8667.  
  8668. JPanel BackgroundPanel = new JPanel();
  8669.  
  8670. BackgroundPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  8671.  
  8672. BackgroundPanel.add(ChooseBackground);
  8673.  
  8674. ParentPanel.add(BackgroundPanel);
  8675.  
  8676. CreateNewUser = new JLabel("Create user", SwingConstants.CENTER);
  8677.  
  8678. CreateNewUser.setFont(new Font("Tahoma",Font.BOLD,18));
  8679.  
  8680. CreateNewUser.setForeground(new Color(75,75,75));
  8681.  
  8682. CreateNewUser.addMouseListener(this);
  8683.  
  8684. CreateNewUser.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  8685.  
  8686. CreateNewUser.setFont(ButtonFont);
  8687.  
  8688. JPanel CreatePanel = new JPanel();
  8689.  
  8690. CreatePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  8691.  
  8692. CreatePanel.add(CreateNewUser);
  8693.  
  8694. ParentPanel.add(CreatePanel);
  8695.  
  8696. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  8697.  
  8698. CreateUserFrame.add(ParentPanel);
  8699.  
  8700. CreateUserFrame.pack();
  8701.  
  8702. CreateUserFrame.setLocationRelativeTo(null);
  8703.  
  8704. CreateUserFrame.setVisible(true);
  8705.  
  8706. CreateUserFrame.setAlwaysOnTop(true);
  8707.  
  8708. CreateUserFrame.setAlwaysOnTop(false);
  8709.  
  8710. NewUserName.requestFocus();
  8711. }
  8712.  
  8713. public void ComputerProperties()
  8714. {
  8715. File file = null;
  8716.  
  8717. BufferedWriter fw = null;
  8718.  
  8719. try
  8720. {
  8721. file = File.createTempFile("Computer Properties",".txt");
  8722.  
  8723. file.deleteOnExit();
  8724.  
  8725. fw = new BufferedWriter(new FileWriter(file));
  8726.  
  8727. fw.write("Available processors (cores): " + Runtime.getRuntime().availableProcessors());
  8728.  
  8729. fw.write(System.getProperty("line.separator"));
  8730.  
  8731. fw.write("Free memory (bytes): " + Runtime.getRuntime().freeMemory());
  8732.  
  8733. fw.write(System.getProperty("line.separator"));
  8734.  
  8735. long maxMemory = Runtime.getRuntime().maxMemory();
  8736.  
  8737. fw.write("Maximum memory (bytes): " + (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory));
  8738.  
  8739. fw.write(System.getProperty("line.separator"));
  8740.  
  8741. fw.write("Total memory available to JVM (bytes): " + Runtime.getRuntime().totalMemory());
  8742.  
  8743. fw.write(System.getProperty("line.separator"));
  8744.  
  8745. File[] roots = File.listRoots();
  8746.  
  8747. for (File root : roots)
  8748. {
  8749. fw.write("File system root: " + root.getAbsolutePath());
  8750.  
  8751. fw.write(System.getProperty("line.separator"));
  8752.  
  8753. fw.write("Total space (bytes): " + root.getTotalSpace());
  8754.  
  8755. fw.write(System.getProperty("line.separator"));
  8756.  
  8757. fw.write("Free space (bytes): " + root.getFreeSpace());
  8758.  
  8759. fw.write(System.getProperty("line.separator"));
  8760.  
  8761. fw.write("Usable space (bytes): " + root.getUsableSpace());
  8762. }
  8763.  
  8764. fw.close();
  8765.  
  8766. Desktop.getDesktop().open(file);
  8767. }
  8768.  
  8769. catch (Exception ex)
  8770. {
  8771. LogError(ex);
  8772. }
  8773. }
  8774.  
  8775. public void DeleteAccount()
  8776. {
  8777. Object[] options = {"No! I want my user", "Sounds good; kill me"};
  8778.  
  8779. WindowsFeel(ConsoleFrame);
  8780.  
  8781. int choice = JOptionPane.showOptionDialog(null,"Are you sure you want to permanently delete this account?\nThis action cannot be undone!", "",
  8782. JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, SASIDIcon, options, options[0]);
  8783.  
  8784. if (choice == 1)
  8785. {
  8786. DeleteFolder(new File("JesseUsers\\" + Username));
  8787.  
  8788. CloseAnimation(ConsoleFrame);
  8789.  
  8790. ConsoleFrame.dispose();
  8791.  
  8792. Login(false);
  8793. }
  8794. }
  8795.  
  8796. public void DeleteFolder(File folder)
  8797. {
  8798. File[] files = folder.listFiles();
  8799.  
  8800. if (files != null)
  8801. {
  8802. for (File f: files)
  8803. {
  8804. if (f.isDirectory())
  8805. {
  8806. DeleteFolder(f);
  8807. }
  8808.  
  8809. else
  8810. {
  8811. f.delete();
  8812. }
  8813. }
  8814. }
  8815.  
  8816. folder.delete();
  8817. }
  8818.  
  8819. public void SystemSounds()
  8820. {
  8821. JFrame SoundFrame = new JFrame();
  8822.  
  8823. SoundFrame.setResizable(false);
  8824.  
  8825. SoundFrame.setTitle("System Sounds");
  8826.  
  8827. SoundFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  8828.  
  8829. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\SystemSounds.png");
  8830.  
  8831. SoundFrame.setIconImage(img.getImage());
  8832.  
  8833. ParentPanel = new JPanel();
  8834.  
  8835. GridLayout Grid = new GridLayout(16,1,5,5);
  8836.  
  8837. ParentPanel.setLayout(Grid);
  8838.  
  8839. JLabel SoundLabel = new JLabel("Windows System Sounds");
  8840.  
  8841. SoundLabel.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  8842.  
  8843. ParentPanel.add(SoundLabel);
  8844.  
  8845. JButton DefaultSound = new JButton("Default Sound");
  8846.  
  8847. DefaultSound.setFocusPainted(false);
  8848.  
  8849. DefaultSound.setBackground(RegularRed);
  8850.  
  8851. DefaultSound.setFont(ButtonFont);
  8852.  
  8853. DefaultSound.addActionListener(new ActionListener()
  8854. {
  8855. @Override
  8856. public void actionPerformed(ActionEvent e)
  8857. {
  8858. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.default");
  8859.  
  8860. if (Sound != null)
  8861. {
  8862. Sound.run();
  8863. }
  8864. }
  8865. });
  8866.  
  8867. ParentPanel.add(DefaultSound);
  8868.  
  8869. JButton CloseSound = new JButton("Close Sound");
  8870.  
  8871. CloseSound.setFocusPainted(false);
  8872.  
  8873. CloseSound.setBackground(RegularRed);
  8874.  
  8875. CloseSound.setFont(ButtonFont);
  8876.  
  8877. CloseSound.addActionListener(new ActionListener()
  8878. {
  8879. @Override
  8880. public void actionPerformed(ActionEvent e)
  8881. {
  8882. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.close");
  8883.  
  8884. if (Sound != null)
  8885. {
  8886. Sound.run();
  8887. }
  8888. }
  8889. });
  8890.  
  8891. ParentPanel.add(CloseSound);
  8892.  
  8893. JButton MaximizeSound = new JButton("Maximize Sound");
  8894.  
  8895. MaximizeSound.setFocusPainted(false);
  8896.  
  8897. MaximizeSound.setBackground(RegularRed);
  8898.  
  8899. MaximizeSound.setFont(ButtonFont);
  8900.  
  8901. MaximizeSound.addActionListener(new ActionListener()
  8902. {
  8903. @Override
  8904. public void actionPerformed(ActionEvent e)
  8905. {
  8906. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.maximize");
  8907.  
  8908. if (Sound != null)
  8909. {
  8910. Sound.run();
  8911. }
  8912. }
  8913. });
  8914.  
  8915. ParentPanel.add(MaximizeSound);
  8916.  
  8917. JButton MinimizeSound = new JButton("Minimize Sound");
  8918.  
  8919. MinimizeSound.setFocusPainted(false);
  8920.  
  8921. MinimizeSound.setBackground(RegularRed);
  8922.  
  8923. MinimizeSound.setFont(ButtonFont);
  8924.  
  8925. MinimizeSound.addActionListener(new ActionListener()
  8926. {
  8927. @Override
  8928. public void actionPerformed(ActionEvent e)
  8929. {
  8930. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.minimize");
  8931.  
  8932. if (Sound != null)
  8933. {
  8934. Sound.run();
  8935. }
  8936. }
  8937. });
  8938.  
  8939. ParentPanel.add(MinimizeSound);
  8940.  
  8941. JButton MenuSound = new JButton("Menu Command Sound");
  8942.  
  8943. MenuSound.setFocusPainted(false);
  8944.  
  8945. MenuSound.setBackground(RegularRed);
  8946.  
  8947. MenuSound.setFont(ButtonFont);
  8948.  
  8949. MenuSound.addActionListener(new ActionListener()
  8950. {
  8951. @Override
  8952. public void actionPerformed(ActionEvent e)
  8953. {
  8954. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.menuCommand");
  8955.  
  8956. if (Sound != null)
  8957. {
  8958. Sound.run();
  8959. }
  8960. }
  8961. });
  8962.  
  8963. ParentPanel.add(MenuSound);
  8964.  
  8965. JButton MenuPopup = new JButton("Menu Popup Sound");
  8966.  
  8967. MenuPopup.setFocusPainted(false);
  8968.  
  8969. MenuPopup.setBackground(RegularRed);
  8970.  
  8971. MenuPopup.setFont(ButtonFont);
  8972.  
  8973. MenuPopup.addActionListener(new ActionListener()
  8974. {
  8975. @Override
  8976. public void actionPerformed(ActionEvent e)
  8977. {
  8978. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.menuPopup");
  8979.  
  8980. if (Sound != null)
  8981. {
  8982. Sound.run();
  8983. }
  8984. }
  8985. });
  8986.  
  8987. ParentPanel.add(MenuPopup);
  8988.  
  8989. JButton OpenSound = new JButton("Open Sound");
  8990.  
  8991. OpenSound.setFocusPainted(false);
  8992.  
  8993. OpenSound.setBackground(RegularRed);
  8994.  
  8995. OpenSound.setFont(ButtonFont);
  8996.  
  8997. OpenSound.addActionListener(new ActionListener()
  8998. {
  8999. @Override
  9000. public void actionPerformed(ActionEvent e)
  9001. {
  9002. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.open");
  9003.  
  9004. if (Sound != null)
  9005. {
  9006. Sound.run();
  9007. }
  9008. }
  9009. });
  9010.  
  9011. ParentPanel.add(OpenSound);
  9012.  
  9013. JButton RestoreDown = new JButton("Restore Down Sound");
  9014.  
  9015. RestoreDown.setFocusPainted(false);
  9016.  
  9017. RestoreDown.setBackground(RegularRed);
  9018.  
  9019. RestoreDown.setFont(ButtonFont);
  9020.  
  9021. RestoreDown.addActionListener(new ActionListener()
  9022. {
  9023. @Override
  9024. public void actionPerformed(ActionEvent e)
  9025. {
  9026. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.restoreDown");
  9027.  
  9028. if (Sound != null)
  9029. {
  9030. Sound.run();
  9031. }
  9032. }
  9033. });
  9034.  
  9035. ParentPanel.add(RestoreDown);
  9036.  
  9037. JButton RestoreUp = new JButton("Restore Up Sound");
  9038.  
  9039. RestoreUp.setFocusPainted(false);
  9040.  
  9041. RestoreUp.setBackground(RegularRed);
  9042.  
  9043. RestoreUp.setFont(ButtonFont);
  9044.  
  9045. RestoreUp.addActionListener(new ActionListener()
  9046. {
  9047. @Override
  9048. public void actionPerformed(ActionEvent e)
  9049. {
  9050. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.restoreUp");
  9051.  
  9052. if (Sound != null)
  9053. {
  9054. Sound.run();
  9055. }
  9056. }
  9057. });
  9058.  
  9059. ParentPanel.add(RestoreUp);
  9060.  
  9061. JButton Asterisk = new JButton("Asterisk Sound");
  9062.  
  9063. Asterisk.setFocusPainted(false);
  9064.  
  9065. Asterisk.setBackground(RegularRed);
  9066.  
  9067. Asterisk.setFont(ButtonFont);
  9068.  
  9069. Asterisk.addActionListener(new ActionListener()
  9070. {
  9071. @Override
  9072. public void actionPerformed(ActionEvent e)
  9073. {
  9074. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.asterisk");
  9075.  
  9076. if (Sound != null)
  9077. {
  9078. Sound.run();
  9079. }
  9080. }
  9081. });
  9082.  
  9083. ParentPanel.add(Asterisk);
  9084.  
  9085. JButton Exclamation = new JButton("Exclamation Sound");
  9086.  
  9087. Exclamation.setFocusPainted(false);
  9088.  
  9089. Exclamation.setBackground(RegularRed);
  9090.  
  9091. Exclamation.setFont(ButtonFont);
  9092.  
  9093. Exclamation.addActionListener(new ActionListener()
  9094. {
  9095. @Override
  9096. public void actionPerformed(ActionEvent e)
  9097. {
  9098. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.exclamation");
  9099.  
  9100. if (Sound != null)
  9101. {
  9102. Sound.run();
  9103. }
  9104. }
  9105. });
  9106.  
  9107. ParentPanel.add(Exclamation);
  9108.  
  9109. JButton Exit = new JButton("Exit Sound");
  9110.  
  9111. Exit.setFocusPainted(false);
  9112.  
  9113. Exit.setBackground(RegularRed);
  9114.  
  9115. Exit.setFont(ButtonFont);
  9116.  
  9117. Exit.addActionListener(new ActionListener()
  9118. {
  9119. @Override
  9120. public void actionPerformed(ActionEvent e)
  9121. {
  9122. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.exit");
  9123.  
  9124. if (Sound != null)
  9125. {
  9126. Sound.run();
  9127. }
  9128. }
  9129. });
  9130.  
  9131. ParentPanel.add(Exit);
  9132.  
  9133. JButton Hand = new JButton("Hand Sound");
  9134.  
  9135. Hand.setFocusPainted(false);
  9136.  
  9137. Hand.setBackground(RegularRed);
  9138.  
  9139. Hand.setFont(ButtonFont);
  9140.  
  9141. Hand.addActionListener(new ActionListener()
  9142. {
  9143. @Override
  9144. public void actionPerformed(ActionEvent e)
  9145. {
  9146. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.hand");
  9147.  
  9148. if (Sound != null)
  9149. {
  9150. Sound.run();
  9151. }
  9152. }
  9153. });
  9154.  
  9155. ParentPanel.add(Hand);
  9156.  
  9157. JButton Question = new JButton("Question Sound");
  9158.  
  9159. Question.setFocusPainted(false);
  9160.  
  9161. Question.setBackground(RegularRed);
  9162.  
  9163. Question.setFont(ButtonFont);
  9164.  
  9165. Question.addActionListener(new ActionListener()
  9166. {
  9167. @Override
  9168. public void actionPerformed(ActionEvent e)
  9169. {
  9170. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.question");
  9171.  
  9172. if (Sound != null)
  9173. {
  9174. Sound.run();
  9175. }
  9176. }
  9177. });
  9178.  
  9179. ParentPanel.add(Question);
  9180.  
  9181. JButton Start = new JButton("Start Sound");
  9182.  
  9183. Start.setFocusPainted(false);
  9184.  
  9185. Start.setBackground(RegularRed);
  9186.  
  9187. Start.setFont(ButtonFont);
  9188.  
  9189. Start.addActionListener(new ActionListener()
  9190. {
  9191. @Override
  9192. public void actionPerformed(ActionEvent e)
  9193. {
  9194. final Runnable Sound = (Runnable) Toolkit.getDefaultToolkit().getDesktopProperty("win.sound.start");
  9195.  
  9196. if (Sound != null)
  9197. {
  9198. Sound.run();
  9199. }
  9200. }
  9201. });
  9202.  
  9203. ParentPanel.add(Start);
  9204.  
  9205. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  9206.  
  9207. SoundFrame.add(ParentPanel);
  9208.  
  9209. SoundFrame.pack();
  9210.  
  9211. SoundFrame.setLocationRelativeTo(null);
  9212.  
  9213. SoundFrame.setVisible(true);
  9214.  
  9215. SoundFrame.setAlwaysOnTop(true);
  9216.  
  9217. SoundFrame.setAlwaysOnTop(false);
  9218.  
  9219. SoundFrame.requestFocus();
  9220. }
  9221.  
  9222. public void Pixelate(File path, int pixelsize)
  9223. {
  9224. try
  9225. {
  9226. final int PIX_SIZE = pixelsize;
  9227.  
  9228. ReturnImage = ImageIO.read(path);
  9229.  
  9230. Raster src = ReturnImage.getData();
  9231.  
  9232. WritableRaster dest = src.createCompatibleWritableRaster();
  9233.  
  9234. for (int y = 0; y < src.getHeight(); y += PIX_SIZE)
  9235. {
  9236. for (int x = 0; x < src.getWidth(); x += PIX_SIZE)
  9237. {
  9238. double[] pixel = new double[3];
  9239.  
  9240. pixel = src.getPixel(x, y, pixel);
  9241.  
  9242. for (int yd = y; (yd < y + PIX_SIZE) && (yd < dest.getHeight()); yd++)
  9243. {
  9244. for (int xd = x; (xd < x + PIX_SIZE) && (xd < dest.getWidth()); xd++)
  9245. {
  9246. dest.setPixel(xd, yd, pixel);
  9247. }
  9248. }
  9249. }
  9250. }
  9251.  
  9252. ReturnImage.setData(dest);
  9253.  
  9254. NewName = path.getName().replace(".png", "") + "_Pixelated_Magnitude_" + pixelsize + ".png";
  9255.  
  9256. if (PixelFrame != null)
  9257. {
  9258. CloseAnimation(PixelFrame);
  9259.  
  9260. PixelFrame.dispose();
  9261. }
  9262.  
  9263. PixelFrame = new JFrame();
  9264.  
  9265. PixelFrame.setUndecorated(true);
  9266.  
  9267. PixelFrame.setTitle("Pixelation");
  9268.  
  9269. PixelFrame.addMouseMotionListener(this);
  9270.  
  9271. PixelFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  9272.  
  9273. JPanel ParentPanel = new JPanel();
  9274.  
  9275. ParentPanel.setLayout(new BorderLayout());
  9276.  
  9277. PixelFrame.setContentPane(ParentPanel);
  9278.  
  9279. JLabel PictureLabel = new JLabel(new ImageIcon(ReturnImage));
  9280.  
  9281. ParentPanel.add(PictureLabel, BorderLayout.PAGE_START);
  9282.  
  9283. ApproveImage = new JButton("Approve Image");
  9284.  
  9285. ApproveImage.setFocusPainted(false);
  9286.  
  9287. ApproveImage.setBackground(new Color(223,85,83));
  9288.  
  9289. ApproveImage.setFont(ButtonFont);
  9290.  
  9291. ApproveImage.addActionListener(this);
  9292.  
  9293. ApproveImage.setSize(PixelFrame.getX(),20);
  9294.  
  9295. ParentPanel.add(ApproveImage,BorderLayout.PAGE_END);
  9296.  
  9297. ParentPanel.repaint();
  9298.  
  9299. PixelFrame.pack();
  9300.  
  9301. PixelFrame.setVisible(true);
  9302.  
  9303. PixelFrame.setLocationRelativeTo(null);
  9304.  
  9305. PixelFrame.setAlwaysOnTop(true);
  9306.  
  9307. PixelFrame.setAlwaysOnTop(false);
  9308.  
  9309. PixelFrame.setResizable(false);
  9310.  
  9311. PixelFrame.setIconImage(SASIDIcon.getImage());
  9312. }
  9313.  
  9314. catch (Exception e)
  9315. {
  9316. LogError(e);
  9317. }
  9318. }
  9319.  
  9320. public File GetFile(String Description)
  9321. {
  9322. WindowsFeel(ConsoleFrame);
  9323.  
  9324. try
  9325. {
  9326. JFileChooser Chooser = new JFileChooser();
  9327.  
  9328. Chooser.setDialogTitle(Description);
  9329.  
  9330. int choice = 0;
  9331.  
  9332. if (ConsoleFrame != null)
  9333. {
  9334. choice = Chooser.showOpenDialog(ConsoleFrame);
  9335. }
  9336.  
  9337. else if (LoginFrame != null)
  9338. {
  9339. choice = Chooser.showOpenDialog(LoginFrame);
  9340. }
  9341.  
  9342. if (choice == JFileChooser.APPROVE_OPTION)
  9343. {
  9344. return Chooser.getSelectedFile();
  9345. }
  9346. }
  9347.  
  9348. catch (Exception e)
  9349. {
  9350. LogError(e);
  9351. }
  9352.  
  9353. return null;
  9354. }
  9355.  
  9356. public void WindowsFeel(Component Component)
  9357. {
  9358. try
  9359. {
  9360. UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
  9361.  
  9362. SwingUtilities.updateComponentTreeUI(Component);
  9363. }
  9364.  
  9365. catch (Exception e)
  9366. {
  9367.  
  9368. }
  9369. }
  9370.  
  9371. public void SwingFeel(Component Component)
  9372. {
  9373. try
  9374. {
  9375. UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
  9376.  
  9377. SwingUtilities.updateComponentTreeUI(Component);
  9378.  
  9379. Component.revalidate();
  9380.  
  9381. Component.repaint();
  9382. }
  9383.  
  9384. catch (Exception e)
  9385. {
  9386. LogError(e);
  9387. }
  9388. }
  9389.  
  9390. public BufferedImage ImageFromConsole(int x, int y, File UneditedImage)
  9391. {
  9392. BufferedImage ReturnImage = null;
  9393.  
  9394. try
  9395. {
  9396. File CurrentConsole = UneditedImage;
  9397.  
  9398. Image ConsoleImage = ImageIO.read(CurrentConsole);
  9399.  
  9400. Image TransferImage = ConsoleImage.getScaledInstance(x, y, Image.SCALE_SMOOTH);
  9401.  
  9402. ReturnImage = new BufferedImage(TransferImage.getWidth(null), TransferImage.getHeight(null), BufferedImage.TYPE_INT_ARGB);
  9403.  
  9404. Graphics2D bGr = ReturnImage.createGraphics();
  9405.  
  9406. bGr.drawImage(TransferImage, 0, 0, null);
  9407.  
  9408. bGr.dispose();
  9409.  
  9410. return ReturnImage;
  9411. }
  9412.  
  9413. catch (Exception e)
  9414. {
  9415. LogError(e);
  9416. }
  9417.  
  9418. return ReturnImage;
  9419. }
  9420.  
  9421. public boolean OnLastBackground()
  9422. {
  9423. if (ValidBackgroundPaths.length == CurrentBackgroundIndex + 1)
  9424. {
  9425. return true;
  9426. }
  9427.  
  9428. return true;
  9429. }
  9430.  
  9431. public void UserFontAndColor()
  9432. {
  9433. try
  9434. {
  9435. BufferedReader FontColor = new BufferedReader(new FileReader("JesseUsers\\" + Username + "\\FontColor.txt"));
  9436.  
  9437. String FontName = FontColor.readLine();
  9438.  
  9439. String Color[] = FontColor.readLine().split(",");
  9440.  
  9441. UserFont = new Font(FontName, Font.BOLD, 30);
  9442.  
  9443. UserColor = new Color(Integer.parseInt(Color[0]),Integer.parseInt(Color[1]),Integer.parseInt(Color[2]));
  9444.  
  9445. FontColor.close();
  9446.  
  9447. InputField.setForeground(UserColor);
  9448.  
  9449. OutputArea.setForeground(UserColor);
  9450.  
  9451. InputField.setFont(UserFont);
  9452.  
  9453. OutputArea.setFont(UserFont);
  9454. }
  9455.  
  9456. catch (Exception e)
  9457. {
  9458. LogError(e);
  9459. }
  9460. }
  9461.  
  9462. public void SaveFontColor()
  9463. {
  9464. try
  9465. {
  9466. Font SaveFont = OutputArea.getFont();
  9467.  
  9468. Color SaveColor = OutputArea.getForeground();
  9469.  
  9470. BufferedWriter FontColorWriter = new BufferedWriter(new FileWriter("JesseUsers\\" + Username + "\\FontColor.txt"));
  9471.  
  9472. FontColorWriter.write(SaveFont.getName());
  9473.  
  9474. FontColorWriter.write(System.getProperty("line.separator"));
  9475.  
  9476. FontColorWriter.write(SaveColor.getRed() + "," + SaveColor.getGreen() + "," + SaveColor.getBlue());
  9477.  
  9478. FontColorWriter.flush();
  9479.  
  9480. FontColorWriter.close();
  9481. }
  9482.  
  9483. catch (Exception e)
  9484. {
  9485. LogError(e);
  9486. }
  9487. }
  9488.  
  9489. public void CloseAnimation(JFrame frame)
  9490. {
  9491. try
  9492. {
  9493. if (frame != null && frame.isVisible())
  9494. {
  9495. Point point = frame.getLocationOnScreen();
  9496.  
  9497. int x = (int) point.getX();
  9498.  
  9499. int y = (int) point.getY();
  9500.  
  9501. for (int i = y ; i >= 0 - frame.getHeight() ; i -= 30)
  9502. {
  9503. Thread.sleep(1);
  9504.  
  9505. frame.setLocation(x, i);
  9506. }
  9507. }
  9508. }
  9509.  
  9510. catch (Exception e)
  9511. {
  9512. LogError(e);
  9513. }
  9514. }
  9515.  
  9516. public void MinimizeAnimation(JFrame frame)
  9517. {
  9518. Point point = frame.getLocationOnScreen();
  9519.  
  9520. int x = (int) point.getX();
  9521.  
  9522. int y = (int) point.getY();
  9523.  
  9524. try
  9525. {
  9526. for (int i = y ; i <= frame.getHeight() ; i += 30)
  9527. {
  9528. Thread.sleep(1);
  9529.  
  9530. frame.setLocation(x, i);
  9531. }
  9532. }
  9533.  
  9534. catch (Exception e)
  9535. {
  9536. LogError(e);
  9537. }
  9538. }
  9539.  
  9540. public void SwitchBackgroundToLeft()
  9541. {
  9542. Point point = ConsoleFrame.getLocationOnScreen();
  9543.  
  9544. int x = (int) point.getX();
  9545.  
  9546. int y = (int) point.getY();
  9547.  
  9548. try
  9549. {
  9550. for (int i = x ; i >= 0 - ConsoleFrame.getWidth() ; i -= 30)
  9551. {
  9552. Thread.sleep(1);
  9553.  
  9554. ConsoleFrame.setLocation(i, y);
  9555. }
  9556. }
  9557.  
  9558. catch (Exception e)
  9559. {
  9560. LogError(e);
  9561. }
  9562. }
  9563.  
  9564. public void SwitchBackgroundFromLeft()
  9565. {
  9566. ConsoleFrame.setLocationRelativeTo(null);
  9567.  
  9568. Point point = ConsoleFrame.getLocationOnScreen();
  9569.  
  9570. int x = (int) point.getX();
  9571.  
  9572. int y = (int) point.getY();
  9573.  
  9574. ConsoleFrame.setLocation(ScreenX, y);
  9575.  
  9576. try
  9577. {
  9578. for (int i = ScreenX ; i >= x ; i -= 30)
  9579. {
  9580. Thread.sleep(1);
  9581.  
  9582. ConsoleFrame.setLocation(i, y);
  9583. }
  9584. }
  9585.  
  9586. catch (Exception e)
  9587. {
  9588. LogError(e);
  9589. }
  9590. }
  9591.  
  9592. @Override
  9593. public void mouseClicked(MouseEvent evt)
  9594. {
  9595.  
  9596. }
  9597.  
  9598. @Override
  9599. public void mouseEntered(MouseEvent evt)
  9600. {
  9601. Object control = evt.getSource();
  9602.  
  9603. if (control == CloseLog)
  9604. {
  9605. CloseLog.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close2.png"));
  9606. }
  9607.  
  9608. else if (control == NewUserLabel)
  9609. {
  9610. NewUserLabel.setText("Create an account!");
  9611.  
  9612. NewUserLabel.setForeground(RegularRed);
  9613. }
  9614.  
  9615. else if (control == CreateNewUser)
  9616. {
  9617. CreateNewUser.setText("Start working!");
  9618. }
  9619.  
  9620. else if (control == ChooseBackground)
  9621. {
  9622. if (ChooseBackground.getName() == "No file chosen")
  9623. {
  9624. ChooseBackground.setText("No file chosen");
  9625. }
  9626.  
  9627. else
  9628. {
  9629. ChooseBackground.setText(CreateUserBackground.getName());
  9630. }
  9631. }
  9632.  
  9633. else if (control == close)
  9634. {
  9635. close.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close2.png"));
  9636. }
  9637.  
  9638. else if (control == minimize)
  9639. {
  9640. minimize.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Minimize2.png"));
  9641. }
  9642.  
  9643. else if (control == ChangeSize)
  9644. {
  9645. ChangeSize.setIcon(new ImageIcon("SASIDFiles\\Pictures\\ChangeSize2.png"));
  9646. }
  9647.  
  9648. else if (control == MinimizeWeather)
  9649. {
  9650. MinimizeWeather.setIcon(new ImageIcon("SASIDFiles\\Pictures\\MinimizeWeather2.png"));
  9651. }
  9652.  
  9653. else if (control == CloseWeather)
  9654. {
  9655. CloseWeather.setIcon(new ImageIcon("SASIDFiles\\Pictures\\CloseWeather2.png"));
  9656. }
  9657.  
  9658. else if (control == DebugButton)
  9659. {
  9660. DebugButton.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Debug2.png"));
  9661. }
  9662.  
  9663. else if (control == CloseDebug)
  9664. {
  9665. CloseDebug.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close2.png"));
  9666. }
  9667.  
  9668. else if (control == CloseMusic)
  9669. {
  9670. CloseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close2.png"));
  9671. }
  9672. }
  9673.  
  9674. @Override
  9675. public void mouseExited(MouseEvent evt)
  9676. {
  9677. Object control = evt.getSource();
  9678.  
  9679. if (control == CloseLog)
  9680. {
  9681. CloseLog.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close1.png"));
  9682. }
  9683.  
  9684. else if (control == NewUserLabel)
  9685. {
  9686. NewUserLabel.setText("Don't have an account?");
  9687.  
  9688. NewUserLabel.setForeground(Vanila);
  9689. }
  9690.  
  9691. else if (control == ChooseBackground)
  9692. {
  9693. ChooseBackground.setText("Choose background");
  9694. }
  9695.  
  9696. else if (control == CreateNewUser)
  9697. {
  9698. CreateNewUser.setText("Create user");
  9699. }
  9700.  
  9701. else if (control == close)
  9702. {
  9703. close.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close1.png"));
  9704. }
  9705.  
  9706. else if (control == minimize)
  9707. {
  9708. minimize.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Minimize1.png"));
  9709. }
  9710.  
  9711. else if (control == ChangeSize)
  9712. {
  9713. ChangeSize.setIcon(new ImageIcon("SASIDFiles\\Pictures\\ChangeSize1.png"));
  9714. }
  9715.  
  9716. else if (control == MinimizeWeather)
  9717. {
  9718. MinimizeWeather.setIcon(new ImageIcon("SASIDFiles\\Pictures\\MinimizeWeather1.png"));
  9719. }
  9720.  
  9721. else if (control == CloseWeather)
  9722. {
  9723. CloseWeather.setIcon(new ImageIcon("SASIDFiles\\Pictures\\CloseWeather1.png"));
  9724. }
  9725.  
  9726. else if (control == DebugButton)
  9727. {
  9728. DebugButton.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Debug1.png"));
  9729. }
  9730.  
  9731. else if (control == CloseDebug)
  9732. {
  9733. CloseDebug.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close1.png"));
  9734. }
  9735.  
  9736. else if (control == CloseMusic)
  9737. {
  9738. CloseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Close1.png"));
  9739. }
  9740. }
  9741.  
  9742. @Override
  9743. public void mousePressed(MouseEvent evt)
  9744. {
  9745.  
  9746. }
  9747.  
  9748. @Override
  9749. public void mouseReleased(MouseEvent evt)
  9750. {
  9751. Object source = evt.getSource();
  9752.  
  9753. if (source == SplashLabel)
  9754. {
  9755. InternetConnect("https://www.youtube.com/watch?v=VeHIOSxAQVA");
  9756. }
  9757.  
  9758. else if (source == NewUserLabel)
  9759. {
  9760. CreateUser();
  9761. }
  9762.  
  9763. else if (source == ChooseBackground)
  9764. {
  9765. if (LoginFrame != null)
  9766. {
  9767. WindowsFeel(LoginFrame);
  9768.  
  9769. CreateUserBackground = GetFile("Select any png file");
  9770.  
  9771. SwingFeel(LoginFrame);
  9772. }
  9773.  
  9774. else if (ConsoleFrame != null)
  9775. {
  9776. WindowsFeel(ConsoleFrame);
  9777.  
  9778. CreateUserBackground = GetFile("Select any png file");
  9779.  
  9780. SwingFeel(ConsoleFrame);
  9781. }
  9782. }
  9783.  
  9784. else if (source == CreateNewUser)
  9785. {
  9786. try
  9787. {
  9788. String name = NewUserName.getText().trim();
  9789.  
  9790. String pass = new String(NewUserPassword.getPassword());
  9791.  
  9792. String passconf = new String (NewUserPasswordconf.getPassword());
  9793.  
  9794. if (!pass.equals(passconf) && !pass.equals("") && pass != null)
  9795. {
  9796. QBox("Sorry, but your passwords did not match. Please try again.");
  9797.  
  9798. NewUserPassword.setText("");
  9799.  
  9800. NewUserPasswordconf.setText("");
  9801. }
  9802.  
  9803. else if (pass.length() <= 4)
  9804. {
  9805. QBox("Sorry, but your password length should be greater than\n"
  9806. + "four characters for security reasons. Please try again.");
  9807.  
  9808. NewUserPassword.setText("");
  9809.  
  9810. NewUserPasswordconf.setText("");
  9811. }
  9812.  
  9813. else if (name == null || pass == null || passconf == null || CreateUserBackground.getName() == "No file chosen" || name == "" || pass == "" || passconf == "" || name.length() == 0)
  9814. {
  9815. QBox("Sorry, but one of the required fields was left blank.\nPlease try again.");
  9816.  
  9817. NewUserPassword.setText("");
  9818.  
  9819. NewUserPasswordconf.setText("");
  9820. }
  9821.  
  9822. else
  9823. {
  9824. File NewUserFolder = new File("JesseUsers\\" + name);
  9825.  
  9826. DeleteFolder(NewUserFolder);
  9827.  
  9828. NewUserFolder.mkdirs();
  9829.  
  9830. File prefs = new File("JesseUsers\\" + name + "\\Preferences.csv");
  9831.  
  9832. prefs.createNewFile();
  9833.  
  9834. File music = new File("JesseUsers\\" + name + "\\Music");
  9835.  
  9836. music.mkdir();
  9837.  
  9838. File notes = new File("JesseUsers\\" + name + "\\Notes");
  9839.  
  9840. notes.mkdir();
  9841.  
  9842. File backgrounds = new File("JesseUsers\\" + name + "\\Backgrounds");
  9843.  
  9844. backgrounds.mkdir();
  9845.  
  9846. File Source = CreateUserBackground;
  9847.  
  9848. File Destination = new File("JesseUsers\\" + name + "\\Backgrounds\\" + Source.getName());
  9849.  
  9850. Files.copy(Source.toPath(), Destination.toPath());
  9851.  
  9852. String WritingPass = Hash(pass);
  9853.  
  9854. BufferedWriter PasswordWriter = new BufferedWriter(new FileWriter("JesseUsers\\" + name + "\\Password.txt"));
  9855.  
  9856. PasswordWriter.write(WritingPass);
  9857.  
  9858. PasswordWriter.flush();
  9859.  
  9860. PasswordWriter.close();
  9861.  
  9862. BufferedWriter FontColorWriter = new BufferedWriter(new FileWriter("JesseUsers\\" + name + "\\FontColor.txt"));
  9863.  
  9864. FontColorWriter.write("Tahoma");
  9865.  
  9866. FontColorWriter.write(System.getProperty("line.separator"));
  9867.  
  9868. FontColorWriter.write(Vanila.getRed() + "," + Vanila.getGreen() + "," + Vanila.getBlue());
  9869.  
  9870. FontColorWriter.flush();
  9871.  
  9872. FontColorWriter.close();
  9873.  
  9874. CSVwriter = new BufferedWriter(new FileWriter("JesseUsers\\" + name + "\\Preferences.csv"));
  9875.  
  9876. CSVwriter.write("PlayMusic,0");
  9877.  
  9878. CSVwriter.write(System.getProperty("line.separator"));
  9879.  
  9880. CSVwriter.write("SystemPropertiesOnStart,0");
  9881.  
  9882. CSVwriter.close();
  9883.  
  9884. CloseAnimation(CreateUserFrame);
  9885.  
  9886. CreateUserFrame.dispose();
  9887.  
  9888. QBox("The new user \"" + name + "\" has been created successfully.");
  9889.  
  9890. if (ConsoleFrame != null)
  9891. {
  9892. CloseAnimation(ConsoleFrame);
  9893.  
  9894. ConsoleFrame.dispose();
  9895.  
  9896. Login(false);
  9897. }
  9898. }
  9899. }
  9900.  
  9901. catch (Exception ex)
  9902. {
  9903. LogError(ex);
  9904. }
  9905. }
  9906.  
  9907. else if (source == DisplayLabel)
  9908. {
  9909. StringSelection selection = new StringSelection(DisplayLabel.getText());
  9910.  
  9911. java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  9912.  
  9913. clipboard.setContents(selection, selection);
  9914. }
  9915. }
  9916.  
  9917. public boolean IsPalindrome(char[] Word)
  9918. {
  9919. int i1 = 0;
  9920.  
  9921. int i2 = Word.length - 1;
  9922.  
  9923. while (i2 > i1)
  9924. {
  9925. if (Word[i1] != Word[i2])
  9926. {
  9927. return false;
  9928. }
  9929.  
  9930. i1++;
  9931.  
  9932. i2--;
  9933. }
  9934.  
  9935. return true;
  9936. }
  9937.  
  9938. public void RandomYoutube()
  9939. {
  9940. YouTubeThread = new Thread()
  9941. {
  9942. @Override
  9943. public void run()
  9944. {
  9945. ConsoleFrame.setTitle("YouTube script running");
  9946.  
  9947. String Start = "https://www.youtube.com/watch?v=";
  9948.  
  9949. String UUID = "";
  9950.  
  9951. char[] ValidChars = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
  9952. 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2',
  9953. '3','4','5','6','7','8','9','-','_'};
  9954.  
  9955. YouTubeScript = true;
  9956.  
  9957. for (int j = 1 ; j < 100000 ; j++)
  9958. {
  9959. try
  9960. {
  9961. Start = "https://www.youtube.com/watch?v=";
  9962.  
  9963. UUID = "";
  9964.  
  9965. if (!YouTubeScript)
  9966. {
  9967. break;
  9968. }
  9969.  
  9970. for (int i = 1 ; i < 12 ; i++)
  9971. {
  9972. UUID = UUID + ValidChars[RI(0,63)];
  9973. }
  9974.  
  9975. println("Iteration " + j + " checked UUID: " + UUID);
  9976.  
  9977. Start = Start + UUID;
  9978.  
  9979. String YouTubeURL = "https://img.youtube.com/vi/REPLACE/hqdefault.jpg";
  9980.  
  9981. YouTubeURL = YouTubeURL.replace("REPLACE", Start);
  9982.  
  9983. URL url;
  9984.  
  9985. url = new URL(YouTubeURL);
  9986.  
  9987. BufferedImage Thumbnail = ImageIO.read(url);
  9988.  
  9989. JLabel PictureLabel = new JLabel(new ImageIcon(Thumbnail));
  9990.  
  9991. JFrame ThumbnailFrame = new JFrame();
  9992.  
  9993. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\youtube.png");
  9994.  
  9995. final String Video = "https://www.youtube.com/watch?v=" + Start;
  9996.  
  9997. PictureLabel.addMouseListener(new MouseAdapter()
  9998. {
  9999. public void mouseClicked(MouseEvent e)
  10000. {
  10001. InternetConnect(Video);
  10002. }
  10003. });
  10004.  
  10005. PictureLabel.setToolTipText("Click To Open Video");
  10006.  
  10007. ThumbnailFrame.setIconImage(img.getImage());
  10008.  
  10009. ThumbnailFrame.setResizable(false);
  10010.  
  10011. ThumbnailFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  10012.  
  10013. ThumbnailFrame.getContentPane().add(PictureLabel);
  10014.  
  10015. ThumbnailFrame.pack();
  10016.  
  10017. ThumbnailFrame.setLocationRelativeTo(null);
  10018.  
  10019. ThumbnailFrame.setVisible(true);
  10020.  
  10021. break;
  10022. }
  10023.  
  10024. catch (Exception e)
  10025. {
  10026.  
  10027. }
  10028. }
  10029. }
  10030. };
  10031.  
  10032. YouTubeThread.start();
  10033. }
  10034.  
  10035. public void Iconified()
  10036. {
  10037. Thread IconifiedThread = new Thread()
  10038. {
  10039. @Override
  10040. public void run()
  10041. {
  10042. try
  10043. {
  10044. Thread.sleep(600000);
  10045. }
  10046.  
  10047. catch (Exception e)
  10048. {
  10049. LogError(e);
  10050. }
  10051.  
  10052. TrayIcon.displayMessage("Your best friend SASID is feeling lonely.",
  10053. "Hello, " + Username + ".\nPlease use my abundant features or make a suggestion as to what could be added." , MessageType.INFO);
  10054. }
  10055. };
  10056.  
  10057. IconifiedThread.start();
  10058. }
  10059.  
  10060. public void mp3(File StartPlaying)
  10061. {
  10062. if (MusicFrame != null)
  10063. {
  10064. CloseAnimation(MusicFrame);
  10065.  
  10066. MusicFrame.dispose();
  10067. }
  10068.  
  10069. MusicFrame = new JFrame();
  10070.  
  10071. MusicFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  10072.  
  10073. MusicFrame.setUndecorated(true);
  10074.  
  10075. MusicFrame.setTitle("MP3 Player");
  10076.  
  10077. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\Music.png");
  10078.  
  10079. MusicFrame.setIconImage(img.getImage());
  10080.  
  10081. MusicFrame.setBounds(0,0,904,604);
  10082.  
  10083. MusicLabel = new JLabel();
  10084.  
  10085. MusicLabel.setIcon(new ImageIcon("SASIDFiles\\Pictures\\mp3.png"));
  10086.  
  10087. MusicLabel.setBounds(0, 0, 904, 604);
  10088.  
  10089. MusicFrame.setContentPane(MusicLabel);
  10090.  
  10091. MusicDragLabel = new JLabel();
  10092.  
  10093. MusicDragLabel.setBounds(0,0,904 - 27,25);
  10094.  
  10095. MusicDragLabel.addMouseMotionListener(this);
  10096.  
  10097. MusicLabel.add(MusicDragLabel);
  10098.  
  10099. CloseMusic = new JButton("");
  10100.  
  10101. CloseMusic.setToolTipText("Close");
  10102.  
  10103. CloseMusic.addActionListener(this);
  10104.  
  10105. CloseMusic.setBounds(883, 0, 22, 20);
  10106.  
  10107. CloseMusic.addMouseListener(this);
  10108.  
  10109. ImageIcon exit = new ImageIcon("SASIDFiles\\Pictures\\Close1.png");
  10110.  
  10111. CloseMusic.setIcon(exit);
  10112.  
  10113. MusicLabel.add(CloseMusic);
  10114.  
  10115. CloseMusic.setFocusPainted(false);
  10116.  
  10117. CloseMusic.setOpaque(false);
  10118.  
  10119. CloseMusic.setContentAreaFilled(false);
  10120.  
  10121. CloseMusic.setBorderPainted(false);
  10122.  
  10123. MusicTitleLabel = new JLabel("",SwingConstants.CENTER);
  10124.  
  10125. MusicTitleLabel.setBounds(287,19,373,18);
  10126.  
  10127. MusicTitleLabel.setToolTipText("Currently Playing");
  10128.  
  10129. MusicTitleLabel.setFont(new Font("HeadPlane",Font.BOLD,18));
  10130.  
  10131. MusicTitleLabel.setForeground(Vanila);
  10132.  
  10133. MusicTitleLabel.setText("No audio currently playing");
  10134.  
  10135. MusicLabel.add(MusicTitleLabel);
  10136.  
  10137. MusicVolumeSlider = new JSlider(JSlider.HORIZONTAL, 0, 100, 100);
  10138.  
  10139. MusicVolumeSlider.setBounds(391,528,234,24);
  10140.  
  10141. MusicVolumeSlider.setMinimum(0);
  10142.  
  10143. MusicVolumeSlider.setMaximum(100);
  10144.  
  10145. MusicVolumeSlider.setMajorTickSpacing(10);
  10146.  
  10147. MusicVolumeSlider.setMinorTickSpacing(1);
  10148.  
  10149. MusicVolumeSlider.setPaintTicks(false);
  10150.  
  10151. MusicVolumeSlider.setPaintLabels(false);
  10152.  
  10153. MusicVolumeSlider.setVisible(true);
  10154.  
  10155. MusicVolumeSlider.setForeground(Vanila);
  10156.  
  10157. MusicVolumeSlider.setFont(new Font("HeadPlane",Font.BOLD,18));
  10158.  
  10159. MusicVolumeSlider.addChangeListener(this);
  10160.  
  10161. MusicVolumeSlider.setOpaque(false);
  10162.  
  10163. MusicVolumeSlider.setToolTipText("Volume");
  10164.  
  10165. MusicVolumeSlider.setFocusable(false);
  10166.  
  10167. MusicLabel.add(MusicVolumeSlider);
  10168.  
  10169. PlayPauseMusic = new JButton("");
  10170.  
  10171. PlayPauseMusic.setToolTipText("Play");
  10172.  
  10173. PlayPauseMusic.addActionListener(this);
  10174.  
  10175. PlayPauseMusic.setBounds(71,326,80,78);
  10176.  
  10177. ImageIcon Play = new ImageIcon("SASIDFiles\\Pictures\\Play.png");
  10178.  
  10179. PlayPauseMusic.setIcon(Play);
  10180.  
  10181. MusicLabel.add(PlayPauseMusic);
  10182.  
  10183. PlayPauseMusic.setFocusPainted(false);
  10184.  
  10185. PlayPauseMusic.setOpaque(false);
  10186.  
  10187. PlayPauseMusic.setContentAreaFilled(false);
  10188.  
  10189. PlayPauseMusic.setBorderPainted(false);
  10190.  
  10191. LastMusic = new JButton("");
  10192.  
  10193. LastMusic.setToolTipText("Last Audio");
  10194.  
  10195. LastMusic.addActionListener(this);
  10196.  
  10197. LastMusic.setBounds(71,411,80,78);
  10198.  
  10199. ImageIcon Last = new ImageIcon("SASIDFiles\\Pictures\\SkipBack.png");
  10200.  
  10201. LastMusic.setIcon(Last);
  10202.  
  10203. MusicLabel.add(LastMusic);
  10204.  
  10205. LastMusic.setFocusPainted(false);
  10206.  
  10207. LastMusic.setOpaque(false);
  10208.  
  10209. LastMusic.setContentAreaFilled(false);
  10210.  
  10211. LastMusic.setBorderPainted(false);
  10212.  
  10213. NextMusic = new JButton("");
  10214.  
  10215. NextMusic.setToolTipText("Next Audio");
  10216.  
  10217. NextMusic.addActionListener(this);
  10218.  
  10219. NextMusic.setBounds(161,411,80,78);
  10220.  
  10221. ImageIcon Next = new ImageIcon("SASIDFiles\\Pictures\\Skip.png");
  10222.  
  10223. NextMusic.setIcon(Next);
  10224.  
  10225. MusicLabel.add(NextMusic);
  10226.  
  10227. NextMusic.setFocusPainted(false);
  10228.  
  10229. NextMusic.setOpaque(false);
  10230.  
  10231. NextMusic.setContentAreaFilled(false);
  10232.  
  10233. NextMusic.setBorderPainted(false);
  10234.  
  10235. LoopMusic = new JButton("");
  10236.  
  10237. LoopMusic.setToolTipText("Loop Audio");
  10238.  
  10239. LoopMusic.addActionListener(this);
  10240.  
  10241. LoopMusic.setBounds(71,499,80,78);
  10242.  
  10243. ImageIcon Loop = new ImageIcon("SASIDFiles\\Pictures\\NoRepeat.png");
  10244.  
  10245. LoopMusic.setIcon(Loop);
  10246.  
  10247. MusicLabel.add(LoopMusic);
  10248.  
  10249. LoopMusic.setFocusPainted(false);
  10250.  
  10251. LoopMusic.setOpaque(false);
  10252.  
  10253. LoopMusic.setContentAreaFilled(false);
  10254.  
  10255. LoopMusic.setBorderPainted(false);
  10256.  
  10257. StopMusic = new JButton("");
  10258.  
  10259. StopMusic.setToolTipText("Stop");
  10260.  
  10261. StopMusic.addActionListener(this);
  10262.  
  10263. StopMusic.setBounds(161,499,80,78);
  10264.  
  10265. ImageIcon Stop = new ImageIcon("SASIDFiles\\Pictures\\Stop.png");
  10266.  
  10267. StopMusic.setIcon(Stop);
  10268.  
  10269. MusicLabel.add(StopMusic);
  10270.  
  10271. StopMusic.setFocusPainted(false);
  10272.  
  10273. StopMusic.setOpaque(false);
  10274.  
  10275. StopMusic.setContentAreaFilled(false);
  10276.  
  10277. StopMusic.setBorderPainted(false);
  10278.  
  10279. SelectMusicDir = new JButton("");
  10280.  
  10281. SelectMusicDir.setToolTipText("Open File");
  10282.  
  10283. SelectMusicDir.addActionListener(this);
  10284.  
  10285. SelectMusicDir.setBounds(250,499,80,78);
  10286.  
  10287. ImageIcon File = new ImageIcon("SASIDFiles\\Pictures\\SelectFile.png");
  10288.  
  10289. SelectMusicDir.setIcon(File);
  10290.  
  10291. MusicLabel.add(SelectMusicDir);
  10292.  
  10293. SelectMusicDir.setFocusPainted(false);
  10294.  
  10295. SelectMusicDir.setOpaque(false);
  10296.  
  10297. SelectMusicDir.setContentAreaFilled(false);
  10298.  
  10299. SelectMusicDir.setBorderPainted(false);
  10300.  
  10301. MusicFrame.setLocationRelativeTo(null);
  10302.  
  10303. MusicFrame.setVisible(true);
  10304.  
  10305. MusicFrame.setAlwaysOnTop(true);
  10306.  
  10307. MusicFrame.setAlwaysOnTop(false);
  10308.  
  10309. MusicFrame.requestFocus();
  10310.  
  10311. if (StartPlaying != null)
  10312. {
  10313. InitMusic(StartPlaying);
  10314. }
  10315. }
  10316.  
  10317. public void Play(File path)
  10318. {
  10319. try
  10320. {
  10321. if (MP3Player != null)
  10322. {
  10323. MP3Player.close();
  10324.  
  10325. MP3Player = null;
  10326. }
  10327.  
  10328. FIS = new FileInputStream(path.toString());
  10329.  
  10330. BIS = new BufferedInputStream(FIS);
  10331.  
  10332. MP3Player = new Player(BIS);
  10333.  
  10334. SongTotalLength = FIS.available();
  10335. }
  10336.  
  10337. catch (Exception e)
  10338. {
  10339. LogError(e);
  10340. }
  10341.  
  10342. new Thread()
  10343. {
  10344. @Override
  10345. public void run()
  10346. {
  10347. try
  10348. {
  10349. MusicTitleLabel.setText(MusicFiles[CurrentMusicIndex].getName().replace(".mp3", ""));
  10350.  
  10351. PlayPauseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Pause.png"));
  10352.  
  10353. PlayPauseMusic.setToolTipText("Pause");
  10354.  
  10355. PlayIcon = false;
  10356.  
  10357. MP3Player.play();
  10358.  
  10359. if (RepeatAudio)
  10360. {
  10361. Play(MusicFiles[CurrentMusicIndex]);
  10362. }
  10363.  
  10364. MusicTitleLabel.setText("No audio currently playing");
  10365.  
  10366. PlayPauseMusic.setIcon(new ImageIcon("SASIDFiles\\Pictures\\Play.png"));
  10367.  
  10368. PlayPauseMusic.setToolTipText("Play");
  10369.  
  10370. PlayIcon = true;
  10371.  
  10372. PauseLocation = 0;
  10373.  
  10374. SongTotalLength = 0;
  10375.  
  10376. MusicStopped = true;
  10377. }
  10378.  
  10379. catch (Exception e)
  10380. {
  10381.  
  10382. }
  10383. }
  10384.  
  10385. }.start();
  10386. }
  10387.  
  10388. public void ResumeMusic()
  10389. {
  10390. new Thread()
  10391. {
  10392. @Override
  10393. public void run()
  10394. {
  10395. try
  10396. {
  10397. MP3Player.play();
  10398.  
  10399. if (RepeatAudio)
  10400. {
  10401. Play(MusicFiles[CurrentMusicIndex]);
  10402. }
  10403. }
  10404.  
  10405. catch (Exception e)
  10406. {
  10407. LogError(e);
  10408. }
  10409. }
  10410.  
  10411. }.start();
  10412. }
  10413.  
  10414. @Override
  10415. public void stateChanged(ChangeEvent evt)
  10416. {
  10417. Object Control = evt.getSource();
  10418.  
  10419. if (Control == MusicVolumeSlider)
  10420. {
  10421. Info Source = Port.Info.SPEAKER;
  10422.  
  10423. Info Headphones = Port.Info.HEADPHONE;
  10424.  
  10425. if (AudioSystem.isLineSupported(Source))
  10426. {
  10427. try
  10428. {
  10429. Port outline = (Port) AudioSystem.getLine(Source);
  10430.  
  10431. outline.open();
  10432.  
  10433. FloatControl VolumeControl = (FloatControl) outline.getControl(FloatControl.Type.VOLUME);
  10434.  
  10435. VolumeControl.setValue( (float) (MusicVolumeSlider.getValue() * 0.01));
  10436. }
  10437.  
  10438. catch (Exception e)
  10439. {
  10440. LogError(e);
  10441. }
  10442. }
  10443.  
  10444. if (AudioSystem.isLineSupported(Headphones))
  10445. {
  10446. try
  10447. {
  10448. Port outline = (Port) AudioSystem.getLine(Headphones);
  10449.  
  10450. outline.open();
  10451.  
  10452. FloatControl VolumeControl = (FloatControl) outline.getControl(FloatControl.Type.VOLUME);
  10453.  
  10454. VolumeControl.setValue( (float) (MusicVolumeSlider.getValue() * 0.01));
  10455. }
  10456.  
  10457. catch (Exception e)
  10458. {
  10459. LogError(e);
  10460. }
  10461. }
  10462. }
  10463. }
  10464.  
  10465. public boolean InternetUnReachable()
  10466. {
  10467. Process Ping;
  10468.  
  10469. try
  10470. {
  10471. Ping = java.lang.Runtime.getRuntime().exec("ping -n 1 www.google.com");
  10472.  
  10473. int ReturnValue = Ping.waitFor();
  10474.  
  10475. if (ReturnValue == 0)
  10476. {
  10477. return false;
  10478. }
  10479. }
  10480.  
  10481. catch (Exception e)
  10482. {
  10483. LogError(e);
  10484. }
  10485.  
  10486. return true;
  10487. }
  10488.  
  10489. public void DebugCheck()
  10490. {
  10491. try
  10492. {
  10493. if (new File("SASIDFiles\\Text\\.DA").exists())
  10494. {
  10495. BufferedReader DebugReader = new BufferedReader(new FileReader("SASIDFiles\\Text\\.DA"));
  10496.  
  10497. String DebugCode = DebugReader.readLine();
  10498.  
  10499. DebugReader.close();
  10500.  
  10501. if (DebugCode.equals("dfjlg24356#$%^&#5--*GHJK&*(^_(^)*(468dghdfg#%^(%ddw45sfdH6")
  10502. && CUsername.equalsIgnoreCase("nathan") && ComputerName().equalsIgnoreCase("NathanLenovo"))
  10503. {
  10504. DebugMode = true;
  10505. }
  10506. }
  10507. }
  10508.  
  10509. catch (Exception e)
  10510. {
  10511. LogError(e);
  10512. }
  10513. }
  10514.  
  10515. public String ComputerName()
  10516. {
  10517. String Return = null;
  10518.  
  10519. try
  10520. {
  10521. InetAddress Add = InetAddress.getLocalHost();
  10522.  
  10523. Return = Add.getHostName();
  10524. }
  10525.  
  10526. catch (Exception e)
  10527. {
  10528. LogError(e);
  10529. }
  10530.  
  10531. return Return;
  10532. }
  10533.  
  10534. public void Location()
  10535. {
  10536. try
  10537. {
  10538. String Key = "https://api.ipdata.co/?api-key=8eac4e7ab34eb235c4a888bfdbedc8bb8093ec1490790d139cf58932";
  10539.  
  10540. URL Querry = new URL(Key);
  10541.  
  10542. BufferedReader BR = new BufferedReader(new InputStreamReader(Querry.openStream()));
  10543.  
  10544. String CurrentLine;
  10545.  
  10546. while ((CurrentLine = BR.readLine()) != null)
  10547. {
  10548. if (CurrentLine.contains("city"))
  10549. {
  10550. UserCity = (CurrentLine.replace("city", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10551. }
  10552.  
  10553. else if (CurrentLine.contains("\"region\""))
  10554. {
  10555. UserState = (CurrentLine.replace("region", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10556. }
  10557.  
  10558. else if (CurrentLine.contains("\"region_code\""))
  10559. {
  10560. UserStateAbr = (CurrentLine.replace("region_code", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10561. }
  10562.  
  10563. else if (CurrentLine.contains("organisation"))
  10564. {
  10565. UserISP = (CurrentLine.replace("organisation", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10566. }
  10567.  
  10568. else if (CurrentLine.contains("\"country_name\""))
  10569. {
  10570. UserCountry = (CurrentLine.replace("country_name", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10571. }
  10572.  
  10573. else if (CurrentLine.contains("\"country_code\""))
  10574. {
  10575. UserCountryAbr = (CurrentLine.replace("country_code", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10576. }
  10577.  
  10578. else if (CurrentLine.contains("\"latitude\""))
  10579. {
  10580. UserLat = (CurrentLine.replace("latitude", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10581. }
  10582.  
  10583. else if (CurrentLine.contains("\"longitude\""))
  10584. {
  10585. UserLon = (CurrentLine.replace("longitude", "").replace(",", "").replace("\"", "").replace(":", "").trim());
  10586. }
  10587. }
  10588.  
  10589. BR.close();
  10590. }
  10591.  
  10592. catch (Exception e)
  10593. {
  10594. LogError(e);
  10595. }
  10596. }
  10597.  
  10598. public void Fib(int a, int b)
  10599. {
  10600. int c = a + b;
  10601.  
  10602. print(", " + c);
  10603.  
  10604. if (c < 100000000)
  10605. {
  10606. Fib(b,c);
  10607. }
  10608. }
  10609.  
  10610. public void OpenNote(File File)
  10611. {
  10612. if (NoteEditorFrame != null)
  10613. {
  10614. CloseAnimation(NoteEditorFrame);
  10615.  
  10616. NoteEditorFrame.dispose();
  10617. }
  10618.  
  10619. NoteEditorFrame = new JFrame();
  10620.  
  10621. NoteEditorFrame.setTitle("Note Editor");
  10622.  
  10623. NoteEditorFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  10624.  
  10625. NoteEditorFrame.setUndecorated(false);
  10626.  
  10627. NoteEditorFrame.setTitle(File.getName().replace(".txt", ""));
  10628.  
  10629. NoteEditorFrame.setBounds(0,0,600,800);
  10630.  
  10631. NoteEditorFrame.setResizable(false);
  10632.  
  10633. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\Note.png");
  10634.  
  10635. NoteEditorFrame.setIconImage(img.getImage());
  10636.  
  10637. ParentPanel = new JPanel();
  10638.  
  10639. NoteEditorFrame.setContentPane(ParentPanel);
  10640.  
  10641. ParentPanel.setLayout(new BorderLayout());
  10642.  
  10643. NoteEditArea = new JTextArea(20,20);
  10644.  
  10645. NoteEditArea.setFont(new Font("Comic Sans MS",Font.BOLD,15));
  10646.  
  10647. NoteEditArea.setBorder(new LineBorder(new Color(0, 0, 0)));
  10648.  
  10649. NoteEditArea.setEditable(true);
  10650.  
  10651. NoteEditArea.setAutoscrolls(true);
  10652.  
  10653. NoteEditArea.setBounds(5,5,570,780);
  10654.  
  10655. NoteEditArea.setLineWrap(true);
  10656.  
  10657. NoteEditArea.setWrapStyleWord(true);
  10658.  
  10659. NoteEditArea.setFocusable(true);
  10660.  
  10661. NoteScroll = new JScrollPane(NoteEditArea,
  10662. JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  10663. JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  10664.  
  10665. NoteScroll.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0));
  10666.  
  10667. NoteScroll.getViewport().setBorder(null);
  10668.  
  10669. NoteScroll.setViewportBorder(null);
  10670.  
  10671. NoteScroll.setBorder(new LineBorder(new Color(0, 0, 0)));
  10672.  
  10673. NoteScroll.setBounds(5,5,570,780);
  10674.  
  10675. NoteScroll.setBorder(new EmptyBorder(10, 10, 10, 10));
  10676.  
  10677. ParentPanel.add(NoteScroll, BorderLayout.CENTER);
  10678.  
  10679. try
  10680. {
  10681. BufferedReader InitReader = new BufferedReader(new FileReader(File));
  10682.  
  10683. String Line = InitReader.readLine();
  10684.  
  10685. while (Line != null)
  10686. {
  10687. NoteEditArea.append(Line + "\n");
  10688.  
  10689. Line = InitReader.readLine();
  10690. }
  10691.  
  10692. InitReader.close();
  10693. }
  10694.  
  10695. catch (Exception e)
  10696. {
  10697. LogError(e);
  10698. }
  10699.  
  10700. CurrentUserNote = File;
  10701.  
  10702. SaveNote = new JButton("Save & Resign");
  10703.  
  10704. SaveNote.setFocusPainted(false);
  10705.  
  10706. SaveNote.setBackground(new Color(223,85,83));
  10707.  
  10708. SaveNote.setFont(ButtonFont);
  10709.  
  10710. SaveNote.addActionListener(this);
  10711.  
  10712. SaveNote.setSize(200,50);
  10713.  
  10714. JPanel SavePanel = new JPanel();
  10715.  
  10716. SavePanel.add(SaveNote, SwingConstants.CENTER);
  10717.  
  10718. ParentPanel.add(SavePanel, BorderLayout.PAGE_END);
  10719.  
  10720. ParentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  10721.  
  10722. NoteEditorFrame.setLocationRelativeTo(null);
  10723.  
  10724. NoteEditorFrame.setVisible(true);
  10725.  
  10726. NoteEditorFrame.setAlwaysOnTop(true);
  10727.  
  10728. NoteEditorFrame.setAlwaysOnTop(false);
  10729.  
  10730. NoteEditorFrame.requestFocus();
  10731. }
  10732.  
  10733. public void EditUser()
  10734. {
  10735. if (EditUserFrame != null)
  10736. {
  10737. CloseAnimation(EditUserFrame);
  10738.  
  10739. EditUserFrame.dispose();
  10740. }
  10741.  
  10742. EditUserFrame = new JFrame();
  10743.  
  10744. EditUserFrame.setResizable(false);
  10745.  
  10746. EditUserFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  10747.  
  10748. EditUserFrame.setResizable(false);
  10749.  
  10750. EditUserFrame.setIconImage(SASIDIcon.getImage());
  10751.  
  10752. EditUserFrame.setTitle("Edit User Files");
  10753.  
  10754. ParentPanel = new JPanel();
  10755.  
  10756. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  10757.  
  10758. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  10759.  
  10760. JLabel BackgroundLabel = new JLabel("Backgrounds", SwingConstants.CENTER);
  10761.  
  10762. BackgroundLabel.setFont(new Font("sans serif", Font.BOLD, 25));
  10763.  
  10764. JPanel LabelPanel = new JPanel();
  10765.  
  10766. LabelPanel.add(BackgroundLabel);
  10767.  
  10768. ParentPanel.add(LabelPanel);
  10769.  
  10770. InitializeBackgroundsList();
  10771.  
  10772. BackgroundSelectionList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  10773.  
  10774. BackgroundListScroll = new JScrollPane(BackgroundSelectionList,
  10775. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  10776. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  10777.  
  10778. BackgroundListScroll.setSize(400,400);
  10779.  
  10780. BackgroundListScroll.setBackground(Vanila);
  10781.  
  10782. ParentPanel.add(BackgroundListScroll);
  10783.  
  10784. JPanel ButtonPanel = new JPanel();
  10785.  
  10786. ButtonPanel.setLayout(new GridLayout(1,3,5,5));
  10787.  
  10788. ButtonPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  10789.  
  10790. AddBackground = new JButton("Add Background");
  10791.  
  10792. ButtonPanel.add(AddBackground);
  10793.  
  10794. AddBackground.setFocusPainted(false);
  10795.  
  10796. AddBackground.setBackground(RegularRed);
  10797.  
  10798. AddBackground.setFont(ButtonFont);
  10799.  
  10800. AddBackground.addActionListener(this);
  10801.  
  10802. OpenBackground = new JButton("Open Background");
  10803.  
  10804. ButtonPanel.add(OpenBackground);
  10805.  
  10806. OpenBackground.setFocusPainted(false);
  10807.  
  10808. OpenBackground.setBackground(RegularRed);
  10809.  
  10810. OpenBackground.setFont(ButtonFont);
  10811.  
  10812. OpenBackground.addActionListener(this);
  10813.  
  10814. DeleteBackground = new JButton("Delete Background");
  10815.  
  10816. ButtonPanel.add(DeleteBackground);
  10817.  
  10818. DeleteBackground.setFocusPainted(false);
  10819.  
  10820. DeleteBackground.setBackground(RegularRed);
  10821.  
  10822. DeleteBackground.setFont(ButtonFont);
  10823.  
  10824. DeleteBackground.addActionListener(this);
  10825.  
  10826. ParentPanel.add(ButtonPanel);
  10827.  
  10828. JLabel MusicLabel = new JLabel("Music", SwingConstants.CENTER);
  10829.  
  10830. MusicLabel.setFont(new Font("sans serif", Font.BOLD, 25));
  10831.  
  10832. JPanel MusicLabelPanel = new JPanel();
  10833.  
  10834. MusicLabelPanel.add(MusicLabel);
  10835.  
  10836. ParentPanel.add(MusicLabelPanel);
  10837.  
  10838. InitializeMusicList();
  10839.  
  10840. MusicSelectionList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  10841.  
  10842. MusicListScroll = new JScrollPane(MusicSelectionList,
  10843. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  10844. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  10845.  
  10846. MusicListScroll.setSize(400,400);
  10847.  
  10848. MusicListScroll.setBackground(Vanila);
  10849.  
  10850. ParentPanel.add(MusicListScroll);
  10851.  
  10852. JPanel BottomButtonPanel = new JPanel();
  10853.  
  10854. BottomButtonPanel.setLayout(new GridLayout(1,3,5,5));
  10855.  
  10856. BottomButtonPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  10857.  
  10858. AddMusic = new JButton("Add Music");
  10859.  
  10860. BottomButtonPanel.add(AddMusic);
  10861.  
  10862. AddMusic.setFocusPainted(false);
  10863.  
  10864. AddMusic.setBackground(RegularRed);
  10865.  
  10866. AddMusic.setFont(ButtonFont);
  10867.  
  10868. AddMusic.addActionListener(this);
  10869.  
  10870. OpenMusic = new JButton("Open Music");
  10871.  
  10872. BottomButtonPanel.add(OpenMusic);
  10873.  
  10874. OpenMusic.setFocusPainted(false);
  10875.  
  10876. OpenMusic.setBackground(RegularRed);
  10877.  
  10878. OpenMusic.setFont(ButtonFont);
  10879.  
  10880. OpenMusic.addActionListener(this);
  10881.  
  10882. DeleteMusic = new JButton("Delete Music");
  10883.  
  10884. BottomButtonPanel.add(DeleteMusic);
  10885.  
  10886. DeleteMusic.setFocusPainted(false);
  10887.  
  10888. DeleteMusic.setBackground(RegularRed);
  10889.  
  10890. DeleteMusic.setFont(ButtonFont);
  10891.  
  10892. DeleteMusic.addActionListener(this);
  10893.  
  10894. ParentPanel.add(BottomButtonPanel);
  10895.  
  10896. EditUserFrame.add(ParentPanel);
  10897.  
  10898. EditUserFrame.pack();
  10899.  
  10900. EditUserFrame.setLocationRelativeTo(null);
  10901.  
  10902. EditUserFrame.setVisible(true);
  10903.  
  10904. EditUserFrame.setAlwaysOnTop(true);
  10905.  
  10906. EditUserFrame.setAlwaysOnTop(false);
  10907.  
  10908. EditUserFrame.requestFocus();
  10909. }
  10910.  
  10911. public void InitMusic(File File)
  10912. {
  10913. File[] SelectedFileDir = File.getParentFile().listFiles();
  10914.  
  10915. ArrayList<File> ValidFiles = new ArrayList<File>();
  10916.  
  10917. for (int i = 0 ; i < SelectedFileDir.length ; i++)
  10918. {
  10919. if (SelectedFileDir[i].toString().endsWith(".mp3"))
  10920. {
  10921. ValidFiles.add(SelectedFileDir[i]);
  10922.  
  10923. if (ValidFiles.get(i).equals(File))
  10924. {
  10925. CurrentMusicIndex = i;
  10926. }
  10927. }
  10928. }
  10929.  
  10930. MusicFiles = ValidFiles.toArray(new File[ValidFiles.size()]);
  10931.  
  10932. Play(MusicFiles[CurrentMusicIndex]);
  10933. }
  10934.  
  10935. public void MACAddress()
  10936. {
  10937. try
  10938. {
  10939. File DotToken = new File("SASIDFiles\\Text\\.token");
  10940.  
  10941. if (!DotToken.exists())
  10942. {
  10943. TrayIcon.displayMessage("Unauthorized", "Sorry, but you are not authorized to use SASID", MessageType.ERROR);
  10944.  
  10945. System.exit(0);
  10946. }
  10947.  
  10948. else
  10949. {
  10950. String DefaultUUID = "511c7c52-40c8-4e5b-8e24-bfb8293e9758"; //when giving the program to others, make sure the .token file is set to this
  10951.  
  10952. BufferedReader BR = new BufferedReader(new FileReader("SASIDFiles\\Text\\.token"));
  10953.  
  10954. String Line = BR.readLine();
  10955.  
  10956. BR.close();
  10957.  
  10958. if (Line.equals(DefaultUUID))
  10959. {
  10960. BufferedWriter BW = new BufferedWriter(new FileWriter("SASIDFiles\\Text\\.token", false));
  10961.  
  10962. BW.write(getMACAddress());
  10963.  
  10964. BW.close();
  10965. }
  10966.  
  10967. else if (!Line.equals(getMACAddress()))
  10968. {
  10969. TrayIcon.displayMessage("Unauthorized", "Sorry, but you are not authorized to use SASID", MessageType.ERROR);
  10970.  
  10971. System.exit(0);
  10972. }
  10973. }
  10974. }
  10975.  
  10976. catch (Exception e)
  10977. {
  10978. LogError(e);
  10979. }
  10980. }
  10981.  
  10982. public String getMACAddress()
  10983. {
  10984. byte[] MAC = null;
  10985.  
  10986. try
  10987. {
  10988. InetAddress address = InetAddress.getLocalHost();
  10989.  
  10990. NetworkInterface NI = NetworkInterface.getByInetAddress(address);
  10991.  
  10992. MAC = NI.getHardwareAddress();
  10993. }
  10994.  
  10995. catch (Exception e)
  10996. {
  10997. LogError(e);
  10998. }
  10999.  
  11000. StringBuilder sb = new StringBuilder();
  11001.  
  11002. for (int i = 0 ; i < MAC.length ; i++)
  11003. {
  11004. sb.append(String.format("%02X%s", MAC[i], (i < MAC.length - 1) ? "-" : ""));
  11005. }
  11006.  
  11007. return sb.toString();
  11008. }
  11009.  
  11010. public void SocialMedia()
  11011. {
  11012. if (MediaFrame != null)
  11013. {
  11014. CloseAnimation(MediaFrame);
  11015.  
  11016. MediaFrame.dispose();
  11017. }
  11018.  
  11019. MediaFrame = new JFrame();
  11020.  
  11021. MediaFrame.setTitle("Media Widget");
  11022.  
  11023. MediaFrame.setAlwaysOnTop(true);
  11024.  
  11025. MediaFrame.setSize(500, 128);
  11026.  
  11027. MediaFrame.setUndecorated(true);
  11028.  
  11029. MediaFrame.addMouseMotionListener(this);
  11030.  
  11031. MediaFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  11032.  
  11033. JLabel MediaLabel = new JLabel(new ImageIcon("SASIDFiles\\Pictures\\SocialMedia.png"));
  11034.  
  11035. MediaFrame.setContentPane(MediaLabel);
  11036.  
  11037. Facebook = new JButton("");
  11038.  
  11039. Facebook.setToolTipText("Facebook");
  11040.  
  11041. Facebook.addActionListener(this);
  11042.  
  11043. Facebook.setBounds(6,8,114,114);
  11044.  
  11045. MediaLabel.add(Facebook);
  11046.  
  11047. Facebook.setFocusPainted(false);
  11048.  
  11049. Facebook.setOpaque(false);
  11050.  
  11051. Facebook.setContentAreaFilled(false);
  11052.  
  11053. Facebook.setBorderPainted(false);
  11054.  
  11055. Twitter = new JButton("");
  11056.  
  11057. Twitter.setToolTipText("Twitter");
  11058.  
  11059. Twitter.addActionListener(this);
  11060.  
  11061. Twitter.setBounds(132,8,115,114);
  11062.  
  11063. MediaLabel.add(Twitter);
  11064.  
  11065. Twitter.setFocusPainted(false);
  11066.  
  11067. Twitter.setOpaque(false);
  11068.  
  11069. Twitter.setContentAreaFilled(false);
  11070.  
  11071. Twitter.setBorderPainted(false);
  11072.  
  11073. Instagram = new JButton("");
  11074.  
  11075. Instagram.setToolTipText("Instagram");
  11076.  
  11077. Instagram.addActionListener(this);
  11078.  
  11079. Instagram.setBounds(258,9,114,110);
  11080.  
  11081. MediaLabel.add(Instagram);
  11082.  
  11083. Instagram.setFocusPainted(false);
  11084.  
  11085. Instagram.setOpaque(false);
  11086.  
  11087. Instagram.setContentAreaFilled(false);
  11088.  
  11089. Instagram.setBorderPainted(false);
  11090.  
  11091. YouTube = new JButton("");
  11092.  
  11093. YouTube.setToolTipText("YouTube");
  11094.  
  11095. YouTube.addActionListener(this);
  11096.  
  11097. YouTube.setBounds(379,7,115,110);
  11098.  
  11099. MediaLabel.add(YouTube);
  11100.  
  11101. YouTube.setFocusPainted(false);
  11102.  
  11103. YouTube.setOpaque(false);
  11104.  
  11105. YouTube.setContentAreaFilled(false);
  11106.  
  11107. YouTube.setBorderPainted(false);
  11108.  
  11109. MediaFrame.pack();
  11110.  
  11111. MediaFrame.setVisible(true);
  11112.  
  11113. MediaFrame.setLocationRelativeTo(null);
  11114.  
  11115. MediaFrame.setResizable(false);
  11116.  
  11117. MediaFrame.setIconImage(SASIDIcon.getImage());
  11118. }
  11119.  
  11120. public void WeatherWidget()
  11121. {
  11122. WeatherStats();
  11123.  
  11124. Location();
  11125.  
  11126. if (WeatherFrame != null)
  11127. {
  11128. CloseAnimation(WeatherFrame);
  11129.  
  11130. WeatherFrame.dispose();
  11131. }
  11132.  
  11133. WeatherFrame = new JFrame();
  11134.  
  11135. WeatherFrame.setTitle("Weather");
  11136.  
  11137. WeatherFrame.setSize(1500,844);
  11138.  
  11139. WeatherFrame.setUndecorated(true);
  11140.  
  11141. WeatherFrame.addWindowListener(this);
  11142.  
  11143. WeatherFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  11144.  
  11145. WeatherLabel = new JLabel(new ImageIcon("SASIDFiles\\Pictures\\Weather.png"));
  11146.  
  11147. WeatherFrame.setContentPane(WeatherLabel);
  11148.  
  11149. WeatherDragLabel = new JLabel();
  11150.  
  11151. WeatherDragLabel.setBounds(0,0,1426,27);
  11152.  
  11153. WeatherDragLabel.addMouseMotionListener(this);
  11154.  
  11155. WeatherLabel.add(WeatherDragLabel);
  11156.  
  11157. MinimizeWeather = new JButton("");
  11158.  
  11159. MinimizeWeather.setToolTipText("Minimize");
  11160.  
  11161. MinimizeWeather.addActionListener(this);
  11162.  
  11163. MinimizeWeather.addMouseListener(this);
  11164.  
  11165. MinimizeWeather.setBounds(1425,10,41,23);
  11166.  
  11167. ImageIcon Minimize = new ImageIcon("SASIDFiles\\Pictures\\MinimizeWeather1.png");
  11168.  
  11169. MinimizeWeather.setIcon(Minimize);
  11170.  
  11171. WeatherLabel.add(MinimizeWeather);
  11172.  
  11173. MinimizeWeather.setFocusPainted(false);
  11174.  
  11175. MinimizeWeather.setOpaque(false);
  11176.  
  11177. MinimizeWeather.setContentAreaFilled(false);
  11178.  
  11179. MinimizeWeather.setBorderPainted(false);
  11180.  
  11181. CloseWeather = new JButton("");
  11182.  
  11183. CloseWeather.setToolTipText("Close");
  11184.  
  11185. CloseWeather.addActionListener(this);
  11186.  
  11187. CloseWeather.addMouseListener(this);
  11188.  
  11189. CloseWeather.setBounds(1468,4,27,32);
  11190.  
  11191. ImageIcon Close = new ImageIcon("SASIDFiles\\Pictures\\CloseWeather1.png");
  11192.  
  11193. CloseWeather.setIcon(Close);
  11194.  
  11195. WeatherLabel.add(CloseWeather);
  11196.  
  11197. CloseWeather.setFocusPainted(false);
  11198.  
  11199. CloseWeather.setOpaque(false);
  11200.  
  11201. CloseWeather.setContentAreaFilled(false);
  11202.  
  11203. CloseWeather.setBorderPainted(false);
  11204.  
  11205. CurrentTimeLabel = new JLabel();
  11206.  
  11207. CurrentTimeLabel.setForeground(Vanila);
  11208.  
  11209. CurrentTimeLabel.setFont(WeatherFontBig);
  11210.  
  11211. CurrentTimeLabel.setBounds(48,85,798,37);
  11212.  
  11213. CurrentTimeLabel.setText(WeatherTime());
  11214.  
  11215. WeatherLabel.add(CurrentTimeLabel, SwingConstants.CENTER);
  11216.  
  11217. LocationLabel = new JLabel();
  11218.  
  11219. LocationLabel.setForeground(Vanila);
  11220.  
  11221. LocationLabel.setFont(WeatherFontBig);
  11222.  
  11223. LocationLabel.setBounds(235,129,293,37);
  11224.  
  11225. LocationLabel.setText(UserCity + ", " + UserStateAbr);
  11226.  
  11227. WeatherLabel.add(LocationLabel, SwingConstants.CENTER);
  11228.  
  11229. CurrentWeatherIconLabel = new JLabel(new ImageIcon("SASIDFiles\\Pictures\\" + WeatherIcon + ".png"));
  11230.  
  11231. CurrentWeatherIconLabel.setBounds(49, 192, 102, 88);
  11232.  
  11233. WeatherLabel.add(CurrentWeatherIconLabel);
  11234.  
  11235. CurrentWeatherLabel = new JLabel();
  11236.  
  11237. CurrentWeatherLabel.setForeground(Vanila);
  11238.  
  11239. CurrentWeatherLabel.setFont(WeatherFontBig);
  11240.  
  11241. CurrentWeatherLabel.setBounds(49,304,361,33);
  11242.  
  11243. CurrentWeatherLabel.setText(CapsFirst(WeatherCondition));
  11244.  
  11245. WeatherLabel.add(CurrentWeatherLabel);
  11246.  
  11247. TemperatureLabel = new JLabel();
  11248.  
  11249. TemperatureLabel.setForeground(Vanila);
  11250.  
  11251. TemperatureLabel.setFont(WeatherFontBig);
  11252.  
  11253. TemperatureLabel.setBounds(49,434,355,46);
  11254.  
  11255. TemperatureLabel.setText("Temperature: " + Temperature + "F");
  11256.  
  11257. WeatherLabel.add(TemperatureLabel);
  11258.  
  11259. UVIndexLabel = new JLabel();
  11260.  
  11261. UVIndexLabel.setForeground(Vanila);
  11262.  
  11263. UVIndexLabel.setFont(WeatherFontBig);
  11264.  
  11265. UVIndexLabel.setBounds(56,500,210,50);
  11266.  
  11267. UVIndexLabel.setText("UV Index: " + UVIndex);
  11268.  
  11269. WeatherLabel.add(UVIndexLabel);
  11270.  
  11271. CloudCoverLabel = new JLabel();
  11272.  
  11273. CloudCoverLabel.setForeground(Vanila);
  11274.  
  11275. CloudCoverLabel.setFont(WeatherFontBig);
  11276.  
  11277. CloudCoverLabel.setBounds(56,555,350,50);
  11278.  
  11279. CloudCoverLabel.setText("Cloud Cover: " + CloudCover);
  11280.  
  11281. WeatherLabel.add(CloudCoverLabel);
  11282.  
  11283. WindSpeedLabel = new JLabel();
  11284.  
  11285. WindSpeedLabel.setForeground(Vanila);
  11286.  
  11287. WindSpeedLabel.setFont(WeatherFontBig);
  11288.  
  11289. WindSpeedLabel.setBounds(49,671,404,48);
  11290.  
  11291. WindSpeedLabel.setText("Wind Speed: " + WindSpeed + "mph");
  11292.  
  11293. WeatherLabel.add(WindSpeedLabel);
  11294.  
  11295. WindDirectionLabel = new JLabel();
  11296.  
  11297. WindDirectionLabel.setForeground(Vanila);
  11298.  
  11299. WindDirectionLabel.setFont(WeatherFontBig);
  11300.  
  11301. WindDirectionLabel.setBounds(49,739,559,44);
  11302.  
  11303. WindDirectionLabel.setText("Wind Direction: " + WindDirection + ", " + WindDirection());
  11304.  
  11305. WeatherLabel.add(WindDirectionLabel);
  11306.  
  11307. HumidityLabel = new JLabel();
  11308.  
  11309. HumidityLabel.setForeground(Vanila);
  11310.  
  11311. HumidityLabel.setFont(WeatherFontBig);
  11312.  
  11313. HumidityLabel.setBounds(1134,370,330,47);
  11314.  
  11315. HumidityLabel.setText("Humidity: " + Humidity + "%");
  11316.  
  11317. WeatherLabel.add(HumidityLabel,SwingConstants.CENTER);
  11318.  
  11319. PressureLabel = new JLabel();
  11320.  
  11321. PressureLabel.setForeground(Vanila);
  11322.  
  11323. PressureLabel.setFont(WeatherFontBig);
  11324.  
  11325. PressureLabel.setBounds(1134,438,390,47);
  11326.  
  11327. PressureLabel.setText("Pressure: " + Double.parseDouble(Pressure) / 1000 + "atm");
  11328.  
  11329. WeatherLabel.add(PressureLabel, SwingConstants.CENTER);
  11330.  
  11331. VisibilityLabel = new JLabel();
  11332.  
  11333. VisibilityLabel.setForeground(Vanila);
  11334.  
  11335. VisibilityLabel.setFont(WeatherFontBig);
  11336.  
  11337. VisibilityLabel.setBounds(1134,510,330,47);
  11338.  
  11339. VisibilityLabel.setText("Visibility: " + Double.parseDouble(Visibility) / 1000 + "mi");
  11340.  
  11341. WeatherLabel.add(VisibilityLabel, SwingConstants.CENTER);
  11342.  
  11343. SunriseLabel = new JLabel();
  11344.  
  11345. SunriseLabel.setForeground(Vanila);
  11346.  
  11347. SunriseLabel.setFont(WeatherFontBig);
  11348.  
  11349. SunriseLabel.setBounds(1132,740,145,47);
  11350.  
  11351. SunriseLabel.setText(Sunrise + "am");
  11352.  
  11353. WeatherLabel.add(SunriseLabel, SwingConstants.CENTER);
  11354.  
  11355. SunsetLabel = new JLabel();
  11356.  
  11357. SunsetLabel.setForeground(Vanila);
  11358.  
  11359. SunsetLabel.setFont(WeatherFontBig);
  11360.  
  11361. SunsetLabel.setBounds(1292,740,145,47);
  11362.  
  11363. SunsetLabel.setText(Sunset + "pm");
  11364.  
  11365. WeatherLabel.add(SunsetLabel, SwingConstants.CENTER);
  11366.  
  11367. WeatherFrame.setVisible(true);
  11368.  
  11369. WeatherFrame.setLocationRelativeTo(null);
  11370.  
  11371. WeatherFrame.setAlwaysOnTop(true);
  11372.  
  11373. WeatherFrame.setAlwaysOnTop(false);
  11374.  
  11375. WeatherFrame.setResizable(false);
  11376.  
  11377. WeatherFrame.setIconImage(new ImageIcon("SASIDFiles\\Pictures\\WeatherIcon.png").getImage());
  11378.  
  11379. UpdateClock = true;
  11380.  
  11381. RefreshClock();
  11382.  
  11383. UpdateWeather = true;
  11384.  
  11385. RefreshWeather();
  11386. }
  11387.  
  11388. public void WeatherStats()
  11389. {
  11390. try
  11391. {
  11392. Location();
  11393.  
  11394. SunriseSunset();
  11395.  
  11396. String DarkString = "https://api.darksky.net/forecast/3fc1a7e3f22eb67764c7dc222144bbe0/" + UserLat + "," + UserLon + "?exclude=currently,minutely,daily,alerts,flags";
  11397.  
  11398. URL URL = new URL(DarkString);
  11399.  
  11400. BufferedReader WeatherReader = new BufferedReader(new InputStreamReader(URL.openStream()));
  11401.  
  11402. String PureJSON = WeatherReader.readLine().split("}")[0] + "}]}}";
  11403.  
  11404. PureJSON = PureJSON.split("data\":")[1].replace("[", "");
  11405.  
  11406. PureJSON = PureJSON.split("},")[0];
  11407.  
  11408. PureJSON = PureJSON.replace("}", "").replace("{", "").replace("]", "").replace("\"","");
  11409.  
  11410. String[] parts = PureJSON.split(",");
  11411.  
  11412. for (int i = 0 ; i < parts.length ; i++)
  11413. {
  11414. if (parts[i].contains("temperature") && !parts[i].contains("apparent"))
  11415. {
  11416. Temperature = parts[i].replace("temperature:", "");
  11417. }
  11418.  
  11419. else if (parts[i].contains("summary"))
  11420. {
  11421. WeatherSummary = parts[i].replace("summary:", "");
  11422. }
  11423.  
  11424. else if (parts[i].contains("pressure"))
  11425. {
  11426. Pressure = parts[i].replace("pressure:", "");
  11427.  
  11428. Pressure = Pressure.substring(0, Math.min(Pressure.length(), 4));
  11429. }
  11430.  
  11431. else if (parts[i].contains("humidity"))
  11432. {
  11433. Humidity = parts[i].replace("humidity:", "").replace("0.","");
  11434. }
  11435.  
  11436. else if (parts[i].contains("cloudCover"))
  11437. {
  11438. CloudCover = parts[i].replace("cloudCover:", "").replace("0.", "") + "%";
  11439. }
  11440.  
  11441. else if (parts[i].contains("uvIndex"))
  11442. {
  11443. UVIndex = parts[i].replace("uvIndex:", "");
  11444. }
  11445. }
  11446. }
  11447.  
  11448. catch (Exception e)
  11449. {
  11450. LogError(e);
  11451. }
  11452. }
  11453.  
  11454. public String[] CombineArrays(String[] a, String[] b)
  11455. {
  11456. int length = a.length + b.length;
  11457.  
  11458. String[] result = new String[length];
  11459.  
  11460. System.arraycopy(a, 0, result, 0, a.length);
  11461.  
  11462. System.arraycopy(b, 0, result, a.length, b.length);
  11463.  
  11464. return result;
  11465. }
  11466.  
  11467. public String CapsFirst(String Word)
  11468. {
  11469. StringBuilder SB = new StringBuilder(Word.length());
  11470.  
  11471. String[] Words = Word.split("\\ ");
  11472.  
  11473. for (int i = 0 ; i < Words.length ; i++)
  11474. {
  11475. SB.append(Character.toUpperCase(Words[i].charAt(0))).append(Words[i].substring(1)).append(" ");
  11476. }
  11477.  
  11478. return SB.toString();
  11479. }
  11480.  
  11481. public String WindDirection()
  11482. {
  11483. double w = Double.parseDouble(WindDirection);
  11484.  
  11485. if (w == 0)
  11486. {
  11487. return "N";
  11488. }
  11489.  
  11490. else if (w == 90)
  11491. {
  11492. return "E";
  11493. }
  11494.  
  11495. else if (w == 180)
  11496. {
  11497. return "S";
  11498. }
  11499.  
  11500. else if (w == 270)
  11501. {
  11502. return "W";
  11503. }
  11504.  
  11505. else if (w > 0 && w < 90)
  11506. {
  11507. return "NE";
  11508. }
  11509.  
  11510. else if (w > 90 && w < 180)
  11511. {
  11512. return "SE";
  11513. }
  11514.  
  11515. else if (w > 180 && w < 270)
  11516. {
  11517. return "SW";
  11518. }
  11519.  
  11520. else if (w > 270 && w < 360)
  11521. {
  11522. return "NW";
  11523. }
  11524.  
  11525. return "";
  11526. }
  11527.  
  11528. public void RefreshWeather()
  11529. {
  11530. Thread WeatherThread = new Thread()
  11531. {
  11532. @Override
  11533. public void run()
  11534. {
  11535. try
  11536. {
  11537. while (UpdateWeather)
  11538. {
  11539. Thread.sleep(1800000);
  11540.  
  11541. LocationLabel.setText(UserCity + ", " + UserStateAbr);
  11542.  
  11543. CurrentWeatherLabel.setText(CapsFirst(WeatherCondition));
  11544.  
  11545. TemperatureLabel.setText("Temperature: " + Temperature + "F");
  11546.  
  11547. UVIndexLabel.setText("UV Index: " + UVIndex);
  11548.  
  11549. CloudCoverLabel.setText("Cloud Cover: " + CloudCover);
  11550.  
  11551. WindSpeedLabel.setText("Wind Speed: " + WindSpeed + "mph");
  11552.  
  11553. WindDirectionLabel.setText("Wind Direction: " + WindDirection + ", " + WindDirection());
  11554.  
  11555. HumidityLabel.setText("Humidity: " + Humidity + "%");
  11556.  
  11557. PressureLabel.setText("Pressure: " + Double.parseDouble(Pressure) / 1000 + "atm");
  11558.  
  11559. VisibilityLabel.setText("Visibility: " + Double.parseDouble(Visibility) / 1000 + "mi");
  11560.  
  11561. SunriseLabel.setText(Sunrise + "am");
  11562.  
  11563. SunsetLabel.setText(Sunset + "pm");
  11564. }
  11565. }
  11566.  
  11567. catch (Exception e)
  11568. {
  11569. LogError(e);
  11570. }
  11571. }
  11572. };
  11573.  
  11574. WeatherThread.start();
  11575. }
  11576.  
  11577. public void RefreshClock()
  11578. {
  11579. Thread TimeThread = new Thread()
  11580. {
  11581. @Override
  11582. public void run()
  11583. {
  11584. try
  11585. {
  11586. while (UpdateClock)
  11587. {
  11588. Thread.sleep(1000);
  11589.  
  11590. CurrentTimeLabel.setText(WeatherTime());
  11591. }
  11592. }
  11593.  
  11594. catch (Exception e)
  11595. {
  11596. LogError(e);
  11597. }
  11598. }
  11599. };
  11600.  
  11601. TimeThread.start();
  11602. }
  11603.  
  11604. public void Tray()
  11605. {
  11606. if (!SystemTray.isSupported())
  11607. {
  11608. println("SystemTray is not supported");
  11609. }
  11610.  
  11611. MenuItem YouTube = new MenuItem("YouTube");
  11612.  
  11613. YouTube.addActionListener(new ActionListener()
  11614. {
  11615. @Override
  11616. public void actionPerformed(ActionEvent e)
  11617. {
  11618. InternetConnect("https://www.youtube.com");
  11619. }
  11620. });
  11621.  
  11622. MenuItem Weather = new MenuItem("Weather");
  11623.  
  11624. Weather.addActionListener(new ActionListener()
  11625. {
  11626. @Override
  11627. public void actionPerformed(ActionEvent e)
  11628. {
  11629. WeatherWidget();
  11630. }
  11631. });
  11632.  
  11633. MenuItem Music = new MenuItem("Music");
  11634.  
  11635. Music.addActionListener(new ActionListener()
  11636. {
  11637. @Override
  11638. public void actionPerformed(ActionEvent e)
  11639. {
  11640. mp3(null);
  11641. }
  11642. });
  11643.  
  11644. MenuItem Show = new MenuItem("Show Console");
  11645.  
  11646. Show.addActionListener(new ActionListener()
  11647. {
  11648. @Override
  11649. public void actionPerformed(ActionEvent e)
  11650. {
  11651. if (ConsoleFrame != null)
  11652. {
  11653. ConsoleFrame.setVisible(true);
  11654.  
  11655. ConsoleFrame.setLocationRelativeTo(null);
  11656. }
  11657. }
  11658. });
  11659.  
  11660. HideOnClose = new CheckboxMenuItem("Hide on close");
  11661.  
  11662. HideOnClose.setState(false);
  11663.  
  11664. MenuItem Exit = new MenuItem("Exit");
  11665.  
  11666. Exit.addActionListener(new ActionListener()
  11667. {
  11668. @Override
  11669. public void actionPerformed(ActionEvent e)
  11670. {
  11671. Tray.remove(TrayIcon);
  11672.  
  11673. System.exit(0);
  11674. }
  11675. });
  11676.  
  11677. Popup.add(YouTube);
  11678.  
  11679. Popup.addSeparator();
  11680.  
  11681. Popup.add(Weather);
  11682.  
  11683. Popup.addSeparator();
  11684.  
  11685. Popup.add(Music);
  11686.  
  11687. Popup.addSeparator();
  11688.  
  11689. Popup.add(Show);
  11690.  
  11691. Popup.addSeparator();
  11692.  
  11693. Popup.add(HideOnClose);
  11694.  
  11695. Popup.addSeparator();
  11696.  
  11697. Popup.add(Exit);
  11698.  
  11699. TrayIcon.setPopupMenu(Popup);
  11700.  
  11701. try
  11702. {
  11703. Tray.add(TrayIcon);
  11704. }
  11705.  
  11706. catch (Exception e)
  11707. {
  11708. LogError(e);
  11709. }
  11710. }
  11711.  
  11712. @Override
  11713. public void windowActivated(WindowEvent e)
  11714. {
  11715.  
  11716. }
  11717.  
  11718. @Override
  11719. public void windowClosed(WindowEvent e)
  11720. {
  11721.  
  11722. }
  11723.  
  11724. @Override
  11725. public void windowClosing(WindowEvent e)
  11726. {
  11727.  
  11728. }
  11729.  
  11730. @Override
  11731. public void windowDeactivated(WindowEvent e)
  11732. {
  11733.  
  11734. }
  11735.  
  11736. @Override
  11737. public void windowDeiconified(WindowEvent e)
  11738. {
  11739. Object Source = e.getSource();
  11740.  
  11741. if (Source == ConsoleFrame)
  11742. {
  11743. StopMusic();
  11744.  
  11745. ConsoleFrame.setLocation(RestoreX, RestoreY);
  11746.  
  11747. ConsoleFrame.setVisible(true);
  11748. }
  11749.  
  11750. else if (Source == WeatherFrame)
  11751. {
  11752. WeatherFrame.setLocation(WeatherRestoreX, WeatherRestoreY);
  11753.  
  11754. WeatherFrame.setVisible(true);
  11755. }
  11756. }
  11757.  
  11758. @Override
  11759. public void windowIconified(WindowEvent e)
  11760. {
  11761. Object source = e.getSource();
  11762.  
  11763. if (source == ConsoleFrame)
  11764. {
  11765. Iconified();
  11766. }
  11767. }
  11768.  
  11769. @Override
  11770. public void windowOpened(WindowEvent e)
  11771. {
  11772.  
  11773. }
  11774.  
  11775. public void SunriseSunset()
  11776. {
  11777. try
  11778. {
  11779. Location();
  11780.  
  11781. String Key = "2d790dd0766f1da62af488f101380c75";
  11782.  
  11783. String OpenString = "https://api.openweathermap.org/data/2.5/weather?q=" + UserCity + "&appid=" + Key + "&units=imperial";
  11784.  
  11785. URL URL = new URL(OpenString);
  11786.  
  11787. BufferedReader WeatherReader = new BufferedReader(new InputStreamReader(URL.openStream()));
  11788.  
  11789. String[] Fields = {"",""};
  11790.  
  11791. String Line;
  11792.  
  11793. while ((Line = WeatherReader.readLine()) != null)
  11794. {
  11795. String[] LineArray = Line.replace("{", "").replace("}", "")
  11796. .replace(":", "").replace("\"", "").replace("[", "")
  11797. .replace("]", "").replace(":", "").split(",");
  11798.  
  11799. Fields = CombineArrays(Fields, LineArray);
  11800. }
  11801.  
  11802. WeatherReader.close();
  11803.  
  11804. for (int i = 0 ; i < Fields.length ; i++)
  11805. {
  11806. if (Fields[i].contains("sunrise"))
  11807. {
  11808. Sunrise = Fields[i].replaceAll("[^\\d.]", "");
  11809. }
  11810.  
  11811. else if (Fields[i].contains("sunset"))
  11812. {
  11813. Sunset = Fields[i].replaceAll("[^\\d.]", "");
  11814. }
  11815.  
  11816. else if (Fields[i].contains("icon"))
  11817. {
  11818. WeatherIcon = Fields[i].replace("icon", "");
  11819. }
  11820.  
  11821. else if (Fields[i].contains("speed"))
  11822. {
  11823. WindSpeed = Fields[i].replaceAll("[^\\d.]", "");
  11824. }
  11825.  
  11826. else if (Fields[i].contains("deg"))
  11827. {
  11828. WindDirection = Fields[i].replaceAll("[^\\d.]", "");
  11829. }
  11830.  
  11831. else if (Fields[i].contains("description"))
  11832. {
  11833. WeatherCondition = Fields[i].replace("description", "");
  11834. }
  11835.  
  11836. else if (Fields[i].contains("visibility"))
  11837. {
  11838. Visibility = Fields[i].replaceAll("[^\\d.]", "");
  11839. }
  11840. }
  11841.  
  11842. SimpleDateFormat dateFormatter = new SimpleDateFormat("h:mm");
  11843.  
  11844. Date SunriseTime = new Date ((long) Integer.parseInt(Sunrise) * 1000);
  11845. Sunrise = dateFormatter.format(SunriseTime);
  11846.  
  11847. Date SunsetTime = new Date ((long) Integer.parseInt(Sunset) * 1000);
  11848. Sunset = dateFormatter.format(SunsetTime);
  11849.  
  11850. Date Time = new Date();
  11851.  
  11852. if (Time.getTime() > SunsetTime.getTime())
  11853. {
  11854. WeatherIcon = WeatherIcon.replace("d", "n");
  11855. }
  11856. }
  11857.  
  11858. catch (Exception e)
  11859. {
  11860. LogError(e);
  11861. }
  11862. }
  11863.  
  11864. public void Debug()
  11865. {
  11866. try
  11867. {
  11868. if (DebugFrame != null)
  11869. {
  11870. CloseAnimation(DebugFrame);
  11871.  
  11872. DebugFrame.dispose();
  11873. }
  11874.  
  11875. DebugFrame = new JFrame();
  11876.  
  11877. DebugFrame.setTitle("Debug Menu");
  11878.  
  11879. DebugFrame.setSize(1350,900);
  11880.  
  11881. DebugFrame.setUndecorated(true);
  11882.  
  11883. DebugFrame.addWindowListener(this);
  11884.  
  11885. DebugFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  11886.  
  11887. DebugLabel = new JLabel(new ImageIcon("SASIDFiles\\Pictures\\DebugBackground.png"));
  11888.  
  11889. DebugFrame.setContentPane(DebugLabel);
  11890.  
  11891. DebugDragLabel = new JLabel();
  11892.  
  11893. DebugDragLabel.setBounds(0,0,1350,27);
  11894.  
  11895. DebugDragLabel.addMouseMotionListener(this);
  11896.  
  11897. DebugDragLabel.setOpaque(true);
  11898.  
  11899. DebugDragLabel.setBackground(new Color(26,32,51));
  11900.  
  11901. DebugLabel.add(DebugDragLabel);
  11902.  
  11903. CloseDebug = new JButton("");
  11904.  
  11905. CloseDebug.setToolTipText("Close");
  11906.  
  11907. CloseDebug.addActionListener(this);
  11908.  
  11909. CloseDebug.addMouseListener(this);
  11910.  
  11911. CloseDebug.setBounds(1323, 4, 22, 20);
  11912.  
  11913. ImageIcon exit = new ImageIcon("SASIDFiles\\Pictures\\Close1.png");
  11914.  
  11915. CloseDebug.setIcon(exit);
  11916.  
  11917. DebugDragLabel.add(CloseDebug);
  11918.  
  11919. CloseDebug.setFocusPainted(false);
  11920.  
  11921. CloseDebug.setOpaque(false);
  11922.  
  11923. CloseDebug.setContentAreaFilled(false);
  11924.  
  11925. CloseDebug.setBorderPainted(false);
  11926.  
  11927. DisplayLabel = new JLabel("",SwingConstants.LEFT);
  11928.  
  11929. DisplayLabel.setFont(new Font("Segoe UI Black", Font.BOLD, 25));
  11930.  
  11931. DisplayLabel.setForeground(Vanila);
  11932.  
  11933. DecimalFormat GigaFormater = new DecimalFormat("##.###");
  11934.  
  11935. double GigaBytes = ( (double) Runtime.getRuntime().freeMemory()) / 1024 / 1024 / 1024;
  11936.  
  11937. InetAddress address = InetAddress.getLocalHost();
  11938.  
  11939. NetworkInterface NI = NetworkInterface.getByInetAddress(address);
  11940.  
  11941. DisplayLabel.setText("<html>" + "Time requested: " + WeatherTime() + "<br/>ISP: " + UserISP + "<br/>City: " + UserCity + "<br/>State: " + UserState + "<br/>Country: " + UserCountry
  11942. + "<br/>Latitude: " + UserLat + " Degrees N<br/>Longitude: " + UserLon + " Degrees W<br/>Latency: " + Latency() + " ms<br/>Google Reachable: "
  11943. + SiteReachable("https:////www.google.com") + "<br/>YouTube Reachable: " + SiteReachable("https:////www.youtube.com") + "<br/>Apple Reachable: "
  11944. + SiteReachable("https:////www.apple.com//") + "<br/>Microsoft Reachable: " + SiteReachable("https:////www.microsoft.com//en-us//")
  11945. + "<br/>User Name: " + CUsername + "<br/>Computer Name: " + ComputerName() + "<br/>Available Cores: " + Runtime.getRuntime().availableProcessors()
  11946. + "<br/>Available Memory: " + Runtime.getRuntime().freeMemory() + " Bytes [" + GigaFormater.format(GigaBytes) + " GigaBytes]<br/>Operating System: "
  11947. + OS + "<br/>Java Version: " + System.getProperty("java.version") + "<br/>Network Interface Name: " + NI.getName() + "<br/>NI Display Name: "
  11948. + NI.getDisplayName() + "<br/>Network MTU: " + NI.getMTU() + "<br/>Host Address: " + address.getHostAddress() + "<br/>Local Host Address: "
  11949. + address.getLocalHost() + "<br/>Loopback Address: " + address.getLoopbackAddress() + "</html>");
  11950.  
  11951. DisplayLabel.setFocusable(true);
  11952.  
  11953. DisplayLabel.setToolTipText("Click to copy stats to clipboard");
  11954.  
  11955. DisplayLabel.addMouseListener(this);
  11956.  
  11957. DebugLabel.add(DisplayLabel);
  11958.  
  11959. DisplayLabel.setBounds(50, 50, 1300, 850);
  11960.  
  11961. DebugFrame.setVisible(true);
  11962.  
  11963. DebugFrame.setLocationRelativeTo(null);
  11964.  
  11965. DebugFrame.setAlwaysOnTop(true);
  11966.  
  11967. DebugFrame.setAlwaysOnTop(false);
  11968.  
  11969. DebugFrame.setResizable(false);
  11970.  
  11971. DebugFrame.setIconImage(new ImageIcon("SASIDFiles\\Pictures\\Debug.png").getImage());
  11972. }
  11973.  
  11974. catch (Exception e)
  11975. {
  11976. LogError(e);
  11977. }
  11978. }
  11979.  
  11980. public int Latency()
  11981. {
  11982. Socket Sock = new Socket();
  11983.  
  11984. SocketAddress Address = new InetSocketAddress("www.google.com", 80);
  11985.  
  11986. int Timeout = 2000;
  11987.  
  11988. long start = System.currentTimeMillis();
  11989.  
  11990. try
  11991. {
  11992. Sock.connect(Address, Timeout);
  11993. }
  11994.  
  11995. catch (Exception e)
  11996. {
  11997. LogError(e);
  11998. }
  11999.  
  12000. long stop = System.currentTimeMillis();
  12001.  
  12002. int Latency = (int) (stop - start);
  12003.  
  12004. try
  12005. {
  12006. Sock.close();
  12007. }
  12008.  
  12009. catch (Exception e)
  12010. {
  12011. LogError(e);
  12012. }
  12013.  
  12014. return Latency;
  12015. }
  12016.  
  12017. public boolean SiteReachable(String URL)
  12018. {
  12019. Process Ping;
  12020.  
  12021. try
  12022. {
  12023. Ping = java.lang.Runtime.getRuntime().exec("ping -n 1 " + URL);
  12024.  
  12025. int ReturnValue = Ping.waitFor();
  12026.  
  12027. if (ReturnValue == 0)
  12028. {
  12029. return false;
  12030. }
  12031. }
  12032.  
  12033. catch (Exception e)
  12034. {
  12035. LogError(e);
  12036. }
  12037.  
  12038. return true;
  12039. }
  12040.  
  12041. public String NumberFormat(String Format)
  12042. {
  12043. StringBuilder builder = new StringBuilder(Format.length() + "-".length() * (Format.length()/3)+1);
  12044.  
  12045. int index = 0;
  12046.  
  12047. String prefix = "";
  12048.  
  12049. while (index < Format.length())
  12050. {
  12051. builder.append(prefix);
  12052.  
  12053. prefix = "-";
  12054.  
  12055. builder.append(Format.substring(index, Math.min(index + 3, Format.length())));
  12056.  
  12057. index += 3;
  12058. }
  12059.  
  12060. return builder.toString();
  12061. }
  12062.  
  12063. public void Hangman()
  12064. {
  12065. SwingFeel(ConsoleFrame);
  12066.  
  12067. if (HangmanFrame != null)
  12068. {
  12069. CloseAnimation(HangmanFrame);
  12070.  
  12071. HangmanFrame.dispose();
  12072. }
  12073.  
  12074. HangmanFrame = new JFrame();
  12075.  
  12076. HangmanFrame.setTitle("Hangman");
  12077.  
  12078. HangmanFrame.setResizable(false);
  12079.  
  12080. HangmanFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  12081.  
  12082. ImageIcon img = new ImageIcon("SASIDFiles\\Pictures\\hangman8.png");
  12083.  
  12084. HangmanFrame.setIconImage(img.getImage());
  12085.  
  12086. ParentPanel = new JPanel();
  12087.  
  12088. ParentPanel.setLayout(new BoxLayout(ParentPanel,BoxLayout.Y_AXIS));
  12089.  
  12090. HangmanLabel = new JLabel("SASID Hangman");
  12091.  
  12092. HangmanLabel.setFont(new Font("sans serif", Font.BOLD, 30));
  12093.  
  12094. JPanel LabelPanel = new JPanel();
  12095.  
  12096. LabelPanel.add(HangmanLabel, SwingConstants.CENTER);
  12097.  
  12098. LabelPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  12099.  
  12100. ParentPanel.add(LabelPanel);
  12101.  
  12102. HangmanImageLabel = new JLabel();
  12103.  
  12104. HangmanImageLabel.setIcon(new ImageIcon("SASIDFiles\\Pictures\\hangman.png"));
  12105.  
  12106. JPanel ImagePanel = new JPanel();
  12107.  
  12108. ImagePanel.add(HangmanImageLabel, SwingConstants.CENTER);
  12109.  
  12110. ImagePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  12111.  
  12112. ParentPanel.add(ImagePanel);
  12113.  
  12114. JPanel ButtonPanel = new JPanel();
  12115.  
  12116. GridLayout ButtonLayout = new GridLayout(2,13,5,5);
  12117.  
  12118. ButtonPanel.setLayout(ButtonLayout);
  12119.  
  12120. HangmanA = new JButton("A");
  12121.  
  12122. HangmanA.setPreferredSize(new Dimension(60, 60));
  12123.  
  12124. HangmanA.setFocusPainted(false);
  12125.  
  12126. HangmanA.setBackground(Vanila);
  12127.  
  12128. HangmanA.setFont(ButtonFont);
  12129.  
  12130. HangmanA.addActionListener(this);
  12131.  
  12132. ButtonPanel.add(HangmanA);
  12133.  
  12134. HangmanB = new JButton("B");
  12135.  
  12136. HangmanB.setPreferredSize(new Dimension(60, 60));
  12137.  
  12138. HangmanB.setFocusPainted(false);
  12139.  
  12140. HangmanB.setBackground(Vanila);
  12141.  
  12142. HangmanB.setFont(ButtonFont);
  12143.  
  12144. HangmanB.addActionListener(this);
  12145.  
  12146. ButtonPanel.add(HangmanB);
  12147.  
  12148. HangmanC = new JButton("C");
  12149.  
  12150. HangmanC.setPreferredSize(new Dimension(60, 60));
  12151.  
  12152. HangmanC.setFocusPainted(false);
  12153.  
  12154. HangmanC.setBackground(Vanila);
  12155.  
  12156. HangmanC.setFont(ButtonFont);
  12157.  
  12158. HangmanC.addActionListener(this);
  12159.  
  12160. ButtonPanel.add(HangmanC);
  12161.  
  12162. HangmanD = new JButton("D");
  12163.  
  12164. HangmanD.setPreferredSize(new Dimension(60, 60));
  12165.  
  12166. HangmanD.setFocusPainted(false);
  12167.  
  12168. HangmanD.setBackground(Vanila);
  12169.  
  12170. HangmanD.setFont(ButtonFont);
  12171.  
  12172. HangmanD.addActionListener(this);
  12173.  
  12174. ButtonPanel.add(HangmanD);
  12175.  
  12176. HangmanE = new JButton("E");
  12177.  
  12178. HangmanE.setPreferredSize(new Dimension(60, 60));
  12179.  
  12180. HangmanE.setFocusPainted(false);
  12181.  
  12182. HangmanE.setBackground(Vanila);
  12183.  
  12184. HangmanE.setFont(ButtonFont);
  12185.  
  12186. HangmanE.addActionListener(this);
  12187.  
  12188. ButtonPanel.add(HangmanE);
  12189.  
  12190. HangmanF = new JButton("F");
  12191.  
  12192. HangmanF.setPreferredSize(new Dimension(60, 60));
  12193.  
  12194. HangmanF.setFocusPainted(false);
  12195.  
  12196. HangmanF.setBackground(Vanila);
  12197.  
  12198. HangmanF.setFont(ButtonFont);
  12199.  
  12200. HangmanF.addActionListener(this);
  12201.  
  12202. ButtonPanel.add(HangmanF);
  12203.  
  12204. HangmanG = new JButton("G");
  12205.  
  12206. HangmanG.setPreferredSize(new Dimension(60, 60));
  12207.  
  12208. HangmanG.setFocusPainted(false);
  12209.  
  12210. HangmanG.setBackground(Vanila);
  12211.  
  12212. HangmanG.setFont(ButtonFont);
  12213.  
  12214. HangmanG.addActionListener(this);
  12215.  
  12216. ButtonPanel.add(HangmanG);
  12217.  
  12218. HangmanH = new JButton("H");
  12219.  
  12220. HangmanH.setPreferredSize(new Dimension(60, 60));
  12221.  
  12222. HangmanH.setFocusPainted(false);
  12223.  
  12224. HangmanH.setBackground(Vanila);
  12225.  
  12226. HangmanH.setFont(ButtonFont);
  12227.  
  12228. HangmanH.addActionListener(this);
  12229.  
  12230. ButtonPanel.add(HangmanH);
  12231.  
  12232. HangmanI = new JButton("I");
  12233.  
  12234. HangmanI.setPreferredSize(new Dimension(60, 60));
  12235.  
  12236. HangmanI.setFocusPainted(false);
  12237.  
  12238. HangmanI.setBackground(Vanila);
  12239.  
  12240. HangmanI.setFont(ButtonFont);
  12241.  
  12242. HangmanI.addActionListener(this);
  12243.  
  12244. ButtonPanel.add(HangmanI);
  12245.  
  12246. HangmanJ = new JButton("J");
  12247.  
  12248. HangmanJ.setPreferredSize(new Dimension(60, 60));
  12249.  
  12250. HangmanJ.setFocusPainted(false);
  12251.  
  12252. HangmanJ.setBackground(Vanila);
  12253.  
  12254. HangmanJ.setFont(ButtonFont);
  12255.  
  12256. HangmanJ.addActionListener(this);
  12257.  
  12258. ButtonPanel.add(HangmanJ);
  12259.  
  12260. HangmanK = new JButton("K");
  12261.  
  12262. HangmanK.setPreferredSize(new Dimension(60, 60));
  12263.  
  12264. HangmanK.setFocusPainted(false);
  12265.  
  12266. HangmanK.setBackground(Vanila);
  12267.  
  12268. HangmanK.setFont(ButtonFont);
  12269.  
  12270. HangmanK.addActionListener(this);
  12271.  
  12272. ButtonPanel.add(HangmanK);
  12273.  
  12274. HangmanL = new JButton("L");
  12275.  
  12276. HangmanL.setPreferredSize(new Dimension(60, 60));
  12277.  
  12278. HangmanL.setFocusPainted(false);
  12279.  
  12280. HangmanL.setBackground(Vanila);
  12281.  
  12282. HangmanL.setFont(ButtonFont);
  12283.  
  12284. HangmanL.addActionListener(this);
  12285.  
  12286. ButtonPanel.add(HangmanL);
  12287.  
  12288. HangmanM = new JButton("M");
  12289.  
  12290. HangmanM.setPreferredSize(new Dimension(60, 60));
  12291.  
  12292. HangmanM.setFocusPainted(false);
  12293.  
  12294. HangmanM.setBackground(Vanila);
  12295.  
  12296. HangmanM.setFont(ButtonFont);
  12297.  
  12298. HangmanM.addActionListener(this);
  12299.  
  12300. ButtonPanel.add(HangmanM);
  12301.  
  12302. HangmanN = new JButton("N");
  12303.  
  12304. HangmanN.setPreferredSize(new Dimension(60, 60));
  12305.  
  12306. HangmanN.setFocusPainted(false);
  12307.  
  12308. HangmanN.setBackground(Vanila);
  12309.  
  12310. HangmanN.setFont(ButtonFont);
  12311.  
  12312. HangmanN.addActionListener(this);
  12313.  
  12314. ButtonPanel.add(HangmanN);
  12315.  
  12316. HangmanO = new JButton("O");
  12317.  
  12318. HangmanO.setPreferredSize(new Dimension(60, 60));
  12319.  
  12320. HangmanO.setFocusPainted(false);
  12321.  
  12322. HangmanO.setBackground(Vanila);
  12323.  
  12324. HangmanO.setFont(ButtonFont);
  12325.  
  12326. HangmanO.addActionListener(this);
  12327.  
  12328. ButtonPanel.add(HangmanO);
  12329.  
  12330. HangmanP = new JButton("P");
  12331.  
  12332. HangmanP.setPreferredSize(new Dimension(60, 60));
  12333.  
  12334. HangmanP.setFocusPainted(false);
  12335.  
  12336. HangmanP.setBackground(Vanila);
  12337.  
  12338. HangmanP.setFont(ButtonFont);
  12339.  
  12340. HangmanP.addActionListener(this);
  12341.  
  12342. ButtonPanel.add(HangmanP);
  12343.  
  12344. HangmanQ = new JButton("Q");
  12345.  
  12346. HangmanQ.setPreferredSize(new Dimension(60, 60));
  12347.  
  12348. HangmanQ.setFocusPainted(false);
  12349.  
  12350. HangmanQ.setBackground(Vanila);
  12351.  
  12352. HangmanQ.setFont(ButtonFont);
  12353.  
  12354. HangmanQ.addActionListener(this);
  12355.  
  12356. ButtonPanel.add(HangmanQ);
  12357.  
  12358. HangmanR = new JButton("R");
  12359.  
  12360. HangmanR.setPreferredSize(new Dimension(60, 60));
  12361.  
  12362. HangmanR.setFocusPainted(false);
  12363.  
  12364. HangmanR.setBackground(Vanila);
  12365.  
  12366. HangmanR.setFont(ButtonFont);
  12367.  
  12368. HangmanR.addActionListener(this);
  12369.  
  12370. ButtonPanel.add(HangmanR);
  12371.  
  12372. HangmanS = new JButton("S");
  12373.  
  12374. HangmanS.setPreferredSize(new Dimension(60, 60));
  12375.  
  12376. HangmanS.setFocusPainted(false);
  12377.  
  12378. HangmanS.setBackground(Vanila);
  12379.  
  12380. HangmanS.setFont(ButtonFont);
  12381.  
  12382. HangmanS.addActionListener(this);
  12383.  
  12384. ButtonPanel.add(HangmanS);
  12385.  
  12386. HangmanT = new JButton("T");
  12387.  
  12388. HangmanT.setPreferredSize(new Dimension(60, 60));
  12389.  
  12390. HangmanT.setFocusPainted(false);
  12391.  
  12392. HangmanT.setBackground(Vanila);
  12393.  
  12394. HangmanT.setFont(ButtonFont);
  12395.  
  12396. HangmanT.addActionListener(this);
  12397.  
  12398. ButtonPanel.add(HangmanT);
  12399.  
  12400. HangmanU = new JButton("U");
  12401.  
  12402. HangmanU.setPreferredSize(new Dimension(60, 60));
  12403.  
  12404. HangmanU.setFocusPainted(false);
  12405.  
  12406. HangmanU.setBackground(Vanila);
  12407.  
  12408. HangmanU.setFont(ButtonFont);
  12409.  
  12410. HangmanU.addActionListener(this);
  12411.  
  12412. ButtonPanel.add(HangmanU);
  12413.  
  12414. HangmanV = new JButton("V");
  12415.  
  12416. HangmanV.setPreferredSize(new Dimension(60, 60));
  12417.  
  12418. HangmanV.setFocusPainted(false);
  12419.  
  12420. HangmanV.setBackground(Vanila);
  12421.  
  12422. HangmanV.setFont(ButtonFont);
  12423.  
  12424. HangmanV.addActionListener(this);
  12425.  
  12426. ButtonPanel.add(HangmanV);
  12427.  
  12428. HangmanW = new JButton("W");
  12429.  
  12430. HangmanW.setPreferredSize(new Dimension(60, 60));
  12431.  
  12432. HangmanW.setFocusPainted(false);
  12433.  
  12434. HangmanW.setBackground(Vanila);
  12435.  
  12436. HangmanW.setFont(ButtonFont);
  12437.  
  12438. HangmanW.addActionListener(this);
  12439.  
  12440. ButtonPanel.add(HangmanW);
  12441.  
  12442. HangmanX = new JButton("X");
  12443.  
  12444. HangmanX.setPreferredSize(new Dimension(60, 60));
  12445.  
  12446. HangmanX.setFocusPainted(false);
  12447.  
  12448. HangmanX.setBackground(Vanila);
  12449.  
  12450. HangmanX.setFont(ButtonFont);
  12451.  
  12452. HangmanX.addActionListener(this);
  12453.  
  12454. ButtonPanel.add(HangmanX);
  12455.  
  12456. HangmanY = new JButton("Y");
  12457.  
  12458. HangmanY.setPreferredSize(new Dimension(60, 60));
  12459.  
  12460. HangmanY.setFocusPainted(false);
  12461.  
  12462. HangmanY.setBackground(Vanila);
  12463.  
  12464. HangmanY.setFont(ButtonFont);
  12465.  
  12466. HangmanY.addActionListener(this);
  12467.  
  12468. ButtonPanel.add(HangmanY);
  12469.  
  12470. HangmanZ = new JButton("Z");
  12471.  
  12472. HangmanZ.setPreferredSize(new Dimension(60, 60));
  12473.  
  12474. HangmanZ.setFocusPainted(false);
  12475.  
  12476. HangmanZ.setBackground(Vanila);
  12477.  
  12478. HangmanZ.setFont(ButtonFont);
  12479.  
  12480. HangmanZ.addActionListener(this);
  12481.  
  12482. ButtonPanel.add(HangmanZ);
  12483.  
  12484. ParentPanel.add(ButtonPanel);
  12485.  
  12486. JPanel ResetPanel = new JPanel();
  12487.  
  12488. ResetPanel.setLayout(new BorderLayout());
  12489.  
  12490. HangmanReset = new JButton("Reset");
  12491.  
  12492. HangmanReset.setFocusPainted(false);
  12493.  
  12494. HangmanReset.setBackground(RegularRed);
  12495.  
  12496. HangmanReset.setFont(ButtonFont);
  12497.  
  12498. HangmanReset.addActionListener(this);
  12499.  
  12500. ResetPanel.add(HangmanReset, BorderLayout.CENTER);
  12501.  
  12502. ResetPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  12503.  
  12504. ParentPanel.add(ResetPanel);
  12505.  
  12506. ParentPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  12507.  
  12508. HangmanFrame.add(ParentPanel);
  12509.  
  12510. HangmanFrame.pack();
  12511.  
  12512. HangmanFrame.setLocationRelativeTo(null);
  12513.  
  12514. HangmanFrame.setVisible(true);
  12515.  
  12516. HangmanFrame.setAlwaysOnTop(true);
  12517.  
  12518. HangmanFrame.setAlwaysOnTop(false);
  12519.  
  12520. HangmanFrame.requestFocus();
  12521.  
  12522. StartHangman();
  12523. }
  12524.  
  12525. public void StartHangman()
  12526. {
  12527. HangmanLabel.setFont(new Font("Dialog Font",Font.BOLD,30));
  12528.  
  12529. HangmanReset.setText("Reset");
  12530.  
  12531. String [] words = {"adult","advice","arrangement","attempt","August","Autumn","border","breeze","brick","calm","canal","Casey","cast","chose","claws","coach"
  12532. ,"constantly","contrast","cookies","customs","damage","Danny","deeply","depth","discussion","doll","donkey","Egypt","Ellen","essential","exchange","exist"
  12533. ,"explanation","facing","film","finest","fireplace","floating","folks","fort","garage","grabbed","grandmother","habit","happily","Harry","heading","hunter"
  12534. ,"Illinois","image","independent","instant","January","kids","label","Lee","lungs","manufacturing","Martin","mathematics","melted","memory","mill","mission"
  12535. ,"monkey","Mount","mysterious","neighborhood","Norway","nuts","occasionally","official","ourselves","palace","Pennsylvania","Philadelphia","plates","poetry"
  12536. ,"policeman","positive","possibly","practical","pride","promised","recall","relationship","remarkable","require","rhyme","rocky","rubbed","rush","sale"
  12537. ,"satellites","satisfied","scared","selection","shake","shaking","shallow","shout","silly","simplest","slight","slip","slope","soap","solar","species"
  12538. ,"spin","stiff","swung","tales","thumb","tobacco","toy","trap","treated","tune","University","vapor","vessels","wealth","wolf","zoo"};
  12539.  
  12540. HangmanWord = words[RI(0, words.length - 1)].toLowerCase();
  12541.  
  12542. HangmanLabel.setText(FillString(HangmanWord.length(), " _ "));
  12543.  
  12544. HangmanImageLabel.setIcon(new ImageIcon("SASIDFiles\\Pictures\\hangman.png"));
  12545.  
  12546. HangmanWrongGuesses = 0;
  12547.  
  12548. HangmanA.setEnabled(true);
  12549.  
  12550. HangmanA.setForeground(Color.black);
  12551.  
  12552. HangmanB.setEnabled(true);
  12553.  
  12554. HangmanB.setForeground(Color.black);
  12555.  
  12556. HangmanC.setEnabled(true);
  12557.  
  12558. HangmanC.setForeground(Color.black);
  12559.  
  12560. HangmanD.setEnabled(true);
  12561.  
  12562. HangmanD.setForeground(Color.black);
  12563.  
  12564. HangmanE.setEnabled(true);
  12565.  
  12566. HangmanE.setForeground(Color.black);
  12567.  
  12568. HangmanF.setEnabled(true);
  12569.  
  12570. HangmanF.setForeground(Color.black);
  12571.  
  12572. HangmanG.setEnabled(true);
  12573.  
  12574. HangmanG.setForeground(Color.black);
  12575.  
  12576. HangmanH.setEnabled(true);
  12577.  
  12578. HangmanH.setForeground(Color.black);
  12579.  
  12580. HangmanI.setEnabled(true);
  12581.  
  12582. HangmanI.setForeground(Color.black);
  12583.  
  12584. HangmanJ.setEnabled(true);
  12585.  
  12586. HangmanJ.setForeground(Color.black);
  12587.  
  12588. HangmanK.setEnabled(true);
  12589.  
  12590. HangmanK.setForeground(Color.black);
  12591.  
  12592. HangmanL.setEnabled(true);
  12593.  
  12594. HangmanL.setForeground(Color.black);
  12595.  
  12596. HangmanM.setEnabled(true);
  12597.  
  12598. HangmanM.setForeground(Color.black);
  12599.  
  12600. HangmanN.setEnabled(true);
  12601.  
  12602. HangmanN.setForeground(Color.black);
  12603.  
  12604. HangmanO.setEnabled(true);
  12605.  
  12606. HangmanO.setForeground(Color.black);
  12607.  
  12608. HangmanP.setEnabled(true);
  12609.  
  12610. HangmanP.setForeground(Color.black);
  12611.  
  12612. HangmanQ.setEnabled(true);
  12613.  
  12614. HangmanQ.setForeground(Color.black);
  12615.  
  12616. HangmanR.setEnabled(true);
  12617.  
  12618. HangmanR.setForeground(Color.black);
  12619.  
  12620. HangmanS.setEnabled(true);
  12621.  
  12622. HangmanS.setForeground(Color.black);
  12623.  
  12624. HangmanT.setEnabled(true);
  12625.  
  12626. HangmanT.setForeground(Color.black);
  12627.  
  12628. HangmanU.setEnabled(true);
  12629.  
  12630. HangmanU.setForeground(Color.black);
  12631.  
  12632. HangmanV.setEnabled(true);
  12633.  
  12634. HangmanV.setForeground(Color.black);
  12635.  
  12636. HangmanW.setEnabled(true);
  12637.  
  12638. HangmanW.setForeground(Color.black);
  12639.  
  12640. HangmanX.setEnabled(true);
  12641.  
  12642. HangmanX.setForeground(Color.black);
  12643.  
  12644. HangmanY.setEnabled(true);
  12645.  
  12646. HangmanY.setForeground(Color.black);
  12647.  
  12648. HangmanZ.setEnabled(true);
  12649.  
  12650. HangmanZ.setForeground(Color.black);
  12651. }
  12652.  
  12653. public void LetterChosen(String letter)
  12654. {
  12655. if (HangmanWord.toLowerCase().contains(letter.toLowerCase()))
  12656. {
  12657. char[] CurrentWordState = HangmanLabel.getText().replace(" ", "").toLowerCase().toCharArray();
  12658.  
  12659. char[] CurrentWord = HangmanWord.toLowerCase().toCharArray();
  12660.  
  12661. for (int i = 0 ; i < CurrentWordState.length; i++)
  12662. {
  12663. if (CurrentWord[i] == letter.charAt(0))
  12664. {
  12665. CurrentWordState[i] = CurrentWord[i];
  12666. }
  12667. }
  12668.  
  12669. String NewHangmanWord = new String(CurrentWordState);
  12670.  
  12671. StringBuilder result = new StringBuilder();
  12672.  
  12673. for (int i = 0; i < NewHangmanWord.length(); i++)
  12674. {
  12675. if (i > 0)
  12676. {
  12677. result.append(" ");
  12678. }
  12679.  
  12680. result.append(NewHangmanWord.charAt(i));
  12681. }
  12682.  
  12683. HangmanLabel.setText(result.toString());
  12684.  
  12685. if (!HangmanLabel.getText().contains("_"))
  12686. {
  12687. HangmanLabel.setFont(new Font("Dialog Font",Font.BOLD,20));
  12688.  
  12689. HangmanLabel.setText("Good job! You guessed the word \"" + HangmanWord + ".\" Would you like to play again?");
  12690.  
  12691. HangmanA.setEnabled(false);
  12692. HangmanB.setEnabled(false);
  12693. HangmanC.setEnabled(false);
  12694. HangmanD.setEnabled(false);
  12695. HangmanE.setEnabled(false);
  12696. HangmanF.setEnabled(false);
  12697. HangmanG.setEnabled(false);
  12698. HangmanH.setEnabled(false);
  12699. HangmanI.setEnabled(false);
  12700. HangmanJ.setEnabled(false);
  12701. HangmanK.setEnabled(false);
  12702. HangmanL.setEnabled(false);
  12703. HangmanM.setEnabled(false);
  12704. HangmanN.setEnabled(false);
  12705. HangmanO.setEnabled(false);
  12706. HangmanP.setEnabled(false);
  12707. HangmanQ.setEnabled(false);
  12708. HangmanR.setEnabled(false);
  12709. HangmanS.setEnabled(false);
  12710. HangmanT.setEnabled(false);
  12711. HangmanU.setEnabled(false);
  12712. HangmanV.setEnabled(false);
  12713. HangmanW.setEnabled(false);
  12714. HangmanX.setEnabled(false);
  12715. HangmanY.setEnabled(false);
  12716. HangmanZ.setEnabled(false);
  12717.  
  12718. HangmanReset.setText("Play Again");
  12719. }
  12720. }
  12721.  
  12722. else
  12723. {
  12724. if (HangmanWrongGuesses == 7)
  12725. {
  12726. HangmanImageLabel.setIcon(new ImageIcon("SASIDFiles\\Pictures\\hangman8.png"));
  12727.  
  12728. HangmanLabel.setFont(new Font("Dialog Font",Font.BOLD,20));
  12729.  
  12730. HangmanLabel.setText("Game over! You were unable to guess \"" + HangmanWord + ".\" Would you like to play again?");
  12731.  
  12732. HangmanA.setEnabled(false);
  12733. HangmanB.setEnabled(false);
  12734. HangmanC.setEnabled(false);
  12735. HangmanD.setEnabled(false);
  12736. HangmanE.setEnabled(false);
  12737. HangmanF.setEnabled(false);
  12738. HangmanG.setEnabled(false);
  12739. HangmanH.setEnabled(false);
  12740. HangmanI.setEnabled(false);
  12741. HangmanJ.setEnabled(false);
  12742. HangmanK.setEnabled(false);
  12743. HangmanL.setEnabled(false);
  12744. HangmanM.setEnabled(false);
  12745. HangmanN.setEnabled(false);
  12746. HangmanO.setEnabled(false);
  12747. HangmanP.setEnabled(false);
  12748. HangmanQ.setEnabled(false);
  12749. HangmanR.setEnabled(false);
  12750. HangmanS.setEnabled(false);
  12751. HangmanT.setEnabled(false);
  12752. HangmanU.setEnabled(false);
  12753. HangmanV.setEnabled(false);
  12754. HangmanW.setEnabled(false);
  12755. HangmanX.setEnabled(false);
  12756. HangmanY.setEnabled(false);
  12757. HangmanZ.setEnabled(false);
  12758.  
  12759. HangmanReset.setText("Play Again");
  12760. }
  12761.  
  12762. else
  12763. {
  12764. HangmanWrongGuesses++;
  12765.  
  12766. HangmanImageLabel.setIcon(new ImageIcon("SASIDFiles\\Pictures\\hangman" + HangmanWrongGuesses + ".png"));
  12767. }
  12768. }
  12769. }
  12770.  
  12771. public String FillString(int count, String c)
  12772. {
  12773. StringBuilder sb = new StringBuilder(count);
  12774.  
  12775. for (int i = 0 ; i < count ; i++)
  12776. {
  12777. sb.append(c);
  12778. }
  12779.  
  12780. return sb.toString();
  12781. }
  12782. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement