Created
February 13, 2022 15:33
-
-
Save liketaurus/61a92bedc90a42720d409003b206f911 to your computer and use it in GitHub Desktop.
Happy Valentine's Day!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.net.URL; | |
import javax.swing.*; | |
public class Valentine extends JFrame { | |
Valentine() { | |
URL url = null; | |
try { | |
url = new URL("https://thumbs.gfycat.com/SkinnyPinkBunny-max-1mb.gif"); | |
} catch (Exception ex) { | |
}; | |
setTitle("Love Celebration"); | |
setLayout(new BorderLayout()); | |
setContentPane(new JLabel(new ImageIcon(url))); | |
JLabel lblText = new JLabel("<html><p style='color: #ffffff; font-family:algerian; font-size:25pt'>Happy Valentine Day!</p></html>"); | |
lblText.setLocation(80, 180); | |
lblText.setSize(600, 70); | |
add(lblText); | |
setSize(500, 270); | |
setResizable(false); | |
setDefaultCloseOperation(EXIT_ON_CLOSE); | |
setLocationRelativeTo(null); | |
setVisible(true); | |
} | |
public static void main(String args[]) { | |
String name = JOptionPane.showInputDialog(null, "Enter your name"); | |
JOptionPane.showMessageDialog(null, "May I surprise you, " + name + "?"); | |
new Valentine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment