撩妹java代码_网传"程序员撩妹"程序--Java实现

import java.awt.FlowLayout;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JButton;

import javax.swing.Icon;

import javax.swing.ImageIcon;

import javax.swing.JOptionPane;

public class 程序员撩妹对话框 extends JFrame {

private final JButton yes;

private final JButton no;

private final JLabel textLabel1;

private final JLabel textLabel2;

private final JLabel imageLabel;

Icon img = new ImageIcon("C:\\\\Users\\\\Jack Hwo\\\\Desktop\\\\0.png");

Icon emoji1 = new ImageIcon("C:\\Users\\Jack Hwo\\Desktop\\1.jpg");

Icon emoji2 = new ImageIcon("C:\\Users\\Jack Hwo\\Desktop\\2.jpg");

Icon emoji3 = new ImageIcon("C:\\Users\\Jack Hwo\\Desktop\\3.jpg");

public 程序员撩妹对话框() {

super("来自对面的小哥哥");

setLayout(new FlowLayout());

textLabel1 = new JLabel("小姐姐我观察你很久了");

textLabel1.setFont(new Font("宋体", 22, 23));

add(textLabel1);

textLabel2 = new JLabel("做我女朋友好不好?");

textLabel2.setFont(new Font("楷体", 33, 40));

add(textLabel2);

imageLabel = new JLabel(img);

imageLabel.setLocation(123, 124);

add(imageLabel);

yes = new JButton("好");

add(yes);

no = new JButton("不好");

add(no);

ButtonHandler1 handler1 = new ButtonHandler1();

yes.addActionListener(handler1);

ButtonHandler2 handler2 = new ButtonHandler2();

no.addActionListener(handler2);

}

private class ButtonHandler1 implements ActionListener {

@Override

public void actionPerformed(ActionEvent event) {

JOptionPane.showMessageDialog(程序员撩妹对话框.this, String.format("目标拿下哈哈"));

}

}

private class ButtonHandler2 implements ActionListener {

private int flag = 0;

@Override

public void actionPerformed(ActionEvent event) {

flag++;

if (flag == 1) {

JOptionPane.showMessageDialog(程序员撩妹对话框.this, String.format("房产证上写你名"), "做我女朋友好不好",

JOptionPane.INFORMATION_MESSAGE, emoji1);

flag++;

}

if (flag == 3) {

JOptionPane.showMessageDialog(程序员撩妹对话框.this, String.format("保大"), "做我女朋友好不好",

JOptionPane.INFORMATION_MESSAGE, emoji2);

flag++;

}

if (flag == 5) {

JOptionPane.showMessageDialog(程序员撩妹对话框.this, String.format("我妈会游泳"), "做我女朋友好不好",

JOptionPane.INFORMATION_MESSAGE, emoji3);

flag=0;

}

}

}

}

public class TestDemo {

public static void main(String[] args) {

程序员撩妹对话框 buttonFrame = new 程序员撩妹对话框();

buttonFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

buttonFrame.setResizable(false);

buttonFrame.setFocusable(false);

buttonFrame.setAlwaysOnTop(true);

buttonFrame.setSize(600, 400);

buttonFrame.setVisible(true);

buttonFrame.setLocationRelativeTo(null);

}

}

附图:

053f6d08e4fa5c5fe08940052503de13.png

d45a0293340ac2f945158ed9a358cb93.png

5db324142f664b8f83de2a80d0b40596.png

e5e9c81b5c65202a43b18cac245b2877.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值