<> Programmer Tanabata Valentine's Day confession code

MainClass:com.wujinxi.ShowLove
package com.wujinxi; import java.awt.*; import java.awt.datatransfer.
StringSelection; import java.awt.event.KeyEvent; import java.io.File; import
java.io.FileReader; import java.io.IOException; import java.util.Random; /** *
@Author: Cool_Wu * @Date: 2020-08-23 12:07 */ public class ShowLove { public
static void main(String[] args) { // Open Notepad Runtime rt = Runtime.getRuntime(); try
{ rt.exec("notepad"); } catch (IOException e) { e.printStackTrace(); }
// Start the thread of playing music Thread t = new Thread(() -> { // When testing, the path of resource file is filled with absolute path
// Fill in resource file name when packing , Resource files and packaged jar The package is placed in the same level directory MusicUtil.playMusic("love.mp3"); }); t.start();
// The main thread takes a break , Waiting for the music atmosphere to set off try { Thread.sleep(3666); } catch (InterruptedException e)
{ e.printStackTrace(); } // Notepad begins to read and write // When testing, the path of resource file is filled with absolute path love
// Fill in resource file name when packing , Resource files and packaged jar The package is placed in the same level directory readAndWrite("love.txt"); } // Methods of reading and writing files private
static void readAndWrite(String path){ FileReader fr = null; try { // read file fr =
new FileReader(new File(path)); int i = 0; // Read one character at a time into memory while ((i = fr.read(
)) != -1){ //System.out.println((char)i); // Call write method to start , Read and write copyAndPaste(String.
valueOf((char)i)); } } catch (IOException e) { e.printStackTrace(); } }
// Using copy and paste to simulate writing method private static void copyAndPaste(String str) {
StringSelection ss= new StringSelection(str); // Open the shear board , Incoming parameters , Realize cut and copy Toolkit.
getDefaultToolkit().getSystemClipboard().setContents(ss,ss); // simulation Ctrl+V, Realize paste function
Robot robot= null; try { robot = new Robot(); } catch (AWTException e) { e.
printStackTrace(); } // Analog press Ctrl key robot.keyPress(KeyEvent.VK_CONTROL); // Analog press V key
robot.keyPress(KeyEvent.VK_V); // Simulated release V key robot.keyRelease(KeyEvent.VK_V);
// Simulated release Ctrl key robot.keyRelease(KeyEvent.VK_CONTROL);
// The computer runs fast , Ensure the normal operation of the program , Take a break after each reading and writing , Avoid the failure exception of cutting board opening . // At the same time, the rest time is a random number , Simulate the normal typing scene effect
Random random= new Random(); int time = random.nextInt(300); // Avoid getting too small a random number , Not effective
if (time < 168){ time += 132; } robot.delay(time); } }
Tools for playing music :com.wujinxi.MusicUtil
package com.wujinxi; import javazoom.jl.player.Player; import java.io.File;
import java.io.FileInputStream; /** * @Author: Cool_Wu * @Date: 2020-08-23
12:13 */ // Playing music tools public class MusicUtil { // How to play music public static void
playMusic(String path){ try { Player player = new Player(new FileInputStream(new
File(path))); player.play(); } catch (Exception e) { e.printStackTrace(); } } }
The tool class needs to be imported jar package ( New one lib Folder in jar package ):

* jlayer-1.0.1.jar
The required resource file for the parameter ( background music , Think about the content of the text ):

* love.txt
* love.mp3
love.txt Examples :
♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡ ♡ It's the same as you at first sight , It's the most beautiful meeting in my life ♡ ♡ Make a promise with you , It's the most eternal scenery in my plain life ♡ ♡
♡ Always wanted to say , Wherever you go , Most want to go to your side ♡ ♡ ♡ I believe we can work together , Wait for green silk to turn white ♡ ♡ ♡ you are here , I am here , The sea is dry and the stone is rotten ♡ ♡
♡ dear , You know what? , Even if it's black and blue , I still have the strength to love you ♡ ♡ ♡ Life is like making dumplings , Whatever you are , I will tightly wrap you in my heart ♡
♡ How to cook the boiling water of life , Can't wear away my love for you ♡ ♡ ♡ Everlasting longing for each other , How many infatuated tears , Drink a cup of turbid wine , How many worldly feelings have you tasted ♡ ♡ If you are my lotus , Then let me keep a long love for you in this life ♡
♡ ♡ I want to love someone , Is to abandon everything , The determination to stay with her ♡ ♡ ♡ love , for nothing , Because of palpitation , feeling , There is no excuse , Because of looking back a thousand times ♡ ♡ ♡ Love is simple : One of you , Wholeheartedly ♡ ♡
♡ The most romantic thing I can think of , Is to grow old with you ♡ ♡ ♡ Although you are not the best , But I'm unique , The only one I love deeply ♡ ♡
♡ There are many flowers , But there is no repetition , I wish you were my destiny ♡ ♡ ♡ A lot of people like you , There is no shortage of me , But I love very few people , You're the only one ♡ ♡
♡ Just for one person , All his life , the remotest corners of the globe , May you be safe ♡ ♡ ♡ Love you every day , Love you every moment , Every moment I miss you , Every minute of you , May God help us in this life ♡ ♡
♡ I can't get involved in your past , I will accompany you to the end ♡ ♡ ♡ Love in life , Haggard just for her ♡ ♡ ♡ love , It's not that profound , To be together is the greatest happiness ♡ ♡
♡ because of you , I believe in true love , because of you , I believe in forever ♡ ♡ ♡ Where are you , That is, I have to miss the ends of the earth ♡ ♡ ♡ I will use my heart , I'll be with you all my life , Guard you ♡ ♡
♡ The only miser in this life , You are mine ♡ ♡ ♡ Thinking about my future with you , I'm not afraid of anything else ♡ ♡ ♡2020 With you , I believe we will not be afraid of wind and rain ♡
♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡♡

Technology
©2019-2020 Toolsou All rights reserved,
Hikvision - Embedded software written test questions C Language application 0 The length of array in memory and structure is 0 In depth analysis data structure --- The preorder of binary tree , Middle order , Subsequent traversal How to do it ipad Transfer of medium and super large files to computer elementui Shuttle box el-transfer Display list content text too long 2019 The 10th Blue Bridge Cup C/C++ A Summary after the National Games ( Beijing Tourism summary )unity Shooting games , Implementation of first person camera python of numpy Module detailed explanation and application case Study notes 【STM32】 Digital steering gear Horizontal and vertical linkage pan tilt Vue Used in Element Open for the first time el-dialog Solution for not getting element