欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

java求主源代碼,java核心源碼包

求java小游戲源代碼

表1. CheckerDrag.java

創(chuàng)新互聯(lián)公司是一家集成都網(wǎng)站制作、成都網(wǎng)站建設(shè)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)、網(wǎng)站頁(yè)面設(shè)計(jì)、網(wǎng)站優(yōu)化SEO優(yōu)化為一體的專業(yè)的建站公司,已為成都等多地近百家企業(yè)提供網(wǎng)站建設(shè)服務(wù)。追求良好的瀏覽體驗(yàn),以探求精品塑造與理念升華,設(shè)計(jì)最適合用戶的網(wǎng)站頁(yè)面。 合作只是第一步,服務(wù)才是根本,我們始終堅(jiān)持講誠(chéng)信,負(fù)責(zé)任的原則,為您進(jìn)行細(xì)心、貼心、認(rèn)真的服務(wù),與眾多客戶在蓬勃發(fā)展的市場(chǎng)環(huán)境中,互促共生。

// CheckerDrag.javaimport java.awt.*;import java.awt.event.*;public class CheckerDrag extends java.applet.Applet{ // Dimension of checkerboard square. // 棋盤上每個(gè)小方格的尺寸 final static int SQUAREDIM = 40; // Dimension of checkerboard -- includes black outline. // 棋盤的尺寸 – 包括黑色的輪廓線 final static int BOARDDIM = 8 * SQUAREDIM + 2; // Dimension of checker -- 3/4 the dimension of a square. // 棋子的尺寸 – 方格尺寸的3/4 final static int CHECKERDIM = 3 * SQUAREDIM / 4; // Square colors are dark green or white. // 方格的顏色為深綠色或者白色 final static Color darkGreen = new Color (0, 128, 0); // Dragging flag -- set to true when user presses mouse button over checker // and cleared to false when user releases mouse button. // 拖動(dòng)標(biāo)記 --當(dāng)用戶在棋子上按下鼠標(biāo)按鍵時(shí)設(shè)為true, // 釋放鼠標(biāo)按鍵時(shí)設(shè)為false boolean inDrag = false; // Left coordinate of checkerboard's upper-left corner. // 棋盤左上角的左方向坐標(biāo) int boardx; // Top coordinate of checkerboard's upper-left corner. //棋盤左上角的上方向坐標(biāo) int boardy; // Left coordinate of checker rectangle origin (upper-left corner). // 棋子矩形原點(diǎn)(左上角)的左方向坐標(biāo) int ox; // Top coordinate of checker rectangle origin (upper-left corner). // 棋子矩形原點(diǎn)(左上角)的上方向坐標(biāo) int oy; // Left displacement between mouse coordinates at time of press and checker // rectangle origin. // 在按鍵時(shí)的鼠標(biāo)坐標(biāo)與棋子矩形原點(diǎn)之間的左方向位移 int relx; // Top displacement between mouse coordinates at time of press and checker // rectangle origin. // 在按鍵時(shí)的鼠標(biāo)坐標(biāo)與棋子矩形原點(diǎn)之間的上方向位移 int rely; // Width of applet drawing area. // applet繪圖區(qū)域的寬度 int width; // Height of applet drawing area. // applet繪圖區(qū)域的高度 int height; // Image buffer. // 圖像緩沖 Image imBuffer; // Graphics context associated with image buffer. // 圖像緩沖相關(guān)聯(lián)的圖形背景 Graphics imG; public void init () { // Obtain the size of the applet's drawing area. // 獲取applet繪圖區(qū)域的尺寸 width = getSize ().width; height = getSize ().height; // Create image buffer. // 創(chuàng)建圖像緩沖 imBuffer = createImage (width, height); // Retrieve graphics context associated with image buffer. // 取出圖像緩沖相關(guān)聯(lián)的圖形背景 imG = imBuffer.getGraphics (); // Initialize checkerboard's origin, so that board is centered. // 初始化棋盤的原點(diǎn),使棋盤在屏幕上居中 boardx = (width - BOARDDIM) / 2 + 1; boardy = (height - BOARDDIM) / 2 + 1; // Initialize checker's rectangle's starting origin so that checker is // centered in the square located in the top row and second column from // the left. // 初始化棋子矩形的起始原點(diǎn),使得棋子在第一行左數(shù)第二列的方格里居中 ox = boardx + SQUAREDIM + (SQUAREDIM - CHECKERDIM) / 2 + 1; oy = boardy + (SQUAREDIM - CHECKERDIM) / 2 + 1; // Attach a mouse listener to the applet. That listener listens for // mouse-button press and mouse-button release events. // 向applet添加一個(gè)用來監(jiān)聽鼠標(biāo)按鍵的按下和釋放事件的鼠標(biāo)監(jiān)聽器 addMouseListener (new MouseAdapter () { public void mousePressed (MouseEvent e) { // Obtain mouse coordinates at time of press. // 獲取按鍵時(shí)的鼠標(biāo)坐標(biāo) int x = e.getX (); int y = e.getY (); // If mouse is over draggable checker at time // of press (i.e., contains (x, y) returns // true), save distance between current mouse // coordinates and draggable checker origin // (which will always be positive) and set drag // flag to true (to indicate drag in progress). // 在按鍵時(shí)如果鼠標(biāo)位于可拖動(dòng)的棋子上方 // (也就是contains (x, y)返回true),則保存當(dāng)前 // 鼠標(biāo)坐標(biāo)與棋子的原點(diǎn)之間的距離(始終為正值)并且 // 將拖動(dòng)標(biāo)志設(shè)為true(用來表明正處在拖動(dòng)過程中) if (contains (x, y)) { relx = x - ox; rely = y - oy; inDrag = true; } } boolean contains (int x, int y) { // Calculate center of draggable checker. // 計(jì)算棋子的中心位置 int cox = ox + CHECKERDIM / 2; int coy = oy + CHECKERDIM / 2; // Return true if (x, y) locates with bounds // of draggable checker. CHECKERDIM / 2 is the // radius. // 如果(x, y)仍處于棋子范圍內(nèi)則返回true // CHECKERDIM / 2為半徑 return (cox - x) * (cox - x) + (coy - y) * (coy - y) CHECKERDIM / 2 * CHECKERDIM / 2; } public void mouseReleased (MouseEvent e) { // When mouse is released, clear inDrag (to // indicate no drag in progress) if inDrag is // already set. // 當(dāng)鼠標(biāo)按鍵被釋放時(shí),如果inDrag已經(jīng)為true, // 則將其置為false(用來表明不在拖動(dòng)過程中) if (inDrag) inDrag = false; } }); // Attach a mouse motion listener to the applet. That listener listens // for mouse drag events. //向applet添加一個(gè)用來監(jiān)聽鼠標(biāo)拖動(dòng)事件的鼠標(biāo)運(yùn)動(dòng)監(jiān)聽器 addMouseMotionListener (new MouseMotionAdapter () { public void mouseDragged (MouseEvent e) { if (inDrag) { // Calculate draggable checker's new // origin (the upper-left corner of // the checker rectangle). // 計(jì)算棋子新的原點(diǎn)(棋子矩形的左上角) int tmpox = e.getX () - relx; int tmpoy = e.getY () - rely; // If the checker is not being moved // (at least partly) off board, // assign the previously calculated // origin (tmpox, tmpoy) as the // permanent origin (ox, oy), and // redraw the display area (with the // draggable checker at the new // coordinates). // 如果棋子(至少是棋子的一部分)沒有被 // 移出棋盤,則將之前計(jì)算的原點(diǎn) // (tmpox, tmpoy)賦值給永久性的原點(diǎn)(ox, oy), // 并且刷新顯示區(qū)域(此時(shí)的棋子已經(jīng)位于新坐標(biāo)上) if (tmpox boardx tmpoy boardy tmpox + CHECKERDIM boardx + BOARDDIM tmpoy + CHECKERDIM boardy + BOARDDIM) { ox = tmpox; oy = tmpoy; repaint (); } } } }); } public void paint (Graphics g) { // Paint the checkerboard over which the checker will be dragged. // 在棋子將要被拖動(dòng)的位置上繪制棋盤 paintCheckerBoard (imG, boardx, boardy); // Paint the checker that will be dragged. // 繪制即將被拖動(dòng)的棋子 paintChecker (imG, ox, oy); // Draw contents of image buffer. // 繪制圖像緩沖的內(nèi)容 g.drawImage (imBuffer, 0, 0, this); } void paintChecker (Graphics g, int x, int y) { // Set checker shadow color. // 設(shè)置棋子陰影的顏色 g.setColor (Color.black); // Paint checker shadow. // 繪制棋子的陰影 g.fillOval (x, y, CHECKERDIM, CHECKERDIM); // Set checker color. // 設(shè)置棋子顏色 g.setColor (Color.red); // Paint checker. // 繪制棋子 g.fillOval (x, y, CHECKERDIM - CHECKERDIM / 13, CHECKERDIM - CHECKERDIM / 13); } void paintCheckerBoard (Graphics g, int x, int y) { // Paint checkerboard outline. // 繪制棋盤輪廓線 g.setColor (Color.black); g.drawRect (x, y, 8 * SQUAREDIM + 1, 8 * SQUAREDIM + 1); // Paint checkerboard. // 繪制棋盤 for (int row = 0; row 8; row++) { g.setColor (((row 1) != 0) ? darkGreen : Color.white); for (int col = 0; col 8; col++) { g.fillRect (x + 1 + col * SQUAREDIM, y + 1 + row * SQUAREDIM, SQUAREDIM, SQUAREDIM); g.setColor ((g.getColor () == darkGreen) ? Color.white : darkGreen); } } } // The AWT invokes the update() method in response to the repaint() method // calls that are made as a checker is dragged. The default implementation // of this method, which is inherited from the Container class, clears the // applet's drawing area to the background color prior to calling paint(). // This clearing followed by drawing causes flicker. CheckerDrag overrides // update() to prevent the background from being cleared, which eliminates // the flicker. // AWT調(diào)用了update()方法來響應(yīng)拖動(dòng)棋子時(shí)所調(diào)用的repaint()方法。該方法從 // Container類繼承的默認(rèn)實(shí)現(xiàn)會(huì)在調(diào)用paint()之前,將applet的繪圖區(qū)域清除 // 為背景色,這種繪制之后的清除就導(dǎo)致了閃爍。CheckerDrag重寫了update()來 // 防止背景被清除,從而消除了閃爍。 public void update (Graphics g) { paint (g); }}

求JAVA源代碼

我用了半個(gè)小時(shí) 幫你寫了一個(gè)簡(jiǎn)單的驗(yàn)證用戶名和密碼登陸問題 別辜負(fù)我的好意 下面是代碼!(建好包和類 代碼粘過去就能用)

實(shí)體類 包entity

-------------------------------------------------------------

package entity;

/**

* 用戶實(shí)體類

* @author new

*

*/

public class Users {

private String name;//用戶名

private String pass;//用戶密碼

/**

* 空的構(gòu)造函數(shù) 用戶實(shí)力化 此類對(duì)象

*/

public Users(){

}

/**

* 構(gòu)造函數(shù) 接收用戶名和密碼

* @param name

* @param pass

*/

public Users(String name, String pass) {

this.name = name;

this.pass = pass;

}

/**

* 下面set和get方法就不用解釋了吧

* @return

*/

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getPass() {

return pass;

}

public void setPass(String pass) {

this.pass = pass;

}

}

數(shù)據(jù)庫(kù)類 包dao(我是模擬一下數(shù)據(jù)庫(kù) 沒有用到數(shù)據(jù)庫(kù))

--------------------------------------------------------------

package dao;

import java.util.*;

import entity.Users;//導(dǎo)入實(shí)體類

/**

* 模擬數(shù)據(jù)庫(kù) 用戶DAO

* @author new

*

*/

public class UsersDAO {

private static Users users=new Users();

static

{

users.setName("tom");

users.setPass("jerry");

}

/**

* 根據(jù)姓名查找這個(gè)用戶 (模擬一下數(shù)據(jù)庫(kù))

* @param name

* @return

*/

public Users findUserByName(String name)

{

if(name.equals(this.users.getName()))

{

return this.users;

}

return null;

}

}

業(yè)務(wù)類 包service (驗(yàn)證用戶名和密碼)

------------------------------------------------------------

package service;

import dao.UsersDAO;

import entity.Users;

/**

* 驗(yàn)證密碼 業(yè)務(wù)類

* @author new

*

*/

public class validatePass {

//實(shí)力化DAO對(duì)象

private UsersDAO us=new UsersDAO();

/**

* 驗(yàn)證輸入的密碼是否正確

* @param name

* @param pass

* @return

*/

public Users validate(String name,String pass)

{

Users user=null;

user=us.findUserByName(name);

//如果不為空 說明查到了

if(user!=null)

{

//用查詢出來對(duì)象的密碼和傳過來的密碼比較

if(user.getPass().equals(pass))

{

return user;

}

}

return null;

}

}

最后是測(cè)試test類 包test

----------------------------------------------------------

package test;

import entity.Users;

import service.validatePass;

/**

* 測(cè)試類

* @author new

*

*/

public class test {

/**

* main方法 用于測(cè)試

* @param args

*/

public static void main(String[] args)

{

//實(shí)例化業(yè)務(wù)類對(duì)象

validatePass v=new validatePass();

//用戶名和密碼

String name="tom";

String pass="jerry";

//開始驗(yàn)證

Users user=v.validate(name, pass);

if(user==null)

{

System.out.println("你輸入的用戶名或密碼錯(cuò)誤!");

}else

{

System.out.println("你已經(jīng)通過驗(yàn)證,成功登陸!");

}

}

}

java問題,求源代碼

import java.util.Scanner;

public class Q {

public static void main(String[] args) {

Scanner scan=new Scanner(System.in);

System.out.println("請(qǐng)輸入兩個(gè)字符");

String s=scan.nextLine();

boolean flag=true;

String msg="";

if(s.length()==2){

String first=s.substring(0,1);

String second=s.substring(1);

if(first.equals("M")){

msg+="數(shù)學(xué)";

}else if(first.equals("C")){

msg+="計(jì)算機(jī)科學(xué)";

}else if(first.equals("I")){

msg+="信息技術(shù)";

}else{

flag=false;

}

msg+=" ";

if(second.equals("1")){

msg+="大一";

}else if(second.equals("2")){

msg+="大二";

}else if(second.equals("3")){

msg+="大三";

}else if(second.equals("4")){

msg+="大四";

}else{

flag=false;

}

}

if(flag){

System.out.println(msg);

}else{

System.out.println("輸入不合法");

}

}

}

有問題請(qǐng)追問,沒問題請(qǐng)采納。

java新手,求完整的源代碼

//都是從新手過來的,以下代碼供參考

//1.

public?class?BankAccount?{

private?static?String?acctnum;

private?static?double?money;

private?static?void?showAcct()?{

System.out.println("賬號(hào)為:?"?+?acctnum);

}

private?static?void?showMoney()?{

System.out.println("余額為:?"?+?money);

}

public?BankAccount(String?acc,?double?m)?{

this.acctnum?=?acc;

this.money?=?m;

}

public?static?void?main(String[]?args)?{

BankAccount?ba?=?new?BankAccount("626600018888",?5000.00);

ba.showAcct();

ba.showMoney();

}

}

//2.

public?class?Triangle?{

private?static?float?a;

private?static?float?b;

private?static?float?c;

public?Triangle(float?a,?float?b,?float?c)?{

this.a?=?a;

this.b?=?b;

this.c?=?c;

}

public?static?boolean?judgeTriangle(float?a,?float?b,?float?c)?{

if?((a??Math.abs(b?-?c)??a??b?+?c)

?(b??Math.abs(a?-?c)??b??a?+?c)

?(c??Math.abs(a?-?b)??c??a?+?b))

return?true;

else

return?false;

}

public?float?getCircumference()?{

return?this.a?+?this.b?+?this.c;

}

}

//3.

public?class?TestTriangle?{

public?static?void?main(String[]?args)?{

Triangle?t?=?new?Triangle(5.3f,7.8f,9.3f);

if(t.judgeTriangle(5.3f,7.8f,9.3f)){

System.out.print("能夠成三角形,周長(zhǎng)為:?");

System.out.printf("%9.2f",t.getCircumference());}

else

System.out.println("不能構(gòu)成三角形");

}

}

求java源代碼

BS 架構(gòu)很好做??!就是單表 select \ insert update delete 操作, 這個(gè)功能很好寫的,你說的這些代碼,有些還可以用工具生成

一道Java編程題 求源代碼

public class Invoice {

String bianhao = null;

String shuoming = null;

int count = 0;

double price = 0.0;

public Invoice(String bianhao, String shuoming, int count, double price) {

this.bianhao = bianhao;

this.shuoming = shuoming;

if (count 0) {

this.count = 0;

} else {

this.count = count;

}

if (price 0.0) {

this.price = 0.0;

} else {

this.price = price;

}

}

public double getInvoiceAmount() {

return count * price;

}

public String getBianhao() {

return bianhao;

}

public void setBianhao(String bianhao) {

this.bianhao = bianhao;

}

public int getCount() {

return count;

}

public void setCount(int count) {

this.count = count;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

public String getShuoming() {

return shuoming;

}

public void setShuoming(String shuoming) {

this.shuoming = shuoming;

}

}

public class InvoiceTest {

/**

* @param args

*/

public static void main(String[] args) {

Invoice invoice = new Invoice("010220", "Desk", 50, 53.9);

System.out.println(invoice.getInvoiceAmount());

}

}

文章標(biāo)題:java求主源代碼,java核心源碼包
文章網(wǎng)址:http://aaarwkj.com/article0/hsooio.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號(hào)、、電子商務(wù)、服務(wù)器托管商城網(wǎng)站、建站公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作
国产精品亚洲综合制服日韩| 欧美精品一区二区三区乱码| 亚洲视频欧美视频自拍偷拍| 成人av在线播放亚洲| 国产欧美一区二区另类精品 | 日日添夜夜躁欧美一区二区| 国产一区二区精品小视频| 欧美激情另类综合国内| 日本免费中文字幕在线| 亚洲av日韩专区在线观看| 欧美日本国产高清不卡| 91免费版在线观看网址| 亚洲日本韩国福利久久| 亚洲国产一区二区三区三州| 日本不卡一区二区视频| 成年女人大片免费观看版| 自拍偷拍一区蜜桃视频| 国产又粗又长又大无遮挡| 丰满少妇一区二区自拍区| 日本中文字幕激情在线| 久久久国产精品9999综合| 色欧美在线视频观看日韩| 在线成人免费日韩视频| 日韩成人免费观看视频| 人妻一区二区三区中文字幕| 亚洲熟妇人妻一区二区三区| 不卡的av中文字幕在线播放| 欧美一级黄色免费电影| 能在线播放的国产三级| 丰满少妇诱惑在线观看| 91九色精品视频在线观看| 亚洲香蕉视频在线播放| 蜜桃视频中文字幕二区三区 | 欧美日韩国产另类久久| 国欧美一区二区三区| 中文字幕黄色三级视频| 精品毛片久久久久久久久| 色偷拍亚洲偷自拍二区| 日韩人妻精品在线一区二区| 久久精品国产亚洲成人av| 亚洲国产在线一区二区|