锘??xml version="1.0" encoding="utf-8" standalone="yes"?>wwwxxx在线观看,亚洲高清视频在线,亚洲欧美日韩国产成人综合一二三区http://www.aygfsteel.com/sitinspring/category/23797.htmlA man dose his can util the destiny was revealed.zh-cnSat, 23 Feb 2008 04:24:13 GMTSat, 23 Feb 2008 04:24:13 GMT60JTable甯歌鐢ㄦ硶緇嗗垯http://www.aygfsteel.com/sitinspring/archive/2007/12/18/168425.html濡傚潗鏄ラ濡傚潗鏄ラTue, 18 Dec 2007 03:04:00 GMThttp://www.aygfsteel.com/sitinspring/archive/2007/12/18/168425.htmlhttp://www.aygfsteel.com/sitinspring/comments/168425.htmlhttp://www.aygfsteel.com/sitinspring/archive/2007/12/18/168425.html#Feedback0http://www.aygfsteel.com/sitinspring/comments/commentRss/168425.htmlhttp://www.aygfsteel.com/sitinspring/services/trackbacks/168425.html  闃呰鍏ㄦ枃

濡傚潗鏄ラ 2007-12-18 11:04 鍙戣〃璇勮
]]>
濡備綍璁㏒wing鎺т歡濡侸Label,JButton絳夋樉紺哄姩鎬丟if鍥劇墖http://www.aygfsteel.com/sitinspring/archive/2007/09/08/143557.html濡傚潗鏄ラ濡傚潗鏄ラSat, 08 Sep 2007 01:42:00 GMThttp://www.aygfsteel.com/sitinspring/archive/2007/09/08/143557.htmlhttp://www.aygfsteel.com/sitinspring/comments/143557.htmlhttp://www.aygfsteel.com/sitinspring/archive/2007/09/08/143557.html#Feedback3http://www.aygfsteel.com/sitinspring/comments/commentRss/143557.htmlhttp://www.aygfsteel.com/sitinspring/services/trackbacks/143557.html闃呰鍏ㄦ枃

濡傚潗鏄ラ 2007-09-08 09:42 鍙戣〃璇勮
]]>
鍒╃敤MouseAdapter鏉ュ疄鐜拌嚜鎺掑簭鐨勮〃鏍?/title><link>http://www.aygfsteel.com/sitinspring/archive/2007/07/09/129060.html</link><dc:creator>濡傚潗鏄ラ</dc:creator><author>濡傚潗鏄ラ</author><pubDate>Mon, 09 Jul 2007 07:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/sitinspring/archive/2007/07/09/129060.html</guid><wfw:comment>http://www.aygfsteel.com/sitinspring/comments/129060.html</wfw:comment><comments>http://www.aygfsteel.com/sitinspring/archive/2007/07/09/129060.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/sitinspring/comments/commentRss/129060.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/sitinspring/services/trackbacks/129060.html</trackback:ping><description><![CDATA[     鎽樿: 鏈枃鍙傝冧簡http://www.java2s.com/Code/Java/Swing-JFC/TableSortTest.htm鐨勫仛娉曘備富瑕佸鐞嗘槸鍙栧緱鐢ㄦ埛鐐瑰嚮鐨勫垪錛屽緱鍒版寜姝ゅ垪鎺掑簭鐨勬柊鏁扮粍錛屽垹闄ゅ師鏈夊厓绱狅紝鍐嶆妸鏂版暟緇勫姞鍏ヨ繘琛ㄦ牸錛涘鏋滃凡緇忔帓搴忥紝鍒欒繘琛岄嗗簭澶勭悊銆傚鐞嗗畬姣曞悗錛岀敤鎴風偣鍑昏〃澶村嵆鍙疄鐜版帓搴忓拰閫嗗簭銆?<br> <br>  <a href='http://www.aygfsteel.com/sitinspring/archive/2007/07/09/129060.html'>闃呰鍏ㄦ枃</a><img src ="http://www.aygfsteel.com/sitinspring/aggbug/129060.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/sitinspring/" target="_blank">濡傚潗鏄ラ</a> 2007-07-09 15:58 <a href="http://www.aygfsteel.com/sitinspring/archive/2007/07/09/129060.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓涓劅瑙傦紙LookAndFeel錛夎彍鍗曠被鍙婂叾鐢ㄦ硶http://www.aygfsteel.com/sitinspring/archive/2007/06/28/126694.html濡傚潗鏄ラ濡傚潗鏄ラThu, 28 Jun 2007 00:47:00 GMThttp://www.aygfsteel.com/sitinspring/archive/2007/06/28/126694.htmlhttp://www.aygfsteel.com/sitinspring/comments/126694.htmlhttp://www.aygfsteel.com/sitinspring/archive/2007/06/28/126694.html#Feedback1http://www.aygfsteel.com/sitinspring/comments/commentRss/126694.htmlhttp://www.aygfsteel.com/sitinspring/services/trackbacks/126694.html1.綾諱唬鐮佸涓?/strong>
package com.junglesong.mvc.common.menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

/**
 * 紼嬪簭椋庢牸鑿滃崟
 * @author junglesong@gmail.com
 *
 */
public class StyleMenu extends JMenu {
  // 紼嬪簭鐨勪富妗嗘灦
  final JFrame mainFrame;
 
  /**
   * 鏋勯犲嚱鏁?br>   * @param text:鑿滃崟鏉℃枃瀛?br>   * @param frame:紼嬪簭鐨勪富妗嗘灦
   */
  public StyleMenu(String text,JFrame frame) {
    super(text);
    mainFrame=frame;
    addSubMenuItems();
  }

  /**
   * 娣誨姞涓嬬駭鑿滃崟欏?br>   *
   */
  private void addSubMenuItems() {
    // 鍙栧緱緋葷粺褰撳墠鍙敤鎰熻鏁扮粍
    UIManager.LookAndFeelInfo[] arr = UIManager
        .getInstalledLookAndFeels();

    ButtonGroup buttongroup = new ButtonGroup();
    for (int i = 0; i < arr.length; i++) {
      JRadioButtonMenuItem styleMitem = new JRadioButtonMenuItem(
          arr[i].getName(), i == 0);
      final String className = arr[i].getClassName();
     
      // 娣誨姞涓嬬駭鑿滃崟欏圭殑浜嬩歡鐩稿簲
      styleMitem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          try {
            UIManager.setLookAndFeel(className);
            SwingUtilities.updateComponentTreeUI(mainFrame);
          } catch (Exception ex) {
            System.out.println("Can't Change Lookandfeel Style to "
                + className);
          }
        }
      });
      buttongroup.add(styleMitem);
      this.add(styleMitem);
    }
  }
}


2.鐢ㄦ硶濡備笅

  JMenuBar menubar = new JMenuBar();
  mainFrame.setJMenuBar(menubar);
  ......
  menubar.add(Box.createHorizontalGlue());

  JMenu styleMenu = new StyleMenu("Syle", mainFrame);
  menubar.add(styleMenu);
  ......


渚嬪浘錛?br>


]]>
鍦↗Table涓婄偣鍑誨彸閿茍寮瑰嚭鑿滃崟鐨勫疄鐜?/title><link>http://www.aygfsteel.com/sitinspring/archive/2007/06/12/123729.html</link><dc:creator>濡傚潗鏄ラ</dc:creator><author>濡傚潗鏄ラ</author><pubDate>Tue, 12 Jun 2007 14:23:00 GMT</pubDate><guid>http://www.aygfsteel.com/sitinspring/archive/2007/06/12/123729.html</guid><wfw:comment>http://www.aygfsteel.com/sitinspring/comments/123729.html</wfw:comment><comments>http://www.aygfsteel.com/sitinspring/archive/2007/06/12/123729.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/sitinspring/comments/commentRss/123729.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/sitinspring/services/trackbacks/123729.html</trackback:ping><description><![CDATA[鏈漢鍦ㄥ仛涓涓湪JTable涓婄偣鍑誨彸閿脊鍑鴻彍鍗曠殑紼嬪簭鏃?閬囧埌浜嗚繖鏍風殑闂--鑿滃崟棣栭」闇瑕佹牴鎹偣鍑葷殑琛ㄦ牸琛岀殑"琛ㄥ悕鍒?鏀瑰彉,榪欓渶瑕佹垜浠仛涓鐐瑰皬灝忕殑宸ヤ綔,鍏跺疄灝辨槸<strong>鏍規嵁鐐瑰嚮鐨勪綅緗帹綆楁墍鍦ㄨ</strong>,濂戒簡,搴熻瘽灝戣,鐪嬩唬鐮佸惂.<br><br><strong><em>1.琛ㄦ牸鐨勫緩绔嬭繃紼?br></em></strong> <p><font face=Arial size=3>    String[] headers = {  "No", "Table Name"  };<br>    Object[][] cellData = null;</font></p> <p><font face=Arial size=3>    DefaultTableModel model = new DefaultTableModel(cellData, headers) {<br>      public boolean isCellEditable(int row, int column) {<br>        // 絎琋鍒楀彲浠ョ紪杈?br>        /*<br>         * if (column == N) { return false; }<br>         */</font></p> <p><font face=Arial size=3>        // 鏁翠釜琛ㄩ兘涓嶈兘緙栬緫<br>        return false;<br>      }<br>    };</font></p> <p><font face=Arial><font size=3>    table = new JTable(model);<br><br><strong><em>2.鑿滃崟鐨勫緩绔?/em></strong><br></font><font face=Arial><font size=3>    popupMenu=new JPopupMenu();<br>    <br>    tableNameItem=new JMenuItem("");<br>    selectItem=new JMenuItem("Select SQL");<br>    insertItem=new JMenuItem("Insert SQL");<br>    deleteItem=new JMenuItem("Delete SQL");<br>    updateItem=new JMenuItem("Update SQL");<br>    hbmItem=new JMenuItem("hbm xml");<br>    hbmPojoItem=new JMenuItem("Pojo Class");<br>    <br>    popupMenu.add(tableNameItem);<br>    popupMenu.addSeparator();<br>    popupMenu.add(selectItem);<br>    popupMenu.add(insertItem);<br>    popupMenu.add(deleteItem);<br>    popupMenu.add(updateItem);<br>    popupMenu.addSeparator();<br>    popupMenu.add(hbmItem);<br>    popupMenu.add(hbmPojoItem);<br><br><strong><em>3.鑿滃崟鐨勫脊鍑哄鐞?br></em></strong>    </font><font face=Arial><font size=3>      table.addMouseListener(new MouseAdapter() {<br>          public void mousePressed(MouseEvent evt) {<br>              if (evt.isPopupTrigger()) {  <br>                // </font><font size=3><strong>鍙栧緱鍙抽敭鐐瑰嚮鎵鍦ㄨ<br></strong>              </font><font size=3><strong>int row=evt.getY()/table.getRowHeight();<br></strong>              <br>              /**<br>               * 鍙栧緱鏄〃鍚嶇殑閭d竴鍒?br>               */<br>              int tableNameColumn=-1;<br>              <br>              for(int i=0;i<table.getColumnModel().getColumnCount();i++){<br>                TableColumn selColumn = table.getColumnModel().getColumn(i);<br>                String columnHeader=(String)selColumn.getHeaderValue();<br>                <br>                if(columnHeader.equals("Table Name")){<br>                  tableNameColumn=i;<br>                  break;<br>                }<br>              }<br>              <br>              /**<br>               * 鍙栧緱琛ㄥ悕騫跺脊鍑鴻彍鍗?br>               */<br>              if(tableNameColumn!=-1){<br>                /**<br>                 * 淇敼鑿滃崟棣栨潯鐨勫悕縐?br>                 */<br>                String tableName=(String)table.getValueAt(row,tableNameColumn);<br>                tableNameItem.setText(tableName);<br>                <br>                // 寮瑰嚭鑿滃崟<br>                popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());<br>              }<br>              }<br>          }<br>      }</font></font><br><font size=3>        <br>4.瀹炵幇鐨勬晥鏋滃涓?<br><img height=486 alt="" src="http://foto.yculblog.com/junglesong/RightKeyMenu.JPG" width=295 border=0></font></font></font></p> <img src ="http://www.aygfsteel.com/sitinspring/aggbug/123729.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/sitinspring/" target="_blank">濡傚潗鏄ラ</a> 2007-06-12 22:23 <a href="http://www.aygfsteel.com/sitinspring/archive/2007/06/12/123729.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>灝佽瀹屾瘯,鑳芥樉紺哄綋鍓嶆椂闂村茍鏀瑰彉椋庢牸鐨勮彍鍗曠被http://www.aygfsteel.com/sitinspring/archive/2007/06/08/122753.html濡傚潗鏄ラ濡傚潗鏄ラThu, 07 Jun 2007 17:00:00 GMThttp://www.aygfsteel.com/sitinspring/archive/2007/06/08/122753.htmlhttp://www.aygfsteel.com/sitinspring/comments/122753.htmlhttp://www.aygfsteel.com/sitinspring/archive/2007/06/08/122753.html#Feedback0http://www.aygfsteel.com/sitinspring/comments/commentRss/122753.htmlhttp://www.aygfsteel.com/sitinspring/services/trackbacks/122753.html 1 import java.awt.event.ActionEvent;
 2 import java.awt.event.ActionListener;
 3 import java.text.SimpleDateFormat;
 4 import java.util.Calendar;
 5 import javax.swing.ButtonGroup;
 6 import javax.swing.JMenu;
 7 import javax.swing.JRadioButtonMenuItem;
 8 import javax.swing.Timer;
 9 
10 public class TimeMenu extends JMenu{
11     private static final long serialVersionUID = 1L;    
12     private final static int ONE_SECOND=1000;
13     private String timeStyle="";
14     
15     public TimeMenu(String text){
16         super(text);
17         timeStyle="yyyy-MM-dd HH:mm:ss";
18         timer.start();
19         addSubMenuItems();
20     }
21 
22     Timer timer=new Timer(ONE_SECOND,new ActionListener(){
23         public void actionPerformed(ActionEvent evt){
24             setCurrTimeToText();
25         }
26     });    
27     
28     private void addSubMenuItems(){
29         String[] items=new String[]{"yyyy-MM-dd HH:mm:ss","HH:mm:ss","yyyy-MM-dd"};
30         
31         ButtonGroup buttongroup = new ButtonGroup();
32         
33         for (int i = 0; i < items.length; i++) {
34             JRadioButtonMenuItem timeMitem = new JRadioButtonMenuItem(
35                     items[i], i == 0);
36             
37             final String timeStyleTmp = items[i];
38             timeMitem.addActionListener(new ActionListener() {
39                 public void actionPerformed(ActionEvent e) {
40                     try {
41                         timeStyle=timeStyleTmp;
42                     } catch (Exception ex) {
43                         System.out.println("Can't Change Time Style to "
44                                 + timeStyleTmp);
45                     }
46                 }
47             });
48             buttongroup.add(timeMitem);
49             this.add(timeMitem);
50         }
51     }
52     
53     private void setCurrTimeToText(){
54         this.setText(getCurrTime(timeStyle));
55     }
56     
57     private String getCurrTime(String timeStyle){
58         Calendar cal= Calendar.getInstance();
59         SimpleDateFormat fromatter=new SimpleDateFormat(timeStyle);
60         String strCurrTime=fromatter.format(cal.getTime());
61         
62         return strCurrTime;
63     }
64 }
鐢ㄦ硶濡備笅:
1     JMenuBar menubar = new JMenuBar();
2     mainFrame.setJMenuBar(menubar);
3 
4     
5 
6     TimeMenu timeMenu = new TimeMenu("Time");
7     menubar.add(timeMenu);
8 
9 

 



]]>
主站蜘蛛池模板: 云阳县| 茂名市| 金湖县| 西林县| 保亭| 德化县| 宁武县| 宜丰县| 阳曲县| 中宁县| 邵阳县| 攀枝花市| 阜南县| 南阳市| 鄂州市| 昭觉县| 丰都县| 曲水县| 琼结县| 米易县| 井研县| 桑日县| 梅州市| 建宁县| 东港市| 双江| 修文县| 鹿邑县| 龙海市| 连南| 汝州市| 天津市| 岑溪市| 化德县| 灵山县| 台湾省| 塔河县| 新安县| 志丹县| 房产| 樟树市|