欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

個人日記系統(tǒng)代碼java 日記本源碼

java日記本源代碼

晚上,已經(jīng)快九點鐘了,我看了會兒電視,肚子餓得“咕咕”直叫,于是我對媽媽說:“我餓了。”媽媽說:“想吃些什么呢?”我想了想說:“那就吃點面條吧。”

創(chuàng)新互聯(lián)成立于2013年,先為禮縣等服務建站,禮縣等地企業(yè),進行企業(yè)商務咨詢服務。為禮縣企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。

“自己也十歲了,該做點事情了。”媽媽對我說。

于是我來到廚房自己下面條吃。我先放了半鍋水,然后把鍋放在煤氣灶上燒,藍色的爐火很快把水燒開了。打開鍋蓋,一股熱所直撲我的臉,鍋里的水上下翻滾。

我用勺子小心翼翼地打了點開水倒進碗里,然后抓一把干面放進鍋里燒,再用筷子輕輕地翻一翻。趁鍋里在煮面條的時候,我往碗里放作料把豬油、蔥花、味精、醬油放進碗里 。眨眼工夫,只見鍋里邊一層白沫慢慢往外溢。我知道面已經(jīng)熟了,就關(guān)掉了煤氣灶,把面條裝進碗里,再用筷子拌一拌就可以吃了。

了解Java日志系統(tǒng)框架的設(shè)計與實現(xiàn)

在Java 領(lǐng)域 存在大量的日志組件 open open收錄了 個日志組件 日志系統(tǒng)作為一種應用程序服務 對于跟蹤調(diào)試 程序狀態(tài)記錄 崩潰數(shù)據(jù)恢復都有著重要的作用 我們可以把Java日志系統(tǒng)看作是必不可少的跟蹤調(diào)試工具

簡介

日志系統(tǒng)是一種不可或缺的跟蹤調(diào)試工具 特別是在任何無人職守的后臺程序以及那些沒有跟蹤調(diào)試環(huán)境的系統(tǒng)中有著廣泛的應用 長期以來 日志系統(tǒng)作為一種應用程序服務 對于跟蹤調(diào)試 程序狀態(tài)記錄 崩潰數(shù)據(jù)恢復都有非常現(xiàn)實的意義 這種服務通常以兩種方式存在

日志系統(tǒng)作為服務進程存在 Windows中的的事件日志服務就屬于這種類型 該類型的日志系統(tǒng)通常通過消息隊列機制將所需要記錄的日志由日志發(fā)送端發(fā)送給日志服務 日志發(fā)送端和日志保存端通常不在同一進程當中 日志的發(fā)送是異步過程 這種日志服務通常用于管理員監(jiān)控各種系統(tǒng)服務的狀態(tài)

日志系統(tǒng)作為系統(tǒng)調(diào)用存在 Java世界中的日志系統(tǒng)和Unix環(huán)境下諸多守護進程所使用的日志系統(tǒng)都屬于這種類型 日志系統(tǒng)的代碼作為系統(tǒng)調(diào)用被編譯進日志發(fā)送端 日志系統(tǒng)的運行和業(yè)務代碼的運行在同一進程空間 日志的發(fā)送多數(shù)屬于同步過程 這種日志服務由于能夠同步反映處系統(tǒng)運行狀態(tài) 通常用于調(diào)試跟蹤和崩潰恢復

本文建立的日志系統(tǒng)基本屬于第二種類型 但又有所不同 該日志系統(tǒng)將利用Java線程技術(shù)實現(xiàn)一個既能夠反映統(tǒng)一線程空間中程序運行狀態(tài)的同步日志發(fā)送過程 又能夠提供快速的日志記錄服務 還能夠提供靈活的日志格式配置和過濾機制

系統(tǒng)調(diào)試的誤區(qū)

在控制臺環(huán)境上調(diào)試Java程序時 此時往控制臺或者文本文件輸出一段文字是查看程序運行狀態(tài)最簡單的做法 但這種方式并不能解決全部的問題 有時候 對于一個我們無法實時查看系統(tǒng)輸出的系統(tǒng)或者一個確實需要保留我們輸出信息的系統(tǒng) 良好的日志系統(tǒng)顯得相當必要 因此 不能隨意的輸出各種不規(guī)范的調(diào)試信息 這些隨意輸出的信息是不可控的 難以清除 可能為后臺監(jiān)控 錯誤排除和錯誤恢復帶來相當大的阻力

日志系統(tǒng)框架的基本功能

一個完備的日志系統(tǒng)框架通常應當包括如下基本特性

所輸出的日志擁有自己的分類 這樣在調(diào)試時便于針對不同系統(tǒng)的不同模塊進行查詢 從而快速定位到發(fā)生日志事件的代碼

日志按照某種標準分成不同級別 分級以后的日志 可以用于同一分類下的日志篩選

支持多線程 日志系統(tǒng)通常會在多線程環(huán)境中使用 特別是在Java系統(tǒng)當中 因此作為一種系統(tǒng)資源 日志系統(tǒng)應當保證是線程安全的

支持不同的記錄媒介 不同的工程項目往往對日志系統(tǒng)的記錄媒介要求不同 因此日志系統(tǒng)必須提供必要的開發(fā)接口 以保證能夠比較容易的更換記錄介質(zhì)

高性能 日志系統(tǒng)通常要提供高速的日志記錄功能以應對大系統(tǒng)下大請求流量下系統(tǒng)的正常運轉(zhuǎn)

穩(wěn)定性 日志系統(tǒng)必須是保持高度的穩(wěn)定性 不能因為日志系統(tǒng)內(nèi)部錯誤導致主要業(yè)務代碼的崩潰

常用日志系統(tǒng)簡介

在Java世界中 以下三種日志框架比較優(yōu)秀

)Log J

最早的Java日志框架之一 由Apache基金會發(fā)起 提供靈活而強大的日志記錄機制 但是其復雜的配置過程和內(nèi)部概念往往令使用者望而卻步

)JDK LoggingFramework

繼Log J之后 JDK標準委員會將Log J的基本思想吸收到JDK當中 在JDK 中發(fā)布了第一個日志框架接口 并提供了一個簡單實現(xiàn)

)CommonsLoggingFramwork

該框架同樣是Apache基金會項目 其出現(xiàn)主要是為了使得Java項目能夠在Log J和JDK lLoggingFramework的使用上隨意進行切換 因此該框架提供了統(tǒng)一的調(diào)用接口和配置方法

系統(tǒng)設(shè)計

由于Log J得到廣泛應用 從使用者的角度考慮 本文所設(shè)計的框架 采用了部分Log J的接口和概念 但內(nèi)部實現(xiàn)則完全不同 使用Java實現(xiàn)日志框架 關(guān)鍵的技術(shù)在于前面提及的日志框架特性的內(nèi)部實現(xiàn) 特別是 日志的分類和級別 日志分發(fā)框架的設(shè)計 日志記錄器的設(shè)計以及在設(shè)計中的高性能和高穩(wěn)定性的考慮

系統(tǒng)架構(gòu)

日志系統(tǒng)框架可以分為日志記錄模塊和日志輸出模塊兩大部分 日志記錄模塊負責創(chuàng)建和管理日志記錄器(Logger) 每一個Logger對象負責按照不同的級別(LoggerLevel)接收各種記錄了日志信息的日志對象(LogItem) Logger對象首先獲取所有需要記錄的日志 并且同步地將日志分派給日志輸出模塊 日志輸出模塊則負責日志輸出器(Appender)的創(chuàng)建和管理 以及日志的輸出 系統(tǒng)中允許有多個不同的日志輸出器 日志輸出器負責將日志記錄到存儲介質(zhì)當中 系統(tǒng)結(jié)構(gòu)如下圖 所示

java如何做系統(tǒng)操作日志?

手頭沒有代碼,用文字書寫比較麻煩,說說思路吧:

1):操作日志與每一個人的系統(tǒng)權(quán)限密切相關(guān),在前期定義權(quán)限的時候,必須區(qū)分好每一個用戶級別的權(quán)限(一級菜單與菜單下具體功能),需要用多張表進行權(quán)限標識,并且建立各個表之間的關(guān)聯(lián)關(guān)系(具體設(shè)置此處略)。

2):當用戶點擊系統(tǒng)內(nèi)每一個功能(每一個功能按鈕)的時候,一方面實現(xiàn)按鈕功能(新建按鈕實現(xiàn)新建功能),另外一方面將此處的功能名稱、模塊名稱、用戶名、時間等信息一并存儲到用戶操作表里面。

3):在用戶操作查詢頁面輸入相應的條件,在用戶操作表內(nèi)查詢即可。

誰幫用java編一個日記本程式

誰幫用java編一個日記本程式

請問樓主有沒有學過JAVA,如果沒有學過我可以幫我做,如果學過你自己做一遍我?guī)湍銠z查一下。現(xiàn)在我已經(jīng)幫你做好了這個JAVA日記本程式,并用訊息發(fā)給你了,請查收吧。

求JAVA高手教我程式設(shè)計,要求做一個日記本.謝謝.

我有做記事本的程式。QQ群:18600314

一個文具盒和2個日記本54元錢,2個書包和2個日記本80元錢,一個文具盒和一個日記本一共多少錢

一個文具盒和2個日記本54元錢,2個書包和2個日記本80元錢,一個文具盒和一個日記本一共多少錢

提供的條件不夠充分

無法解題

王阿姨三天賣了七包日記本一包30個日記本每個日記本五元平均每天賣了多少個日記本

這道題這樣算,

30×7÷3=70個,

平均每天賣了70個。

推薦一個日記本軟體

資料夾保護2008

可以對資料夾進行加密碼、隱藏、偽裝的保護。快捷,方便的解決你檔案保密問題。

【軟體特色】

1 保密性好:資料夾加密碼后,開啟資料夾要輸入正確密碼。而且在任何環(huán)境下均不失效。資料夾隱藏后,在任何環(huán)境下不通過本軟體無法找到你隱藏的資料夾。資料夾偽裝后,資料夾變成了偽裝的物件,開啟也看不到資料夾里原有的檔案。

2 使用簡單方便:在要保護的資料夾上單擊右鍵,在彈出的選單中有[資料夾加密碼]、[資料夾隱藏]、[資料夾偽裝]這三項保護措施。你選擇需要的一種保護即可。

3 快速安全:進行保護的速度特快,無論資料夾大小。軟體采用的是成熟、優(yōu)秀的資料保護技術(shù),安全性高。

4 加密碼的資料夾,使用完畢后,依然是一個加密碼的資料夾,無須再次加密碼。

幫忙找一個手機java日記本

難找啊!

怎樣裝扮一個日記本?_?

嘻嘻,還 可以在日記本上貼每天做的事情中的一個標志,就是比如今天你剪了頭發(fā)了就貼一根頭發(fā)在那頁上,去那里旅游了 就把照片或那里帶來的笑東西貼上去(當然是 要 很小的東西如花瓣啊樹葉啊)。

還可以在每篇日志寫完后畫畫今天遇到的人的樣子或今天你的整體表情。漫畫般的很可愛哦

4支鋼筆5個日記本共用22元,如買5支鋼筆4個日記本要用23元,鋼筆和日記本各是多少元? 求解題過程

設(shè)鋼筆x元,日記本y元,列方程如下:

4x+5y=22

5x+4y=23

解二元一次方程,得x=3,y=2

鋼筆3元,日記本2元

找個日記本軟體

恩 東日筆記本是不錯 我也在用

還可以記流水賬的

女孩子可以用 秘密花園日記本

用java編寫一個“我的日記”的界面并使其實現(xiàn)寫日記的功能, 最好含有登陸界面的

代碼如下,自己測試哦

import java.awt.event.ActionListener;

import javax.swing.*;

import java.awt.*;

import java.awt.Color;

import java.awt.event.ActionEvent;

import javax.swing.tree.*;

import javax.swing.event.*;

import java.io.*;

import java.util.*;

import javax.swing.JColorChooser;

class Diary extends JFrame implements ActionListener,TreeSelectionListener{

JMenuBar menubar;

JMenu menu1,menu2,menu3,menu4,menu5,menu6;

JMenuItem item1,item2,item3,item4,item5,item6,item7,item8,item52,item61,item62,item63,item64;

JTextArea text=new JTextArea(20,40);

JButton b_save=new JButton("保存日志");

JButton b_del=new JButton("刪除日志");

JButton b3=new JButton("鎖定日志");

JButton b4=new JButton("解除鎖定");

JSplitPane split1,split2;

JScrollPane scroll1,scroll2;

JPanel p;

JTree tree=null;

int i=0;

DefaultMutableTreeNode root;

DefaultMutableTreeNode month[]=new DefaultMutableTreeNode[13];

Diary(){

final JFrame frame = this;

menubar=new JMenuBar();

menu4=new JMenu("登陸");

item6=new JMenuItem("密碼登陸");

menu4.add(item6);

menubar.add(menu4);

menu1=new JMenu("文件");

item1=new JMenuItem("新建");

item2=new JMenuItem("退出");

menu1.add(item1);

menu1.add(item2);

menubar.add(menu1);

menu2=new JMenu("編輯");

item3=new JMenuItem("復制");

item4=new JMenuItem("剪切");

item5=new JMenuItem("粘貼");

item52=new JMenuItem("全選");

menu2.add(item3);

menu2.add(item4);

menu2.add(item5);

menu2.add(item52);

menubar.add(menu2);

menu3=new JMenu("設(shè)置");

//item6=new JMenuItem("密碼設(shè)置");

item63=new JMenuItem("設(shè)置字體顏色");

item64=new JMenuItem("設(shè)置背景顏色");

item61=new JMenuItem("鎖定編輯區(qū)");

item62=new JMenuItem("解除鎖定");

//menu3.add(item6);

menu3.add(item63);

menu3.add(item64);

menu3.add(item61);

menu3.add(item62);

menubar.add(menu3);

menu4=new JMenu("查看");

item7=new JMenuItem("狀態(tài)欄");

menu4.add(item7);

menubar.add(menu4);

menu5=new JMenu("幫助");

item8=new JMenuItem("我的日記本信息");

menu5.add(item8);

menubar.add(menu5);

setJMenuBar(menubar); //把菜單條添加到窗口頂端

Container con=getContentPane(); //調(diào)用getContentPane()方法獲的內(nèi)容面板

root=new DefaultMutableTreeNode("日歷記事本"); //結(jié)合樹的輸入與輸出建立一個日歷記事本

for(i=1;i=12;i++)

{

month[i]=new DefaultMutableTreeNode(""+i+"月");

root.add(month[i]);

}

for(i=1;i=12;i++)

{

if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)

{

for(int j=1;j=31;j++)

month[i].add(new DefaultMutableTreeNode(j+"日"));

}

else if(i==4||i==6||i==9||i==11)

{

for(int j=1;j=30;j++)

month[i].add(new DefaultMutableTreeNode(j+"日"));

}

else

{

for(int j=1;j=28;j++)

month[i].add(new DefaultMutableTreeNode(j+"日"));

}

}

tree=new JTree(root);

p=new JPanel(); //使用JPanel創(chuàng)建一個面板

p.add(b_save);p.add(b_del);p.add(b3);p.add(b4); //把這4個按鈕組件假如面板中

scroll1=new JScrollPane(text,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //把文本框放入滾動窗格中

b_save.addActionListener((ActionListener) this); //按鈕的監(jiān)聽器

b_del.addActionListener((ActionListener) this);

scroll2=new JScrollPane(tree);

split1=new JSplitPane(JSplitPane.VERTICAL_SPLIT,true,p,scroll1); //水平拆分這4個按鈕和文本區(qū)

split2=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,scroll2,split1); //豎直拆分樹行日歷和文本按鈕區(qū)

item1.addActionListener((ActionListener) this); //菜單欄的監(jiān)聽器

item2.addActionListener((ActionListener) this);

item3.addActionListener((ActionListener) this);

item4.addActionListener((ActionListener) this);

item5.addActionListener((ActionListener) this);

item6.addActionListener((ActionListener) this);

item7.addActionListener((ActionListener) this);

item8.addActionListener((ActionListener) this);

item52.addActionListener((ActionListener) this);

item61.addActionListener((ActionListener) this);

item62.addActionListener((ActionListener) this);

item63.addActionListener((ActionListener) this);

tree.addTreeSelectionListener((TreeSelectionListener) this); //樹形日歷的監(jiān)聽器

con.setLayout(new FlowLayout()); //設(shè)置布局

setSize(600,500); //設(shè)置窗體的大小

Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();

setLocation((screen.width-300)/2,(screen.height-220)/2);

setResizable(false); //設(shè)置窗口不可以調(diào)節(jié)大小

setVisible(true); //設(shè)置窗口為可視

con.add(split2); //把樹形日歷和按鈕,文本區(qū)都加入到內(nèi)容面板中

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //單擊關(guān)閉圖標后關(guān)閉窗口

}

public void valueChanged(TreeSelectionEvent e) //處理樹形事件的接口

{

text.setText(null);

if(e.getSource()==tree)

{

DefaultMutableTreeNode node=(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();

if(node.isLeaf())

{

String str=node.toString();

for( i=0;i=12;i++)

{

if(node.getParent()==month[i])

{

try{String temp=null;

File f=new File(node.getParent().toString()+str+".text");

FileReader file=new FileReader(f);

BufferedReader in=new BufferedReader(file);

while((temp=in.readLine())!=null)

text.append(temp+'\n');

file.close();

in.close();

}

catch(Exception el){}

}

}

}

}

}

//}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b_save) //保存按鈕的實現(xiàn)方法

{

DefaultMutableTreeNode node=(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();

String str=node.toString();

if(node.isLeaf())

{

try{

File f=new File(node.getParent().toString()+str+".text");

FileWriter tofile=new FileWriter(f);

BufferedWriter out=new BufferedWriter(tofile);

out.write(text.getText(),0,(text.getText()).length());

out.flush();

tofile.close(); out.close();

}

catch(Exception el){}

}

}

else if(e.getSource()==b_del)

{

int n=JOptionPane.showConfirmDialog(this, "該文件還沒有保存,確定要刪除嗎?","確認對話框", JOptionPane.YES_NO_OPTION);

if(n==JOptionPane.YES_OPTION)

{

DefaultMutableTreeNode node=(DefaultMutableTreeNode)tree.getLastSelectedPathComponent();

String str=node.toString();

if(node.isLeaf())

{

File f=new File(node.getParent().toString()+str+".text");

f.delete();

}

}

else if(n==JOptionPane.NO_OPTION)

{

System.exit(0);

}

}

else if(e.getSource()==b3)

{

text.setEditable(false);

}

else if(e.getSource()==b4)

{

text.setEditable(true);

}

String selected=e.getActionCommand(); //獲取命令

if(selected.equals("退出")){ //執(zhí)行"退出"命令

dispose();

}

else if(selected.equals("新建")){

text.setText("");

}

else if(selected.equals("復制"))

{

text.copy();

}

else if(selected.equals("剪切"))

{

text.cut();

}

else if(selected. equals("粘貼"))

{

text.paste();

}

else if(selected.equals("全選"))

{

text.selectAll();

}

else if(selected.equals("密碼登陸"))

{

LoginWindow login=new LoginWindow();

}

else if(selected.equals("設(shè)置字體顏色")){

Color newColor=JColorChooser.showDialog(this, "選擇字體顏色", text.getForeground());

if(newColor !=null)

{

text.setForeground(newColor);

}

}

else if(selected.equals("設(shè)置背景顏色"))

{

Color newColor=JColorChooser.showDialog(this, "選擇背景顏色", text.getBackground());

if(newColor !=null)

{

text.setBackground(newColor);

}

}

else if(selected.equals("鎖定編輯區(qū)"))

{

text.setEditable(false);

}

else if(selected.equals("解除鎖定"))

{

text.setEditable(true);

}

}

}

class LoginWindow extends JFrame implements ActionListener {

JPanel p1=new JPanel(); //定義并建立面板

JPanel p2=new JPanel();

JPanel p3=new JPanel();

JPanel p4=new JPanel();

JPanel p5=new JPanel();

JTextField text1=new JTextField(15); //用戶名文本框

JPasswordField text2=new JPasswordField(15); //密碼域

JButton ok=new JButton("確定");

JButton cancel=new JButton("取消");

LoginWindow()

{

setBackground(Color.DARK_GRAY); //設(shè)置背景顏色

Container con=getContentPane(); //取出內(nèi)容面板

con.setLayout(new GridLayout(5,1)); //設(shè)置布局為5行1列

p2.add(new JLabel("用戶名:"));p2.add(text1); //將組件添加到中間容器

p3.add(new JLabel("密碼"));p3.add(text2);

p4.add(ok);p4.add(cancel);

ok.addActionListener(this); //注冊事件監(jiān)聽器

cancel.addActionListener(this);

text1.addActionListener(this);

text2.addActionListener(this);

con.add(p1); con.add(p2); con.add(p3); con.add(p4); con.add(p5); //將面板添加到內(nèi)容面板

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //單擊關(guān)閉圖標后關(guān)閉窗口

setSize(300,220); //設(shè)置窗口的大小

Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();

setLocation((screen.width-300)/2,(screen.height-220)/2);

setTitle("登錄窗口");

setResizable(false); // 不讓用戶改變窗口大小

setVisible(true);

}

public void actionPerformed(ActionEvent e) {

if(e.getSource()==ok||e.getSource()==text2){

if(text1.getText().trim().equals("meijianwen") text2.getText().trim().equals("070341320")){

dispose(); //關(guān)閉登陸窗口

}

else{

JOptionPane.showMessageDialog(null, "用戶名或密碼錯誤!");

text1.requestFocus(); //設(shè)置焦點

text1.setSelectionStart(0); //設(shè)置選中文本開始位置

text1.setSelectionEnd(text1.getText().length());

}

}

else if(e.getSource()==cancel){ //單擊取消按鈕

dispose();

//System.exit(0);

}

else if(e.getSource()==text1) //在用戶名文本框按回車焦點移到密碼域

text2.requestFocus();

}

}

public class MyDiary

{

public static void main(String args[])

{

JFrame.setDefaultLookAndFeelDecorated(true);

Font font=new Font("JFrame",Font.PLAIN,14); //定義字體

Enumeration keys=UIManager.getLookAndFeelDefaults().keys(); //枚舉風格關(guān)鍵字

while(keys.hasMoreElements())

{

Object key=keys.nextElement();

// if(((String)key).equals("Menu.foreground")||((String)key).equals("MenuItem.foreground"))

// UIManager.put(key,Color.DARK_GRAY); //設(shè)置菜單文字顏色

if(UIManager.get(key)instanceof Font)UIManager.put(key,font);

}

Diary win=new Diary();

win.validate();

}

}

java簡單記事本源代碼 帶解釋

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.border.*;

class test implements ActionListener

{

JFrame frame;

JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24,b25,b26,b27,b28,b29,b30,b31;

JTextArea ta;

JPanel p1,p2,p3,p4;

JMenuBar mb;

JMenu m1,m2,m3;

JMenuItem mt1,mt2,mt3,mt4,mt5,mt6,mt7;

JRadioButton rb1,rb2;

ButtonGroup bg;

Double d1=0.0,d2=0.0,d3=0.0,d4=1.0,d5=1.0;

String s1="",s2="",s3="",s4="";

int a=0;

char c1;

int i=0;

public static void main(String[] args)

{

test that=new test();

that.go();

}

public void go()

{

frame=new JFrame("計算器");

Container cp= frame.getContentPane();

cp.setLayout(new FlowLayout());

b1=new JButton("7");b2=new JButton("8");b3=new JButton("9");b4=new JButton("/");b5=new JButton("1/x");b6=new JButton("sin");b7=new JButton("log");

b8=new JButton("4");b9=new JButton("5");b10=new JButton("6");b11=new JButton("*");b12=new JButton("x^y");b13=new JButton("cos");b14=new JButton("ln");

b15=new JButton("1");b16=new JButton("2");b17=new JButton("3");b18=new JButton("-");b19=new JButton(new ImageIcon("lanying.gif"));b20=new JButton("tan");b21=new JButton("x^3");

b22=new JButton("0");b23=new JButton("+/-");b24=new JButton(".");b25=new JButton("+");b26=new JButton("√x");b27=new JButton("cot");b28=new JButton("x^2");

b29=new JButton("Backspace");b30=new JButton("C");b31=new JButton("=");

mb=new JMenuBar();

m1=new JMenu("文件(F)");m2=new JMenu("編輯(E)");m3=new JMenu("幫助(H)");

mt1=new JMenuItem("清零");mt2=new JMenuItem("退出");mt3=new JMenuItem("復制");mt4=new JMenuItem("粘貼");mt5=new JMenuItem("版本");mt6=new JMenuItem("標準型");mt7=new JMenuItem("科學型");

ta=new JTextArea(1,30);

p1=new JPanel();p2=new JPanel();p3=new JPanel();p4=new JPanel();

rb1=new JRadioButton("科學型");rb2=new JRadioButton("標準型");

bg=new ButtonGroup();

b1.setForeground(Color.blue);b1.setBackground(Color.white);b2.setForeground(Color.blue);b2.setBackground(Color.white);

b3.setForeground(Color.blue);b3.setBackground(Color.white);b8.setForeground(Color.blue);b8.setBackground(Color.white);

b9.setForeground(Color.blue);b9.setBackground(Color.white);b10.setForeground(Color.blue);b10.setBackground(Color.white);

b15.setForeground(Color.blue);b15.setBackground(Color.white);b16.setForeground(Color.blue);b16.setBackground(Color.white);

b17.setForeground(Color.blue);b17.setBackground(Color.white);b22.setForeground(Color.blue);b22.setBackground(Color.white);

b23.setForeground(Color.blue);b23.setBackground(Color.white);b24.setForeground(Color.blue);b24.setBackground(Color.white);

b4.setForeground(Color.red);b4.setBackground(Color.white);b11.setForeground(Color.red);b11.setBackground(Color.white);

b18.setForeground(Color.red);b18.setBackground(Color.white);b25.setForeground(Color.red);b25.setBackground(Color.white);

b5.setForeground(Color.blue);b5.setBackground(Color.white);b6.setForeground(Color.blue);b6.setBackground(Color.white);

b7.setForeground(Color.blue);b7.setBackground(Color.white);b12.setForeground(Color.blue);b12.setBackground(Color.white);

b13.setForeground(Color.blue);b13.setBackground(Color.white);b14.setForeground(Color.blue);b14.setBackground(Color.white);

b19.setForeground(Color.blue);b19.setBackground(Color.white);b20.setForeground(Color.blue);b20.setBackground(Color.white);

b21.setForeground(Color.blue);b21.setBackground(Color.white);b26.setForeground(Color.blue);b26.setBackground(Color.white);

b27.setForeground(Color.blue);b27.setBackground(Color.white);b28.setForeground(Color.blue);b28.setBackground(Color.white);

b29.setForeground(Color.red);b29.setBackground(Color.white);b30.setForeground(Color.red);b30.setBackground(Color.white);

b31.setForeground(Color.red);b31.setBackground(Color.white);

bg.add(rb1);bg.add(rb2);

p1.setBackground(Color.yellow);

cp.setBackground(Color.CYAN);

m1.setMnemonic(KeyEvent.VK_F);m2.setMnemonic(KeyEvent.VK_E);m3.setMnemonic(KeyEvent.VK_H);

m1.add(mt6);m1.add(mt7);m1.addSeparator();m1.add(mt1);m1.addSeparator();m1.add(mt2);m2.add(mt3);m2.addSeparator();m2.add(mt4);m3.add(mt5);

mb.add(m1);mb.add(m2);mb.add(m3);

frame.setJMenuBar(mb);

p2.setLayout(new GridLayout(4,7));

p3.setLayout(new GridLayout(1,3));

ta.setEditable(false);

p1.add(ta);

p2.add(b1);p2.add(b2);p2.add(b3);p2.add(b4);p2.add(b5);p2.add(b6);p2.add(b7);

p2.add(b8);p2.add(b9);p2.add(b10);p2.add(b11);p2.add(b12);p2.add(b13);p2.add(b14);

p2.add(b15);p2.add(b16);p2.add(b17);p2.add(b18);p2.add(b19);p2.add(b20);p2.add(b21);

p2.add(b22);p2.add(b23);p2.add(b24);p2.add(b25);p2.add(b26);p2.add(b27);p2.add(b28);

p3.add(b29);p3.add(b30);p3.add(b31);

Border etched=BorderFactory.createEtchedBorder();

Border border=BorderFactory.createTitledBorder(etched,"計算類型");

p4.add(rb1);p4.add(rb2);

p4.setBorder(border);

b2.setActionCommand("8");

b2.addActionListener(this);

cp.add(p1);cp.add(p4);cp.add(p2);cp.add(p3);

frame.setSize(400,330);

frame.setVisible(true);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

b1.setActionCommand("7");

b1.addActionListener(this);

b2.setActionCommand("8");

b2.addActionListener(this);

b3.setActionCommand("9");

b3.addActionListener(this);

b4.setActionCommand("/");

b4.addActionListener(this);

b5.setActionCommand("1/x");

b5.addActionListener(this);

b6.setActionCommand("sin");

b6.addActionListener(this);

b7.setActionCommand("log");

b7.addActionListener(this);

b8.setActionCommand("4");

b8.addActionListener(this);

b9.setActionCommand("5");

b9.addActionListener(this);

b10.setActionCommand("6");

b10.addActionListener(this);

b11.setActionCommand("*");

b11.addActionListener(this);

b12.setActionCommand("x^y");

b12.addActionListener(this);

b13.setActionCommand("cos");

b13.addActionListener(this);

b14.setActionCommand("ln");

b14.addActionListener(this);

b15.setActionCommand("1");

b15.addActionListener(this);

b16.setActionCommand("2");

b16.addActionListener(this);

b17.setActionCommand("3");

b17.addActionListener(this);

b18.setActionCommand("-");

b18.addActionListener(this);

b19.setActionCommand("x!");

b19.addActionListener(this);

b20.setActionCommand("tan");

b20.addActionListener(this);

b21.setActionCommand("x^3");

b21.addActionListener(this);

b22.setActionCommand("0");

b22.addActionListener(this);

b23.setActionCommand("+/-");

b23.addActionListener(this);

b24.setActionCommand(".");

b24.addActionListener(this);

b25.setActionCommand("+");

b25.addActionListener(this);

b26.setActionCommand("√x");

b26.addActionListener(this);

b27.setActionCommand("cot");

b27.addActionListener(this);

b28.setActionCommand("x^2");

b28.addActionListener(this);

b29.setActionCommand("Backspace");

b29.addActionListener(this);

b30.setActionCommand("C");

b30.addActionListener(this);

b31.setActionCommand("=");

b31.addActionListener(this);

rb1.setActionCommand("kxx");

rb1.addActionListener(this);

rb2.setActionCommand("bzx");

rb2.addActionListener(this);

}

public void actionPerformed(ActionEvent e) //throws Exception

{

if (e.getActionCommand()=="bzx")

{

b5.setEnabled(false);b6.setEnabled(false);b7.setEnabled(false);

b12.setEnabled(false);b13.setEnabled(false);b14.setEnabled(false);

b19.setEnabled(false);b20.setEnabled(false);b21.setEnabled(false);

b26.setEnabled(false);b27.setEnabled(false);b28.setEnabled(false);

}

if (e.getActionCommand()=="kxx")

{

b5.setEnabled(true);b6.setEnabled(true);b7.setEnabled(true);

b12.setEnabled(true);b13.setEnabled(true);b14.setEnabled(true);

b19.setEnabled(true);b20.setEnabled(true);b21.setEnabled(true);

b26.setEnabled(true);b27.setEnabled(true);b28.setEnabled(true);

}

if (e.getActionCommand()=="1")

{

ta.append("1");

}

if (e.getActionCommand()=="2")

{

ta.append("2");

}

if (e.getActionCommand()=="3")

{

ta.append("3");

}

if (e.getActionCommand()=="4")

{

ta.append("4");

}

if (e.getActionCommand()=="5")

{

ta.append("5");

}

if (e.getActionCommand()=="6")

{

ta.append("6");

}

if (e.getActionCommand()=="7")

{

ta.append("7");

}

if (e.getActionCommand()=="8")

{

ta.append("8");

}

if (e.getActionCommand()=="9")

{

ta.append("9");

}

if (e.getActionCommand()=="0")

{

ta.append("0");

}

if (e.getActionCommand()=="+")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

ta.setText("");

i=1;

}

if (e.getActionCommand()=="-")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

ta.setText("");

i=2;

}

if (e.getActionCommand()=="*")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

ta.setText("");

i=3;

}

if (e.getActionCommand()=="/")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

ta.setText("");

i=4;

}

if (e.getActionCommand()=="=")

{

s2=ta.getText();

d2=Double.parseDouble(s2);

if(i==1)

{

d3=d1+d2;

ta.setText( d3.toString());

}

if(i==2)

{

d3=d1-d2;

ta.setText( d3.toString());

}

if(i==3)

{

d3=d1*d2;

ta.setText( d3.toString());

}

if(i==4)

{

if(d2==0.0)

ta.setText("ERROR");

else

{

d3=d1/d2;

ta.setText( d3.toString());

}

}

if (i==5)

{

s2=ta.getText();

d2 = Double.parseDouble(s2);

for (int l=1;l=d2 ; l++)

{

d5=d5*d1;

}

ta.setText( d5.toString());

}

}

if (e.getActionCommand()=="C")

{

ta.setText("");

d4=1.0;

d5=1.0;

}

/*if (e.getActionCommand()=="Backspace")

{

s3=ta.getText();

a=s3.length();

//ta.cut(ta.select(a-1,a));

s4=ta.getText(1,3);

ta.setText(s4);

}

*/

if (e.getActionCommand()=="1/x")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

d2=1/d1;

ta.setText( d2.toString());

}

if (e.getActionCommand()==".")

{

ta.append(".");

}

if (e.getActionCommand()=="+/-")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

d2=0-d1;

ta.setText( d2.toString());

}

if (e.getActionCommand()=="x^2")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

d2=d1*d1;

ta.setText( d2.toString());

}

if (e.getActionCommand()=="x^3")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

d2=d1*d1*d1;

ta.setText( d2.toString());

}

if (e.getActionCommand()=="x^y")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

ta.setText("");

i=5;

// d2=d1*d1*d1;

// ta.setText( d2.toString());

}

if (e.getActionCommand()=="√x")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

d2=Math.sqrt(d1);

ta.setText( d2.toString());

}

if (e.getActionCommand()=="x!")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

if (d10)

{

ta.setText( "error");

}

else if (d1==0)

{

ta.setText( "0.0");

}

else {

for (int k=1;k=d1 ;k++ )

d4=d4*k;

ta.setText( d4.toString());

}

}

if (e.getActionCommand()=="sin")

{

s1=ta.getText();

d1 = Double.parseDouble(s1);

d2=Math.sin(3.1415926*d1/180);

ta.setText( d2.toString());

}

}

}

分享名稱:個人日記系統(tǒng)代碼java 日記本源碼
網(wǎng)頁URL:http://chinadenli.net/article16/hgdsdg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版電子商務定制開發(fā)自適應網(wǎng)站企業(yè)建站網(wǎng)站建設(shè)

廣告

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

營銷型網(wǎng)站建設(shè)