真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

包含Java描寫植物代碼的詞條

哪位大俠可以幫我寫一段java代碼!是關(guān)于根據(jù)數(shù)據(jù)庫里的數(shù)據(jù)來形成一個動態(tài)樹形圖

這是代碼,你可以自己調(diào)試一下。

我們提供的服務(wù)有:網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、蘄春ssl等。為數(shù)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的蘄春網(wǎng)站制作公司

數(shù)據(jù)結(jié)構(gòu)如下:

CREATE TABLE dtree (

id int,

pid int,

name varchar(200),

url varchar(200),

title varchar(200),

target varchar(200),

icon varchar(200),

iconopen varchar(200),

opened bit);

為了實(shí)現(xiàn)獲取數(shù)據(jù)庫變量功能,需要建立一個DTree類,并編譯生成CLASS文件,放入\WEB-INF\classes文件夾下。

DTree類代碼如下:

package work3;

public class DTree {

private int id;

private int pid;

private String name;

private String url;

private String title;

private String target;

private String icon;

private String iconOpen;

private int opened;

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public int getPid() {

return pid;

}

public void setPid(int pid) {

this.pid = pid;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getUrl() {

return url;

}

public void setUrl(String url) {

this.url = url;

}

public String getTitle() {

return title;

}

public void setTitle(String title) {

this.title = title;

}

public String getTarget() {

return target;

}

public void setTarget(String target) {

this.target = target;

}

public String getIcon() {

return icon;

}

public void setIcon(String icon) {

this.icon = icon;

}

public String getIconOpen() {

return iconOpen;

}

public void setIconOpen(String iconOpen) {

this.iconOpen = iconOpen;

}

public int getOpened() {

return opened;

}

public void setOpened(int opened) {

this.opened = opened;

}

}

work3.jsp代碼如下:

%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%

%@ page import="java.sql.*"%

jsp:useBean id='settree' scope="application" class="work3.DTree" /

!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

""

html

head

meta http-equiv="Content-Type" content="text/html; charset=GB18030"

link rel="StyleSheet" href="dtree.css" type="text/css" /

script type="text/javascript" src="dtree.js"/script

titledTree in MySQL/title

/head

body

h2

Example

/h2

div class="dtree"

p

a href="javascript: d.openAll();"open all/a |

a href="javascript: d.closeAll();"close all/a

/p

script type="text/javascript"

!--

d = new dTree('d');

%

//驅(qū)動程序名

String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";

//數(shù)據(jù)庫用戶名

String userName = "sa";

//密碼

String userPwd = "1";

//數(shù)據(jù)庫名

String dbName = "master";

//表名

String tableName = "dtree";

//連接字符串

String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName="+dbName;

//加載驅(qū)動

Class.forName(driverName).newInstance();

//連接數(shù)據(jù)庫

java.sql.Connection conn = DriverManager.getConnection(url,userName,userPwd);

//得到Statement實(shí)例

java.sql.Statement statement = conn.createStatement();

//查詢數(shù)據(jù)

String sql = "select * from " + tableName;

//返回結(jié)果

java.sql.ResultSet rs = statement.executeQuery(sql);

//獲取變量

while (rs.next()) {

settree.setId(rs.getInt(1));

settree.setPid(rs.getInt(2));

settree.setName(rs.getString(3));

settree.setUrl(rs.getString(4));

settree.setTitle(rs.getString(5));

settree.setTarget(rs.getString(6));

settree.setIcon(rs.getString(7));

settree.setIconOpen(rs.getString(8));

settree.setOpened(rs.getInt(9));

if(settree.getPid()==0)

settree.setOpened(1);

%

d.add(%=settree.getId()%,%=settree.getPid()%,'%=settree.getName()%','%=settree.getUrl()%','%=settree.getTitle()%','%=settree.getTarget()%','','',%=settree.getOpened()%);

%

}

%

document.write(d);

//--

/script

/div

/body

/html

求JAVA編程代碼…………

下面是WINDOW界面的代碼,用JAVA SWING寫的。

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class PlusWhile {

//主面板

private JFrame mainTop = null;

private JPanel inPanel = null; //輸入面板

private JPanel outPanel = null;//輸出面板

private JButton count = null; //按鈕

private JTextField inText = null; // 輸入文本框

private JTextField result = null;//結(jié)果文本框

private JLabel resultOut = null;//輸出提示

private JLabel remindIn = null;//輸入提示

//初始化方法

private void init() {

//組件實(shí)例化

mainTop = new JFrame("階乘計(jì)算器");

inPanel = new JPanel();

outPanel = new JPanel();

count = new JButton("計(jì)算");

inText = new JTextField(10);

result = new JTextField(10);

resultOut = new JLabel("計(jì)算的結(jié)果:");

remindIn = new JLabel("請輸入要計(jì)算的正整數(shù):");

//添加輸入組件

inPanel.add(remindIn);

inPanel.add(inText);

inPanel.add(count);

//添加輸出組件

outPanel.add(resultOut);

outPanel.add(result);

result.setEnabled(false);

//設(shè)置布局樣式

mainTop.setLayout(new BorderLayout());

//主面板添加組件

mainTop.add(inPanel, BorderLayout.NORTH);

mainTop.add(outPanel, BorderLayout.SOUTH);

//設(shè)置監(jiān)聽

count.addActionListener(new ButtonListener());

//設(shè)置屏顯位置

mainTop.setLocation(350 , 300);

mainTop.pack();

mainTop.setVisible(true);

mainTop.setAlwaysOnTop(true);

//設(shè)置關(guān)閉事件

mainTop.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

//監(jiān)聽類

private class ButtonListener implements ActionListener {

public void actionPerformed(ActionEvent event) {

int inputNum = 0;

String input = inText.getText();

//若輸入為非數(shù)字,提示錯誤

try {

inputNum = Integer.parseInt(input);

}catch(Exception e) {

inputNum = -1;

}

//輸入數(shù)值小于0,提示錯誤

if(inputNum 0) {

inText.setText("請輸入正確的數(shù)值!");

result.setText("");

}

else if(inputNum == 0) {//輸入值為0處理

result.setText("1");

}

else {//輸入值為正整數(shù),計(jì)算階乘

int temp = inputNum;

while(inputNum 1) {

temp *= --inputNum;

}

result.setText(temp + "");

}

}

}

//入口方法

public static void main(String[] args) {

new PlusWhile().init();

}

}

有什么不明白的繼續(xù)補(bǔ)充,呵呵。 加點(diǎn)兒分不。

java代碼寫一個zoo類,要求生成若干個Animal.fish.和bird.并調(diào)用他們的屬性和方

public class zoo{

String name;

int age;

public zoo(String a,int b){

name = a;

age = b;

}

public String getName(){

return name;

}

public int getAge(){

return age;

}

public static void main(String args[]) {

zoo animal1 = new zoo(fish,1);

zoo animal2 = new zoo(bird,2);

String m = animial1.getName();

String n = animial2.getName();

String p = animal1.age;

String q = animal2.age;

System.out.println("動物為 +m +年齡為+p+");

System.out.println("動物為 + n+年齡為+q+");

}

}

說明,本人只是自己輸入的代碼,并沒有調(diào)試,只是告訴你一個框架或是模板,如果需要別的功能,自己添加即可。調(diào)試不過,可以在問我,我會告訴你的。

跪求JAVA代碼三葉玫瑰線 r=asin3θ或r=acos3θ。謝謝

三葉玫瑰并不是植物,你也說啦,是專門研究數(shù)學(xué)的。其實(shí)是一種三葉玫瑰線的 java代碼

S 3:

輸入下面程序用于輸出三葉玫瑰線的圖形,三葉玫瑰線的參數(shù)方程為:

x = r * sin(3t)* sin(t);y = r *sin(3t) * sin(t) 其中: 0 = t = 2 * 3.14159

#include stdio.h

#include math.h

#define RADIUS 12

#define PII 3.14159

void main(void)

{

char tx[2 * RADIUS + 1][2 * RADIUS + 1];

int nT;

int nX;

int nY;

double dbD;

for(nX = 0; nX 2 * RADIUS + 1; nX++)

{

for(nY = 0; nY 2 * RADIUS + 1; nY++)

{

tx[nX][nY] = '';

}

}

for(nT = 0; nT = 360; nT += 4)

{

dbD = nT * PII / 180;

nX = (int)(RADIUS * sin(3 * dbD) * sin(dbD)) + RADIUS;

nY = (int)(RADIUS * sin(3 * dbD) * cos(dbD)) + RADIUS;

tx[nX][nY] = '*';

}

for(nX = 0; nX 2 * RADIUS + 1; nX++)

{

for(nY = 0; nY 2 * RADIUS + 1; nY++)

{

printf("%2c", tx[nX][nY]);

}

printf("\n");

}

}


名稱欄目:包含Java描寫植物代碼的詞條
當(dāng)前網(wǎng)址:http://weahome.cn/article/hcigss.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部