效果
java代码
代码语言:javascript复制import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
public class love extends JFrame {
/**
*
*/
private static final long serialVersionUID = 5430219520645185275L;
private JPanel contentPane;
protected Component frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
love frame = new love();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public love() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel label = new JLabel("小姐姐处对象吗?");
label.setFont(new Font("幼圆", Font.PLAIN, 18));
label.setBounds(147, 20, 211, 41);
contentPane.add(label);
JButton button = new JButton("好的");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "恭喜!成功拿下!", "表白幺~",JOptionPane.PLAIN_MESSAGE);
}
});
button.setBounds(98, 179, 93, 23);
contentPane.add(button);
JButton button_1 = new JButton("不行");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showConfirmDialog(null, "房子写你名", "表白~",JOptionPane.YES_NO_OPTION);
JOptionPane.showConfirmDialog(null, "我会做饭", "表白~",JOptionPane.YES_NO_OPTION);
JOptionPane.showConfirmDialog(null, "我会洗衣服", "表白~",JOptionPane.YES_NO_OPTION);
JOptionPane.showMessageDialog(null, "现在可以成为我女票吗?", "表白幺~",JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null, "恭喜!成功拿下!", "表白幺~",JOptionPane.PLAIN_MESSAGE);
}
});
button_1.setBounds(251, 179, 93, 23);
contentPane.add(button_1);
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon("love.png"));
lblNewLabel.setBounds(157, 57, 114, 98);
contentPane.add(lblNewLabel);
}
}
附件下载
表白器.zip
版权属于:逍遥子大表哥
本文链接:https://cloud.tencent.com/developer/article/1920577
按照知识共享署名-非商业性使用 4.0 国际协议进行许可,转载引用文章应遵循相同协议。