锘??xml version="1.0" encoding="utf-8" standalone="yes"?>www.av在线播放,国产精品久久7,国内精品亚洲http://www.aygfsteel.com/lemon/zh-cnMon, 04 Aug 2025 15:06:22 GMTMon, 04 Aug 2025 15:06:22 GMT60涓涓畝鍗曟棩璁版湰鐨勬簮紼嬪簭,鍔熻兘騫朵笉瀹屽叏,璇烽珮浜烘寚鐐?/title><link>http://www.aygfsteel.com/lemon/archive/2005/12/25/25371.html</link><dc:creator>lemon</dc:creator><author>lemon</author><pubDate>Sun, 25 Dec 2005 07:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/lemon/archive/2005/12/25/25371.html</guid><wfw:comment>http://www.aygfsteel.com/lemon/comments/25371.html</wfw:comment><comments>http://www.aygfsteel.com/lemon/archive/2005/12/25/25371.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/lemon/comments/commentRss/25371.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/lemon/services/trackbacks/25371.html</trackback:ping><description><![CDATA[<P>import java.awt.*; <BR>import java.awt.event.*; <BR>import javax.swing.*; <BR>import java.util.*; <BR>import java.text.*; <BR>import java.io.*; <BR>public class Note extends Frame { </P> <P>private MenuBar mb; <BR>private Menu mset_param ,mhelp; <BR>private MenuItem mibc ,miSound; <BR>private MenuItem miabout; <BR>//緙虹渷鐨勮儗鏅鑹?<BR>private static Color backgroundcolor = Color.GRAY; </P> <P>//funtction of the button on plcb is chose year andmonth <BR>//and set alarm colock and remind booking <BR>private JCheckBox remindBook ,alarmColock; <BR>private JComboBox cbyears ,cbmonths; <BR>private JPanel plcb; <BR>//鏃ュ巻鎸夐挳 <BR>private JPanel plbt; <BR>private JButton button[]; <BR>//add vector to contain button[],so that find it <BR>private Vector v; <BR>//save the year and month <BR>private String choseyear ,chosemonth; <BR>private int choseyearint ,chosemonthint; <BR>private boolean changed = false; <BR>private boolean fileExist = false;//the application first run to find file <BR>private static boolean needSound; </P> <P>//add text to write down what to do in the future <BR>private TextArea tanote; <BR>private JPanel plta; </P> <P>//榛樿鐨勫勾浠?<BR>private final static String years[]={ <BR>"1995" ,"1996" ,"1997" ,"1998" ,"1999" ,"2000" , <BR>"2001" ,"2002" ,"2003" ,"2004" ,"2005" ,"2006" , <BR>"2007" ,"2008" ,"2009" ,"2010" ,"2011" ,"2012" , <BR>"2013" ,"2014" ,"2015" ,"2016" ,"2017" ,"2018" , <BR>"2019" ,"2020" <BR>}; </P> <P>private static final String months[] = { <BR>"January" ,"February" ,"March" ,"April" ,"May" ,"June" ,"July" ,"August" , <BR>"September" ,"October" ,"November" ,"December" <BR>}; </P> <P>private final static int dom[] = { <BR>31 ,28 ,31 ,30 ,31 ,30 ,31 ,31 ,30 ,31 ,30 ,31 <BR>}; </P> <P>//save the first day of the month to use <BR>private int start; <BR>//save the button who is entered <BR>private int btnIndex; </P> <P>public Note() { <BR>mb = new MenuBar(); <BR>mset_param = new Menu("璁劇疆"); <BR>mhelp = new Menu("甯姪"); <BR>mibc = new MenuItem("鑳屾櫙"); <BR>miSound = new MenuItem("澹伴煶"); <BR>miabout = new MenuItem("鍏充簬..."); </P> <P>mset_param.add(mibc); <BR>mset_param.addSeparator(); <BR>mset_param.add(miSound); <BR>mhelp.add(miabout); <BR>setMenuBar(mb); <BR>mb.add(mset_param); <BR>mb.setHelpMenu(mhelp); </P> <P>MListener ml = new MListener(); <BR>mibc.addActionListener(ml); <BR>miabout.addActionListener(ml); <BR>miSound.addActionListener(ml); </P> <P>cbyears = new JComboBox(); <BR>cbmonths = new JComboBox(); <BR>plcb = new JPanel(); <BR>plcb.setLayout(new FlowLayout()); <BR>JLabel lyears = new JLabel("騫翠喚:"); <BR>JLabel lmonths = new JLabel("鏈堜喚:"); <BR>plcb.add(lyears); <BR>plcb.add(cbyears); <BR>plcb.add(lmonths); <BR>plcb.add(cbmonths); <BR>remindBook = new JCheckBox("棰勭害鎻愮ず",true); <BR>alarmColock = new JCheckBox("闂歸挓"); <BR>// Dimension d = new Dimension(); <BR>// remindBook.setSize(d); <BR>// remindBook.getSize(d); <BR>// System.out.println("W:"+d.getWidth()+" H:"+d.getHeight()); <BR>plcb.add(remindBook); <BR>plcb.add(alarmColock); <BR>remindBook.addActionListener(new RemindListener()); <BR>alarmColock.addActionListener(new RemindListener()); <BR>add(plcb ,BorderLayout.NORTH); </P> <P>//add calendar <BR>getCalendar(); </P> <P>plbt = new JPanel(); <BR>plbt.setBackground(Color.BLUE); <BR>plbt.setLayout(new GridLayout(7 ,7)); </P> <P>plbt.add(new JLabel(" 鏄熸湡鏃?)); <BR>plbt.add(new JLabel(" 鏄熸湡涓")); <BR>plbt.add(new JLabel(" 鏄熸湡浜?)); <BR>plbt.add(new JLabel(" 鏄熸湡涓?)); <BR>plbt.add(new JLabel(" 鏄熸湡鍥?)); <BR>plbt.add(new JLabel(" 鏄熸湡浜?)); <BR>plbt.add(new JLabel(" 鏄熸湡鍏?)); </P> <P>//add calendar button to frame <BR>//add button to vector; <BR>v = new Vector(); <BR>button = new JButton[42]; <BR>for(int i=0;i<41;i++){ <BR>button[i] = new JButton(); <BR>plbt.add(button[i]); <BR>button[i].addActionListener(new ButtonListener()); <BR>v.add(button[i]); <BR>} </P> <P>button[41] = new JButton(); <BR>plbt.add(button[41]); <BR>button[41].setText("淇濆瓨"); <BR>button[41].addActionListener(new SaveListener()); <BR>add(plbt ,BorderLayout.CENTER); </P> <P>//add note book <BR>// plta = new JPanel(); <BR>tanote = new TextArea(5 ,80); <BR>// tanote.addTextListener(new tanoteTextListener()); <BR>// tanote.setColumns(80); <BR>// plta.add(tanote); <BR>// tanote.SCROLLBARS_VERTICAL_ONLY; <BR>add(tanote ,BorderLayout.SOUTH); </P> <P>/* <BR>//add date to button <BR>GregorianCalendar calendar = new GregorianCalendar(choseyearint ,chosemonthint ,1); <BR>int start = calendar.get(Calendar.DAY_OF_WEEK)-1; <BR>int daysInMonth = dom[chosemonthint]; <BR>if(calendar.isLeapYear(choseyearint)&&chosemonthint == 1){ <BR>++daysInMonth; <BR>} <BR>for(int i =0;i<daysInMonth;i++){ <BR>button[start+i].setText(" "+(i+1)+" "); <BR>} <BR>*/ <BR>//add the default year and month to JComboBox <BR>for(int i= 0;i<=25;i++){ <BR>cbyears.addItem(years[i]); <BR>} <BR>for(int i=0;i<12;i++){ <BR>cbmonths.addItem(months[i]); <BR>} <BR>/* <BR>//add current year and month <BR>cbyears.setSelectedIndex(choseyearint-1995); <BR>cbmonths.setSelectedIndex(chosemonthint); <BR>*/ </P> <P>//show date to calendar <BR>showDate(); <BR>//open file add to note <BR>Calendar now = new GregorianCalendar(); <BR>int num = start + now.get(Calendar.DAY_OF_MONTH)-1; <BR>btnIndex = num; <BR>readFile(num); <BR>fileSound(); </P> <P>//add threadcb to listen jcombobox state <BR>new ThreadCB().start(); </P> <P>//listen the JComboBox of years and months <BR>cbyears.addItemListener(new cbyearsItemListener()); <BR>cbmonths.addItemListener(new cbmonthsItemListener()); </P> <P>addWindowListener(new WindowAdapter() { <BR>public void windowClosing(WindowEvent e) { <BR>dispose(); <BR>System.exit(0); <BR>} <BR>}); <BR>} </P> <P>/** <BR>*add menu listener to know the menu what do want to do <BR>*/ <BR>class MListener implements ActionListener{ <BR>public void actionPerformed(ActionEvent e){ <BR>MenuItem i = (MenuItem)e.getSource(); <BR>if(i.equals(miabout)){ <BR>JOptionPane.showMessageDialog(null ,"鏃ュ巻璁頒簨鏈▼搴廣1.0","鍏充簬..." ,JOptionPane.INFORMATION_MESSAGE); <BR>} <BR>else if(i.equals(mibc)){ <BR>//backgroundcolor = Color.BLACK; <BR>backgroundcolor = JColorChooser.showDialog(null ,"閫夋嫨棰滆壊..." ,getBackground()); <BR>setBackground(backgroundcolor); <BR>plbt.setBackground(backgroundcolor); <BR>// System.out.println(choseyear); <BR>//// <BR>} <BR>else{ <BR>JOptionPane.showMessageDialog(null ,"I am sorry ,this function is not complation" ,"Sorry" ,JOptionPane.INFORMATION_MESSAGE); <BR>} <BR>} <BR>} </P> <P>/** <BR>*add the year JComboBox listener to know what active <BR>*/ <BR>class cbyearsItemListener implements ItemListener{ <BR>public void itemStateChanged(ItemEvent e){ <BR>// System.out.println(e.paramString()); <BR>// System.out.println(e.getStateChange()); <BR>// System.out.println(e.getItem().toString()); <BR>// if(e.getSource().equals("1997")){ <BR>// System.out.println("1997 is chosed"); <BR>// } <BR>// else{ <BR>// System.out.println("the System is not chose 1997"); <BR>// } <BR>// choseyear = e.getItem().toString(); <BR>changed = true; <BR>// showDate(); <BR>// cbmonths.setSelectedIndex(5); <BR>} <BR>} </P> <P>/** <BR>*add the month JComboBox listener to know what active <BR>*/ <BR>class cbmonthsItemListener implements ItemListener{ <BR>public void itemStateChanged(ItemEvent e){ <BR>// System.out.println(choseyear); <BR>// chosemonth = e.getItem().toString(); <BR>changed = true; </P> <P>// chosemonthint = Integer.parseInt(chosemonth); <BR>// System.out.println(chosemonthint); <BR>// showDate(); <BR>} <BR>} </P> <P>public static void main(String args[]) { <BR>System.out.println("Starting Note..."); <BR>Note mainFrame = new Note(); <BR>mainFrame.setSize(600, 400); <BR>mainFrame.setTitle("鏃ュ巻璁頒簨鏈?); <BR>mainFrame.setBackground(backgroundcolor); <BR>mainFrame.setVisible(true); <BR>for(int i=0;i<10;i++){ <BR>System.out.print("\007"); <BR>} <BR>// Thread dd = new ThreadCB(); <BR>// dd.start(); <BR>// mainFrame.paintCalendar(); <BR>} </P> <P>protected void getCalendar(){ <BR>Calendar now = new GregorianCalendar(); <BR>// System.out.println("year :"+now.get(Calendar.YEAR)); <BR>// System.out.println("month:"+now.get(Calendar.MONTH)); <BR>// int y = now.get(Calendar.YEAR); <BR>// choseyear = Integer.toString(y); <BR>// int m = now.get(Calendar.MONTH); <BR>// chosemonth = Integer.toString(m+1); <BR>choseyearint = now.get(Calendar.YEAR); <BR>chosemonthint = now.get(Calendar.MONTH); <BR>// System.out.println("y "+choseyear+"::"+chosemonth); <BR>} </P> <P>/** <BR>*show date to calendar <BR>*/ <BR>protected void showDate(){ <BR>GregorianCalendar calendar = new GregorianCalendar(choseyearint ,chosemonthint ,1); <BR>start = calendar.get(Calendar.DAY_OF_WEEK)-1; <BR>int daysInMonth = dom[chosemonthint]; <BR>if(calendar.isLeapYear(choseyearint)&&chosemonthint == 1){ <BR>++daysInMonth; <BR>} <BR>for(int i =0;i<daysInMonth;i++){ <BR>button[start+i].setForeground(Color.BLACK); <BR>button[start+i].setText(" "+(i+1)+" "); <BR>} <BR>//set current day <BR>int nowDay = start + calendar.get(Calendar.DAY_OF_MONTH); <BR>button[nowDay+1].setForeground(Color.RED); <BR>//add current year and month <BR>cbyears.setSelectedIndex(choseyearint-1995); <BR>cbmonths.setSelectedIndex(chosemonthint); <BR>} </P> <P>//listen the buttons active <BR>class ButtonListener implements ActionListener{ <BR>public void actionPerformed(ActionEvent e){ <BR>Object obj = e.getSource(); <BR>// System.out.println("haha"+e.getSource()); <BR>btnIndex = v.indexOf(obj); <BR>readFile(btnIndex); <BR>/* switch(v.indexOf(obj)){ <BR>case 1: <BR>System.out.println("i am button1"); <BR>break; <BR>case 2: <BR>// System.out.println("I am button2"); <BR>readFile(2); <BR>break; <BR>case 41: <BR>System.out.println(tanote.getText()); <BR>break; <BR>default: <BR>System.out.println("I do not know who am I"); <BR>break; <BR>} <BR>*/ } <BR>} </P> <P>/** <BR>*create a thread to listen the year or month鈥瞫 state <BR>*/ <BR>class ThreadCB extends Thread{ <BR>public void run(){ <BR>while(true){ <BR>if(changed){ <BR>changed = false; <BR>choseyearint = cbyears.getSelectedIndex()+1995; <BR>chosemonthint = cbmonths.getSelectedIndex(); <BR>//System.out.println("y:"+choseyearint+":M:"+chosemonthint); <BR>for(int i=0;i<40;i++){ <BR>button[i].setText(""); <BR>} <BR>showDate(); <BR>} <BR>try{ <BR>sleep(200); <BR>} <BR>catch(InterruptedException e){ <BR>System.err.println(e); <BR>} <BR>} <BR>} <BR>} </P> <P>/** <BR>* add note book listener to know the textarea active <BR>*/ <BR>/* <BR>class tanoteTextListener implements TextListener{ <BR>public void textValueChanged(TextEvent e){ <BR>//System.out.println(e.getSource()); <BR>} <BR>}*/ </P> <P>/** <BR>*check file to know the file is exist <BR>* if exist,read it to the note book <BR>*/ <BR>protected void readFile(int bt){ <BR>int y = cbyears.getSelectedIndex()+1995;//real year <BR>int m = cbmonths.getSelectedIndex()+1;//real month <BR>String fileName = Integer.toString(y) + Integer.toString(m)+"button"+Integer.toString(bt); <BR>// System.out.println("I am dudu"); <BR>// System.out.println(fileName); <BR>// String fileName = "testDay.java"; </P> <P>File file = new File(fileName); <BR>BufferedReader is; <BR>String line; <BR>StringBuffer sb = new StringBuffer(); </P> <P>tanote.setText(""); <BR>if(file.exists()){ <BR>try{ <BR>is = new BufferedReader(new FileReader(fileName)); </P> <P>while((line = is.readLine())!= null){ <BR>sb.append(line); <BR>sb.append("\n"); <BR>} <BR>is.close(); <BR>} <BR>catch(IOException e){ <BR>System.err.println(e); <BR>System.exit(0); <BR>} <BR>tanote.setText(sb.toString()); <BR>fileExist = true; <BR>} <BR>else{ <BR>System.out.println(fileName+" is not exists"); <BR>} </P> <P>} </P> <P>/** <BR>*sound <BR>*/ <BR>protected void fileSound(){ <BR>if(remindBook.isSelected()){ <BR>if(fileExist){ <BR>/* for(int i=0;i<10;i++){ <BR>System.out.println("\007"); <BR>} <BR>*/ <BR>needSound = true; <BR>} <BR>} <BR>} </P> <P>/** <BR>*listen the save button active <BR>*/ <BR>class SaveListener implements ActionListener{ <BR>public void actionPerformed(ActionEvent e){ <BR>int bt = btnIndex; <BR>int y = cbyears.getSelectedIndex()+1995;//real year <BR>int m = cbmonths.getSelectedIndex()+1;//real month <BR>String fileName = Integer.toString(y) + Integer.toString(m)+"button"+Integer.toString(bt); </P> <P>try{ <BR>BufferedWriter bw = new BufferedWriter(new FileWriter(fileName)); <BR>//int row = tanote.getRows(); <BR>//System.out.println("rows:"+row); <BR>String s = tanote.getText(); <BR>System.out.println("length:"+s.length()); <BR>bw.write(s); </P> <P>bw.close(); <BR>} <BR>catch(IOException ev){ <BR>System.err.println(ev); <BR>System.exit(0); <BR>} <BR>} <BR>} </P> <P>// <BR>class RemindListener implements ActionListener{ <BR>public void actionPerformed(ActionEvent ae){ <BR>Object obj = ae.getSource(); <BR>if(obj.equals(remindBook)){ <BR>if(remindBook.isSelected()){ <BR>System.out.println("I am selected"); <BR>} <BR>else{ <BR>System.out.println("I am not selected"); <BR>} <BR>} <BR>else{ <BR>if(alarmColock.isSelected()){ <BR>// System.out.println("I am selected"); <BR>final JFrame jf = new JFrame("璁劇疆鏃墮棿"); <BR>jf.setSize(300,100); <BR>jf.setLocation(200 ,200); <BR>jf.setVisible(true); <BR>// Font f = new Font( ,Font.BOLD ,20); <BR>JLabel jl = new JLabel("閫椾綘鐜?); <BR>String name=jl.getFont().getName(); <BR>// System.out.println("Font:"+name);//name鈥瞫 value is Dialog <BR>Font f = new Font(name ,Font.BOLD+Font.ITALIC ,20); <BR>jl.setForeground(Color.red); <BR>jl.setFont(f); <BR>jf.getContentPane().setLayout(new GridLayout(5 ,2)); <BR>jf.getContentPane().add(new JLabel(" ")); <BR>jf.getContentPane().add(jl); <BR>jf.getContentPane().add(new JLabel("sorry! this function is not do!!")); <BR>jf.pack(); <BR>jf.addWindowListener(new WindowAdapter(){ <BR>public void windowClosing(WindowEvent we){ <BR>jf.dispose(); <BR>} <BR>}); <BR>} <BR>else{ <BR>System.out.println("I am not selected"); <BR>} <BR>} <BR>} <BR>} <BR>} <BR></P><img src ="http://www.aygfsteel.com/lemon/aggbug/25371.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/lemon/" target="_blank">lemon</a> 2005-12-25 15:35 <a href="http://www.aygfsteel.com/lemon/archive/2005/12/25/25371.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬JAVA瀛︿範http://www.aygfsteel.com/lemon/archive/2005/12/12/23558.htmllemonlemonMon, 12 Dec 2005 13:37:00 GMThttp://www.aygfsteel.com/lemon/archive/2005/12/12/23558.htmlhttp://www.aygfsteel.com/lemon/comments/23558.htmlhttp://www.aygfsteel.com/lemon/archive/2005/12/12/23558.html#Feedback0http://www.aygfsteel.com/lemon/comments/commentRss/23558.htmlhttp://www.aygfsteel.com/lemon/services/trackbacks/23558.html

lemon 2005-12-12 21:37 鍙戣〃璇勮
]]>
鏈漢鍗氬涓浗鐨勫垎鏍忎唬鐮?鍒嗕韓涓涓?/title><link>http://www.aygfsteel.com/lemon/archive/2005/12/02/22278.html</link><dc:creator>lemon</dc:creator><author>lemon</author><pubDate>Fri, 02 Dec 2005 11:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/lemon/archive/2005/12/02/22278.html</guid><wfw:comment>http://www.aygfsteel.com/lemon/comments/22278.html</wfw:comment><comments>http://www.aygfsteel.com/lemon/archive/2005/12/02/22278.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/lemon/comments/commentRss/22278.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/lemon/services/trackbacks/22278.html</trackback:ping><description><![CDATA[<P><!--鐢╥frame鏉ヨ鍏?005绱㈠紩欏碉紝榪欐牱鎴戜滑灝辮幏寰椾簡鎵鏈夋湰騫村害鐨勬枃绔犲垪琛ㄤ簡--><BR><!--<iframe id="cataloghtml" src="catalog_2005.html" style=display:none;position:absolute;top:400;left:400;z-index:250 </P> <P>></iframe>--><BR><script><BR>var startYear = 2005; //浣犵殑鍗氬鏄摢涓騫村緩绔嬬殑錛?BR>var showCount = 10; // 姣忎釜鏍忕洰鏄劇ず澶氬皯鏉★紵</P> <P><BR>var d = new Date();<BR>var currYear = d.getUTCFullYear();<BR>for(i=currYear;i>=startYear;i--)<BR>{<BR>document.writeln('<iframe id="cataloghtml'+i+'" src="catalog_'+i+'.html" </P> <P>style=display:none;position:absolute;top:400;left:400;z-index:250 ></iframe>');<BR>}<BR></script><BR><script><BR>//榪欓儴鍒嗙殑鑴氭湰鏄嚜鍔ㄦ洿鏂扮敤鐨?BR>//浠巆ataloghtml鐨刢ategoryname榪欎釜鏍忕洰璇誨彇鏂囩珷鍒楄〃鏀懼埌褰撳墠欏甸潰鐨刴ycategoryname涓?BR>function showcatalog(mycategoryname,categoryname)<BR>{<BR>var currShowCount = 0;<BR>var currTotalCount = 0;<BR>l="<ul type='circle'>";<BR>for(iyear=currYear;iyear>=startYear;iyear--)<BR>{<BR>currCategory = document.body.all[mycategoryname];<BR>ol = eval("cataloghtml"+iyear+".document.body.all");</P> <P>var entityDiv = null;<BR>for(i=0;i<ol.length;i++)<BR>{<BR>if(ol[i].className =="entity")<BR>{<BR>entityDiv = ol[i];break;<BR>}<BR>}<BR>ol = entityDiv.children.tags("UL");<BR>var oLI=null;<BR>for(i=0;i<ol.length;i++)<BR>{<BR>if(ol[i].children(0).name==categoryname)<BR>{<BR>oLI = ol[i].children.tags("LI");<BR>break;<BR>}<BR>}<BR>if(oLI == null) return ;<BR>for(i=0;i<oLI.length;i++)<BR>{<BR>if(i>showCount-1) break;<BR>oA = oLI[i].children(1);<BR>s = oA.innerHTML;<BR>pos = s.search(/[錛墊銆憒銆弢\]]{1}/);<BR>if(pos>0)s=s.slice(pos+1);<BR>l += "<li style='width:245px;height:18;overflow:hidden'><a href='"+oA.href+"' target='_blank'>"+s+"</a></li>\r\n";<BR>}<BR>currShowCount += i;<BR>currTotalCount += oLI.length;<BR>}</P> <P>for(;currShowCount<showCount;currShowCount++)<BR>l += "<li style='width:245px;height:18;overflow:hidden'>...</li>\r\n";</P> <P>l+="</ul>";<BR>currCategory.insertAdjacentHTML("beforeend",l);<BR>// 澧炲姞浠g爜錛岀粺璁℃爮鐩枃绔犳暟<BR>titleDIV = currCategory.parentElement.children(0);<BR>titleDIV.insertAdjacentHTML("beforeend","錛?+ currTotalCount +"錛?);<BR>}</P> <P><BR>//浠巆ataloghtml璇誨彇鐩綍騫剁敓鎴愬綋鍓嶉〉闈?</P> <P>銆銆function showallcatalog() </P> <P>銆銆{ </P> <P>銆銆//闇瑕佹敼鍐欑殑鍦版柟涔嬩竴 </P> <P>銆銆showcatalog("mcategory1","category1");//鈥繪儏鎰熺豢媧?</P> <P>銆銆showcatalog("mcategory2","category2");//鈥繪枃瀛﹁崏鍧?</P> <P>銆銆showcatalog("mcategory3","category3");//鈥葷鏁欏洯鍦?/P> <P>銆銆showcatalog("mcategory4","category4");//鈥葷數(shù)鑴戠綉緇?BR> <BR>        showcatalog("mcategory5","category5");//鈥婚櫌鏍℃枃鍖?</P> <P>銆銆showcatalog("mcategory6","category6");//鈥婚兘甯傜敓媧?/P> <P>銆銆showcatalog("mcategory7","category7");//鈥誨獎闊沖ū涔?/P> <P>銆銆showcatalog("mcategory8","category8");//鈥諱漢鍦ㄥ寳浜?</P> <P>銆銆//鈥︹?</P> <P>銆銆//娉ㄦ剰錛屼笂闈㈢殑鐪佺暐鍙瘋〃紺哄鏋滆繕鏈夌涔?jié)銆佺鍗佷釜鏍囬鏍忔椂渚濇綾繪帹錛屽啓綾諱技鐨勪唬鐮?</P> <P>銆銆} </P> <P>銆銆</script> </P> <P><!--褰揵ody瑁呭叆鍚庤皟鐢╯howallcatalog()瑁呰澆鏈鏂版枃绔犲垪琛?-> </P> <P>銆銆<body onload=showallcatalog()> </P> <P>   </P> <P>    <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村鎯呮劅緇挎床鐨勬枃绔狅紝璇風偣鍑繪澶? src="<A /></a>鈥繪儏鎰熺豢媧?</div><div class="divtext" id="mcategory1" target="_blank"></div></div><!--緇撴潫--> </P> <P>    <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村鏂囧鑽夊潽鐨勬枃绔狅紝璇風偣鍑繪澶? src="<A /></a>鈥繪枃瀛﹁崏鍧?lt;/div><!--鏂囧閮ㄥ垎--><div class="divtext" id="mcategory2" target="_blank"></div></div><!--緇撴潫--> </P> <P>    <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村縐戞暀鍥湴鐨勬枃绔狅紝璇風偣鍑繪澶? src="<A /></a>鈥葷鏁欏洯鍦?lt;/div><div class="divtext" id="mcategory3" target="_blank"></div></div><!--緇撴潫--> </P> <P>    <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村鐢?shù)鑴懢|戠粶鐨勬枃绔狅紝璇風偣鍑繪澶? src="<A /></a>鈥葷數(shù)鑴戠綉緇?lt;/div><div class="divtext" id="mcategory4" target="_blank"></div></div><!--緇撴潫--> </P> <P>    <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村闄㈡牎鏂囧寲錛岃鐐瑰嚮姝ゅ" src="<A /></a>鈥婚櫌鏍℃枃鍖?lt;/div><div class="divtext" id="mcategory5" target="_blank"></div></div><!--緇撴潫--> </P> <P>   <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村閮藉競鐢熸椿錛岃鐐瑰嚮姝ゅ" src="<A /></a>鈥婚兘甯傜敓媧?lt;/div><div class="divtext" id="mcategory6" target="_blank"></div></div><!--緇撴潫--></P> <P>   <div><div class="mydiv1" target="_blank"><div class="mybg_01" target="_blank"><a href="<A ><img</A> class="myimg" alt="鏌ョ湅鏇村褰遍煶濞變箰鐨勬枃绔狅紝璇風偣鍑繪澶? src="<A /></a>鈥誨獎闊沖ū涔?lt;/div><!--闊充箰鏃剁┖閮ㄥ垎--><div class="divtext" id="mcategory7" target="_blank"></div></div><!--緇撴潫--> </P> <P>   <div><div class="mydiv2" target="_blank"><div class="mybg_01" target="_blank"><a href="<A target="_blank"><img class="myimg" alt="鏌ョ湅鏇村浜哄湪鍖椾含錛岃鐐瑰嚮姝ゅ" src="<A /></a>鈥諱漢鍦ㄥ寳浜?lt;/div><div class="divtext" id="mcategory8" target="_blank"></div></div><!--緇撴潫--></P> <P>   </div></p></P><img src ="http://www.aygfsteel.com/lemon/aggbug/22278.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/lemon/" target="_blank">lemon</a> 2005-12-02 19:38 <a href="http://www.aygfsteel.com/lemon/archive/2005/12/02/22278.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>濂界殑Java椋庢牸http://www.aygfsteel.com/lemon/archive/2005/10/18/15844.htmllemonlemonTue, 18 Oct 2005 13:44:00 GMThttp://www.aygfsteel.com/lemon/archive/2005/10/18/15844.htmlhttp://www.aygfsteel.com/lemon/comments/15844.htmlhttp://www.aygfsteel.com/lemon/archive/2005/10/18/15844.html#Feedback0http://www.aygfsteel.com/lemon/comments/commentRss/15844.htmlhttp://www.aygfsteel.com/lemon/services/trackbacks/15844.html灝界JAVA鏄敤鏉ュ啓紼嬪簭鑰屼笉鏄暎鏂囷紝 浣嗗畠浠嶇劧琚敤鏉ヨ〃杈炬濇兂鍜岃鐐圭殑銆傝屼笖錛屽湪璋冩煡涓樉紺猴紝閭d簺鎬濇兂鍜岃鐐瑰湪瀹為檯涓畬鎴愪簡寰堝浜嬫儏銆備負緙栧啓鍑哄ソ鐨凧AVA椋庢牸鑰屾媴蹇э紝浼間箮鏄湪嫻垂鏃墮棿錛?浣嗗疄闄呬笂瀹冨鎴戜滑緙栧啓紼嬪簭鏄緢閫傚疁鐨勶紝鍥犱負瀹冩墍瑕佽〃杈劇殑鎬濇兂鍜岃鐐規(guī)槸鏍煎娓呮櫚鐨勩?

榪欓噷鎻愪緵涓浜涚悊鐢憋紝涓轟粈涔堣浣跨敤濂界殑JAVA浠g爜瑙勮寖


涓涓蔣浠朵駭鍝佺殑80%鐨勭敓鍛芥湡鏄湪緇存姢錛坢aintenance錛夈?
鍑犱箮娌℃湁涓涓蔣浠跺湪瀹冪殑鏁翠釜鐢熷懡鏈熼噷閮芥槸琚畠鐨勪綔鑰呮潵緇存姢鐨勩?
浣跨敤濂界殑椋庢牸鎻愰珮浜嗚蔣浠剁殑鍙淮鎶ゆс?nbsp; 
濡傛灉婧愪唬鐮佸拰杞歡浜у搧鏄崋緇戠粰瀹㈡埛鐨勶紝浣滀負浜у搧鐨勫墿浣欓儴鍒嗭紝瀹冨簲璇ユ湁濂界殑鍒嗗寘錛坵ell-packaged錛夛紝瓚沖娓呮櫚鍜屼笓涓氱殑浠g爜銆?

浣跨敤濂界殑椋庢牸緙栧啓浠g爜鏈変互涓嬪嚑鐐瑰ソ澶勶細


鎻愰珮浜嗕唬鐮佺殑鍙鎬э紝鎸佺畫鎬э紝鍜岃皭鎬с傝繖浜涢兘鑳戒嬌浠g爜鑳芥洿瀹規(guī)槗鐨勭悊瑙e拰緇存姢銆?
浣夸唬鐮佹洿瀹規(guī)槗琚窡韙拰璋冭瘯錛屽洜涓哄畠鏄竻鏅扮殑鍜屾寔緇殑銆?
浣夸綘鎴栧彟涓涓▼搴忓憳鍦ㄧ紪鍐欑粓姝㈡椂鏇村鏄撳啀緇х畫涓嬪幓錛屽挨鍏跺湪涓涓緢闀跨殑鏃墮棿鍚庛?
澧炲姞浜嗕唬鐮侀鎺掞紙walkthroughs錛夌殑濂藉錛?鍥犱負鑳借鍙傚叆鑰呮洿澶氱殑灝嗙劍鐐歸泦涓湪浠g爜姝e湪鍋氫粈涔堛?

姒傝鏂歸拡
浣跨敤濂界殑JAVA椋庢牸騫朵笉鍥伴毦錛?浣嗘槸瀹冪‘瀹為渶瑕佹敞鎰忕粏鑺傘備笅闈㈡槸涓浜涘父鐢ㄧ殑姒傝鎸囧鏂歸拡錛?


浣夸唬鐮佹洿娓呮櫚鍜屾洿瀹規(guī)槗璇?nbsp; 
浣夸唬鐮佹洿鎸佺畫  
浣跨敤鏄捐屾槗瑙佺殑鏍囪瘑絎﹀悕  
閫昏緫鍦扮粍緇囦綘鐨勬枃浠跺拰綾?nbsp; 
姣忎釜鏂囦歡鍙湁涓涓被(榪欓噷涓嶅寘鎷竴浜涘唴閮ㄧ被)
浣跨敤80-90涓瓧絎︾殑鏈澶ц瀹?nbsp; 
鏄庢櫤鐨勪嬌鐢ㄧ┖鏍兼潵and/or鍏朵粬鍒嗛殧絎?
緙╂帓涓婏紝浣跨敤絀烘牸錛圫pace錛夋潵浠f浛Tab

Tabs vs. 絀烘牸
鍦ㄧ紪鍐欎唬鐮佹椂錛屸淭abs vs. 絀烘牸鈥?鏄竴涓弗璋ㄧ殑瑙傜偣銆傝繖閲屾垜騫朵笉鏄殫紺哄彧鏈変竴涓紜殑鏂規(guī)硶銆傛垜鏀寔浣跨敤絀烘牸錛屽洜涓哄畠鑳戒繚璇佹垜鐨勪唬鐮佸湪浣犵殑緙栬緫鍣ㄩ噷鍜屾垜鐨勭紪杈戝櫒閲岀湅鍒扮殑鐩稿悓錛屽弽涔嬬煟鐒躲傚鏋滀綘鎰熻浣跨敤絀烘牸鏉ヤ唬鏇縏ab"涓嶆槸姝g‘鐨?, 閭d箞灝變嬌鐢═ab鍚с?

鎷彿鍜岀緝榪?BR>鍦ㄧ紪鍐欎唬鐮佹椂錛岀緝榪涢鏍?cf., Raymond, "Indent Style")錛屾垨鑰呮斁緗嫭鍙?"{" 鍜?"}") 鍜屼竴浜涚浉鍏寵仈鐨勭緝榪涗唬鐮侊紝鏄彟涓涓弗璋ㄧ殑瑙傜偣銆傝薄JAVA涓鏍鳳紝鏈夎澶欳椋庢牸鐨勮璦瀛樺湪銆傛垜榪欓噷涔熶笉鏄殫紺哄畠浠腑鍝竴涓洿浼樺厛鏇村ソ銆傚湪澶у鏁版湰鏂囩殑鑼冧緥浠g爜涓紝鎴戜嬌鐢ㄤ簡K&R 椋庢牸錛屽鏋滀綘涓嶅枩嬈&R椋庢牸錛岄偅涔堝氨浣跨敤鍏朵粬椋庢牸鍚с?BR>
娉ㄩ噴
鍦↗AVA浠g爜涓綘鍙互浣跨敤涓ょ娉ㄩ噴錛?Javadoc 娉ㄩ噴 (涔熺О涓烘枃妗f敞閲? 鍜屾墽琛屾敞閲娿?Javadoc娉ㄩ噴鑳藉琚玧avadoc宸ュ叿瑙e帇鏉ュ埗閫犱竴涓狝PI鏂囨。銆傛墽琛屾敞閲婃槸閭d簺瑙i噴浠g爜鐩殑鍜屾柟寮忕殑娉ㄩ噴銆傚湪娉ㄩ噴浣犵殑JAVA浠g爜鏃惰浣跨敤浠ヤ笅鏂歸拡錛?


灝藉彲鑳界殑浣跨敤Javadoc娉ㄩ噴(鍦ㄧ被鍜屾柟娉曚笂錛屼嬌涔嬭兘鏈灝忓寲).
澶氫嬌鐢ㄥ潡娉ㄩ噴錛屽皯浣跨敤//娉ㄩ噴, 闄ら潪涓浜涚壒孌婄殑鎯呭喌錛屽鍙橀噺澹版槑
瑕佽浣忥細濂芥敞閲婃槸鏈夊府鍔╃殑錛屽潖娉ㄩ噴鏄夯鐑︾殑銆?

Example 1. Bad Comment Style

// applyRotAscii() -- Apply ASCII ROT
   private void applyRotAscii(){
      try{
         int rotLength = Integer.parseInt(rotationLengthField.getText().trim()); // get rot len
         RotAscii cipher = new RotAscii(rotLength); // new cipher
         textArea.setText(cipher.transform(textArea.getText())); // transform
      }catch(Exception ex){
         /* Show exception */
         ExceptionDialog.show(this, "Invalid rotation length: ", ex); }
   }



Example 2. Good Comment Style

/**
    * Apply the ASCII rotation cipher to the user's text. The length is retrieved
    * from the rotation length field, and the user's text is retrieved from the
    * text area.
    *
    * @author Thornton Rose
    */
   private void applyRotAscii() {
      int      rotLength = 0;  // rotation length
      RotAscii cipher = null;  // ASCII rotation cipher
  
      try {
         // Get rotation length field and convert to integer.
          
         rotLength = Integer.parseInt(rotationLengthField.getText().trim());
        
         // Create ASCII rotation cipher and transform the user's text with it.
          
         cipher = new RotAscii(rotLength);
         textArea.setText(cipher.transform(textArea.getText()));
  
       } catch(Exception ex) {
         // Report the exception to the user.
        
         ExceptionDialog.show(this, "Invalid rotation length: ", ex);
      }
   }



鍧楀拰璇彞
浣跨敤涓嬮潰鐨勬柟閽堟潵緙栧啓鍧楀拰璇彞錛?


涓琛屽彧鍐欎竴涓鍙?nbsp; 
鎺у埗璇彞鎬繪槸浣跨敤{}榪欐牱鐨勬嫭鍙?(e.g., 'if').
鑰冭檻鍦ㄥ潡鐨勬湯灝句嬌鐢ㄤ竴涓敞閲?(e.g., } // end if), 灝ゅ叾鏄暱鐨勬垨宓屽鍧?
鍦ㄥ潡鐨勫紑澶存斁緗彉閲忕殑澹版槑璇彞  
鎬昏寰楀垵濮嬪寲鍙橀噺  
濡傛灉浣犳槸涓畬緹庝富涔夎咃紝宸﹀榻愬彉閲忓悕
鍦╯witch鍧楅噷緙╄繘case浠庡彞  
鍦ㄦ搷浣滅鍚庣暀鏈夌┖鐧?
鍦╥f, for, 鎴杦hile璇彞涓紝 鍦ㄦ嫭鍙封滐紙鈥濆墠鐣欐湁絀虹櫧
鍦ㄨ〃杈懼紡涓嬌鐢ㄧ┖鐧藉拰鎻掑叆璇潵澧炲己鍙鎬?

鍦╢or寰幆涓殑鍙橀噺鏄釜渚嬪銆?寰幆鍙橀噺鍙兘浼氬湪璇彞鍒濆鍖栭儴鍒嗚瀹氫箟銆?e.g., for (int i = 0; ...)

.

鍦ㄥ潡鐨勬湯灝炬彃鍏ユ敞閲婃湁鍔╀簬浣犳棤鎰忎腑璺熻釜鍒拌鍒犻櫎鐨勭粨灝炬嫭鍙封渳鈥?

Example 3. Bad Block Style.

try{
      for(int i=0;i<5;i++){
         ...
         }
      int threshold=calculateThreshold();
      float variance=(threshold*2.8)-1;
      int c=0;
      if (threshold<=15) c=calculateCoefficient();
      switch(c){
      case 1: setCeiling(c*2); break;
      case 2: setCeiling(c*3); break;
      else: freakOut();
      }
   }catch(Exception ex){ ... }



Example 4. Good Block Style.

try {
      int   threshold  = 0;
      float variance    = 0.0;
      int   coefficient = 0;
      
      // Prepare 5 cycles.
      
      for (int i = 0; i < 5; i ++){
         prepareCycle(i);
      }
      
      // Calculate the threshold and variance.
      
      threshold = calculateThreshold();
      variance = (threshold * 2.8) - 1;
      
      // If the threshold is less than the maximum, calculate the coefficient.
      // Otherwise, throw an exception.
      
      if (threshold <= MAX_THRESHOLD) {
         coefficient = calculateCoefficient();
      } else {
         throw new RuntimeException("Threshold exceeded!");
      }
      
      // Set the ceiling based on the coefficient.
      
      switch (coefficient) {
         case 1:
            setCeiling(coefficient * 2);
            break;
          
         case 2:
            setCeiling(coefficient * 3);
            break;
          
         else:
            freakOut();
      } // end switch
   } catch(Exception ex) {
      ...
   } // end try


lemon 2005-10-18 21:44 鍙戣〃璇勮
]]>
鍏充簬BlogJavahttp://www.aygfsteel.com/lemon/archive/2005/10/09/15040.htmllemonlemonSun, 09 Oct 2005 02:29:00 GMThttp://www.aygfsteel.com/lemon/archive/2005/10/09/15040.htmlhttp://www.aygfsteel.com/lemon/comments/15040.htmlhttp://www.aygfsteel.com/lemon/archive/2005/10/09/15040.html#Feedback0http://www.aygfsteel.com/lemon/comments/commentRss/15040.htmlhttp://www.aygfsteel.com/lemon/services/trackbacks/15040.html

lemon 2005-10-09 10:29 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 巩义市| 灯塔市| 安康市| 闸北区| 丰城市| 富裕县| 屏东县| 弋阳县| 阿鲁科尔沁旗| 南通市| 阳信县| 元谋县| 噶尔县| 承德市| 海林市| 南靖县| 怀宁县| 衡阳县| 台山市| 龙岩市| 杨浦区| 吉林市| 沧州市| 杂多县| 津市市| 宝应县| 昌吉市| 井研县| 东乌珠穆沁旗| 青浦区| 阿克陶县| 南宫市| 商丘市| 合水县| 日照市| 双流县| 类乌齐县| 林甸县| 奉新县| 石渠县| 南木林县|