Skip to content

Instantly share code, notes, and snippets.

@liketaurus
Created February 13, 2022 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liketaurus/61a92bedc90a42720d409003b206f911 to your computer and use it in GitHub Desktop.
Save liketaurus/61a92bedc90a42720d409003b206f911 to your computer and use it in GitHub Desktop.
Happy Valentine's Day!
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