国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專(zhuān)注于服務(wù)器技術(shù)及軟件下載分享
分類(lèi)導(dǎo)航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|JavaScript|易語(yǔ)言|

服務(wù)器之家 - 編程語(yǔ)言 - JAVA教程 - 情人節(jié)寫(xiě)給女朋友Java Swing代碼程序

情人節(jié)寫(xiě)給女朋友Java Swing代碼程序

2021-04-05 13:26阿笨爹 JAVA教程

這篇文章主要為大家分享了情人節(jié)寫(xiě)給女朋友的java小程序,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,祝大家每天都是情人節(jié)

馬上又要到情人節(jié)了,再不解風(fēng)情的人也得向女友表示表示。作為一個(gè)程序員,示愛(ài)的時(shí)候自然也要用我們自己的方式。

這里給大家上傳一段我在今年情人節(jié)的時(shí)候?qū)懡o女朋友的一段簡(jiǎn)單的java swing代碼,主要定義了一個(gè)對(duì)話框,讓女友選擇是不是喜歡自己。如果她選了“是”,皆大歡喜,如果她想選“不”,哼哼。。??匆幌陆貓D吧。

代碼效果圖:

情人節(jié)寫(xiě)給女朋友Java Swing代碼程序

接下來(lái)不廢話,直接上代碼了。新版本已上傳,也歡迎大家到我的github上下載和改進(jìn)代碼(點(diǎn)此轉(zhuǎn)到github)。

另外就是因?yàn)檫@個(gè)代碼當(dāng)時(shí)是在情人節(jié)的時(shí)候?qū)懙?,?duì)話框標(biāo)題欄的信息也是與情人節(jié)相關(guān),要想在其他的節(jié)日使用,只需要修改幾個(gè)字符串就可以了,我在需要修改的地方都打了中文注釋?zhuān)蠹铱梢院苋菀椎卣业健2贿^(guò)正如我在注釋里寫(xiě)的那樣,這個(gè)程序頂多是你倆之間一個(gè)溫馨的小玩笑,你要是想今晚嘿嘿嘿的話,真正的禮物還是得備好哦: )

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
package gift_package;
 
 
import java.awt.container;
import java.awt.font;
import java.awt.toolkit;
import java.awt.event.mouseevent;
import java.awt.event.mouselistener;
import java.awt.event.windowevent;
import java.awt.event.windowlistener;
 
 
import javax.swing.jbutton;
import javax.swing.jdialog;
import javax.swing.jframe;
import javax.swing.jlabel;
import javax.swing.swingconstants;
import javax.swing.windowconstants;
 
 
/**
 * a funny code for your lover, which creates a frame that let her/him choose
 * whether she/he loves you. if she/he choose 'yes', everythingis normal, but
 * if she/he tries to choose 'no', something interestingwould happen. first,
 * the 'no' button would change its position, it lookes like it attemps to escape
 * from being clicked. after a couple of rounds, if she/he still want to click
 * 'no' button, the 'no' button and 'yes' button will exchange their position.
 * besides, the window will cannot be closed untill the 'yes' button is clicked.
 *
 * to use this code, please make sure her/his computer has installed the jre.
 *
 * note that this code is just a little joke, do not use it as a real valentin's
 * day gift, if you want to get laid at valentin's day, use rose, wine and fancy
 * restaurant, if you want to keep your mate's love, use your heart.
 *
 * @author rainman_zjd
 * @version initialt version, 2016.3.20
 */
public class happyvalentinsday extends jframe {
 
 
  private static final long serialversionuid = 1l;
 
 
  private jlabel   label;
  private jbutton  button1;
  private jbutton  button2;
  private jdialog  dialog1;
 
 
  private int entercount = 0;
  private boolean chooseflag = false;
 
 
  public static final int screenwidth = 
      (int)toolkit.getdefaulttoolkit().getscreensize().getwidth();
  public static final int screenheight = 
      (int)toolkit.getdefaulttoolkit().getscreensize().getheight();
 
 
  public happyvalentinsday() {
    label  = new jlabel("hi, my name is rainman_zjd, i love you, do you love me?", swingconstants.center); // 自行修改
    button1 = new jbutton("no, i don't!"); // 按鈕1
    button2 = new jbutton("yes, i do!");  // 按鈕2
    dialog1 = new jdialog(this);      // 創(chuàng)建一個(gè)新的對(duì)話框,并設(shè)置父窗口為當(dāng)前窗體
    windowinitial();
    setwindowlistener();
  }// constructor
 
 
  public happyvalentinsday(string labeltxt, string bt1txt, string bt2txt) {
    label  = new jlabel(labeltxt, swingconstants.center);
    button1 = new jbutton(bt1txt);
    button2 = new jbutton(bt2txt);
    dialog1 = new jdialog(this);
    windowinitial();
    chooseflag = true;
    setdefaultcloseoperation(windowconstants.dispose_on_close);
    setvisible(true);
  }// constructor_string
 
 
  /**
   * 窗體初始化,使用的是絕對(duì)布局
   */
  private void windowinitial() {
    setdialog(dialog1, "awesome!", "meeting you is the luckest thing in my life!"); // 自行修改
 
 
    label.setfont(new font("", font.bold, 17));
    label.setbounds(0, 30, 480, 20);
     
    /**
     * 以匿名內(nèi)部類(lèi)的方式為按鈕1添加鼠標(biāo)事件監(jiān)聽(tīng)器,當(dāng)鼠標(biāo)進(jìn)入按鈕1后將突然改變自己的位置
     */
    button1.addmouselistener(new mouselistener() { 
      @override
      public void mousereleased(mouseevent e) {return;}      
      @override
      public void mousepressed(mouseevent e) {return;}      
      @override
      public void mouseexited(mouseevent e) {return;}      
      @override
      public void mouseentered(mouseevent e) {
        switch(entercount) {
        case 0:
          button1.setbounds(75, 60, 110, 30);
          happyvalentinsday.this.repaint();
          ++entercount;
          break;
        case 1:
          button1.setbounds(75, 110, 110, 30);
          happyvalentinsday.this.repaint();
          ++entercount;
          break;
        case 2:
          button1.setbounds(155, 60, 110, 30);
          happyvalentinsday.this.repaint();
          ++entercount;
          break;
        case 3:
          button1.setbounds(75, 110, 110, 30);
          happyvalentinsday.this.repaint();
          ++entercount;
          break;
        case 4:
          button1.setbounds(310, 110, 110, 30);
          button2.setbounds(75, 110, 110, 30);
          happyvalentinsday.this.repaint();
          ++entercount;
          break;
        case 5:
          button1.setbounds(75, 110, 110, 30);
          button2.setbounds(310, 110, 110, 30);
          happyvalentinsday.this.repaint();
          entercount = 0;
          break;
        }// seitch_entercount
      }// mouseentered      
      @override
      public void mouseclicked(mouseevent e) {
        dialog1.setvisible(true);
        setdefaultcloseoperation(dispose_on_close);
      }// mouseclicked
    });// mouselistener
     
    button1.setbounds(70, 110, 110, 30);
    button1.setfont(new font("", font.bold, 13));
     
    /**
     * 以匿名內(nèi)部類(lèi)的方式為按鈕2添加鼠標(biāo)事件監(jiān)聽(tīng)器,按下時(shí)顯示對(duì)話框
     */
    button2.addmouselistener(new mouselistener() {   
      @override
      public void mousereleased(mouseevent e) {return;}      
      @override
      public void mousepressed(mouseevent e) {return;}      
      @override
      public void mouseexited(mouseevent e) {return;}      
      @override
      public void mouseentered(mouseevent e) {return;}      
      @override
      public void mouseclicked(mouseevent e) {
        dialog1.setvisible(true);
        chooseflag = true;
        setdefaultcloseoperation(dispose_on_close);
      }// mouseclicked
    });// mouselistener
    button2.setbounds(310, 110, 110, 30);
    button2.setfont(new font("", font.bold, 13));
 
 
    container c = getcontentpane();
    c.setlayout(null);
    c.add(label);
    c.add(button1);
    c.add(button2);
    settitle("happy valentin's day!"); // 自行修改
    setbounds(screenwidth/2-250, screenheight/2-100, 500, 200);
    setresizable(false);
    setdefaultcloseoperation(windowconstants.do_nothing_on_close);
  }// windowinitial
 
 
  /**
   * 設(shè)置對(duì)話框?qū)傩?
   * @param diag
   * @param tittle
   * @param txt
   */
  private void setdialog(jdialog diag, string tittle, string txt) {
    jlabel diaglabel = new jlabel(txt, swingconstants.center);
    diaglabel.setfont(new font("", font.bold, 17));
    diaglabel.setbounds(0, 40, 430, 20);
    jbutton diagbut = new jbutton("confirm");
    diagbut.setfont(new font("", font.bold, 14));
    diagbut.setbounds(155, 100, 100, 30);
    diagbut.addmouselistener(new mouselistener() {      
      @override
      public void mousereleased(mouseevent e) {return;}            
      @override
      public void mousepressed(mouseevent e) {return;}            
      @override
      public void mouseexited(mouseevent e) {return;}           
      @override
      public void mouseentered(mouseevent e) {return;}     
      @override
      public void mouseclicked(mouseevent e) {
        diag.dispose();
        if (chooseflag)
          system.exit(0);
      }// mouseclicked
    });
    diag.settitle(tittle);
    diag.setbounds(screenwidth/2-225, screenheight/2-100, 450, 200);
    diag.setlayout(null);
    diag.add(diagbut);
    diag.add(diaglabel);
  }// setdialog
  /**
   * 設(shè)置單擊窗口關(guān)閉按鈕時(shí)的動(dòng)作
   */
  private void setwindowlistener() {
    this.addwindowlistener(new windowlistener() {      
      @override
      public void windowopened(windowevent e) {return;}     
      @override
      public void windowiconified(windowevent e) {return;}      
      @override
      public void windowdeiconified(windowevent e) {return;}
      @override
      public void windowdeactivated(windowevent e) {return;}
      @override
      public void windowclosed(windowevent e) {return;}     
      @override
      public void windowactivated(windowevent e) {return;}
      @override
      public void windowclosing(windowevent e) {
        if(!chooseflag) {
          string labeltxt = "is your default choose \"yes, i do!\"?"; // 自行修改
          new happyvalentinsday(labeltxt, "no", "yes");
        }// if
      }// windowclosing
    });// windowlistener
  }// setwindowlistener
 
 
  public static void main(string[] args) {
    happyvalentinsday myapp = new happyvalentinsday();
    myapp.setvisible(true);
  }// main
 
 
}/*happyvalentinsday*/

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家,祝大家情人節(jié)快樂(lè)

原文鏈接:http://blog.csdn.net/u013916933/article/details/51458967

延伸 · 閱讀

精彩推薦
  • JAVA教程基于java中集合的概念(詳解)

    基于java中集合的概念(詳解)

    下面小編就為大家?guī)?lái)一篇基于java中集合的概念(詳解)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧...

    翊風(fēng)8902021-01-01
  • JAVA教程JAVA中常見(jiàn)異常類(lèi)

    JAVA中常見(jiàn)異常類(lèi)

    本文主要介紹了JAVA中的常見(jiàn)異常類(lèi)。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧 ...

    toyzhou3102020-07-31
  • JAVA教程Java接口和抽象類(lèi)實(shí)例分析

    Java接口和抽象類(lèi)實(shí)例分析

    這篇文章主要介紹了Java接口和抽象類(lèi),實(shí)例分析了java接口與抽象類(lèi)的概念與相關(guān)使用技巧,需要的朋友可以參考下 ...

    海 子1622019-12-19
  • JAVA教程Spring MVC項(xiàng)目中l(wèi)og4J和AOP使用詳解

    Spring MVC項(xiàng)目中l(wèi)og4J和AOP使用詳解

    項(xiàng)目日志記錄是項(xiàng)目開(kāi)發(fā)、運(yùn)營(yíng)必不可少的內(nèi)容,有了它可以對(duì)系統(tǒng)有整體的把控,出現(xiàn)任何問(wèn)題都有蹤跡可尋。下面這篇文章主要給大家介紹了關(guān)于Spr...

    日生三金9932021-03-04
  • JAVA教程Java concurrency之AtomicReference原子類(lèi)_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    Java concurrency之AtomicReference原子類(lèi)_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    AtomicReference是作用是對(duì)"對(duì)象"進(jìn)行原子操作。這篇文章主要介紹了Java concurrency之AtomicReference原子類(lèi),需要的朋友可以參考下...

    動(dòng)力節(jié)點(diǎn)3502020-11-09
  • JAVA教程Spring Boot(二)之web綜合開(kāi)發(fā)

    Spring Boot(二)之web綜合開(kāi)發(fā)

    本篇文章為大家介紹spring boot的其它特性(有些未必是spring boot體系桟的功能,但是是spring特別推薦的一些開(kāi)源技術(shù)本文也會(huì)介紹),對(duì)了這里只是一個(gè)大概...

    純潔的微笑3802020-09-27
  • JAVA教程java線程并發(fā)semaphore類(lèi)示例

    java線程并發(fā)semaphore類(lèi)示例

    Java 5.0里新加了4個(gè)協(xié)調(diào)線程間進(jìn)程的同步裝置,它們分別是Semaphore, CountDownLatch, CyclicBarrier和Exchanger,本例主要介紹Semaphore,Semaphore是用來(lái)管理一個(gè)資源池的工...

    java教程網(wǎng)5212019-10-31
  • JAVA教程Java Mybatis中的 ${ } 和 #{ }的區(qū)別使用詳解

    Java Mybatis中的 ${ } 和 #{ }的區(qū)別使用詳解

    這篇文章主要介紹了Mybatis中的 ${ } 和 #{ }的區(qū)別使用詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋...

    大頭就是我4362020-07-21
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 国产91对白叫床清晰播放 | 日韩电影在线看 | www.99热 | 4虎tv| 国产乱码一区二区三区 | 自拍三区| 国产一区二区免费 | 日本精品视频在线观看 | 免费毛片视频 | 久久久国产精品一区 | 99re免费视频精品全部 | 欧美日韩国产一区二区在线观看 | 中文av一区二区 | 日日操夜| 欧美精品一二三区 | 极品国产粉嫩av免费观看 | 久久福利| 亚洲激情在线视频 | 国产精品久久久久久久久久免费看 | 国产精品一区av | 在线观看亚洲视频 | 亚洲国产一级 | 伊人精品成人久久综合软件 | 一区二区三区四区在线视频 | 久久视精品 | 中文字幕第二页 | 91精品国产综合久久久久久丝袜 | 亚洲精品久久久一区二区三区 | 色综合天天综合网国产成人网 | 欧美日本韩国一区二区 | 中文字幕av一区二区三区 | 91精品国产高清久久久久久久久 | 日韩欧美视频免费在线观看 | 精品国产乱码久久久久久1区2区 | 成人羞羞视频在线看网址 | 亚洲免费久久久 | 国产露脸国语对白在线 | 91亚洲国产 | 中文字幕久久伊人 | av黄色网页 | 精品国产凹凸成av人导航 |