<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 38,  comments - 22,  trackbacks - 0
    sum


    1 flaot 取小數(shù)點(diǎn)

    ?/**
    ?? * 把傳入的雙精度變量或單精度變量轉(zhuǎn)化為兩位小數(shù)的形式輸出
    ?? * */
    ?? public float getInvertDataDouble(float para)
    ?? {
    ???? DecimalFormat decimalFormat=new DecimalFormat("0.00");
    ???? String s=decimalFormat.format(para);
    ???? float a=Float.parseFloat(s);
    ???? return a;
    ?? }
    ??
    2對話框顯示
    SwingUtilities.getAncestorOfClass(Frame.class,this)
    處理網(wǎng)頁對話框顯示在網(wǎng)頁底下

    3字符處理

    ???? StringTokenizer st = new StringTokenizer(CurveLabel, "%");
    ???? String[] value = new String[4];
    ???? int l = 0;
    ???? while (st.hasMoreElements()) {
    ??????? value[l] = (String) st.nextElement();
    ??????? l = l + 1;
    ???? }
    ???? String shujuleixing = value[0];
    ???? String ycxm = value[1];
    ???? String riqi = value[2];??

    4對話框

    ???????? String message = "已有DSM修正預(yù)測數(shù)據(jù)!";
    ???????? int result = JOptionPane.showOptionDialog(SwingUtilities.getAncestorOfClass(Frame.class,this), message, title,
    ???????????? optionType, messageType, null, options, options[1]);
    ????????????
    ???????????? dialog
    ????????????
    ????????????
    ????????????
    ????????????
    5布局
    ?setbounds 只有在布局為null的時(shí)候有用
    ?setPreferredSize在布局的時(shí)候有用 但是布局器可能自動(dòng)設(shè)置其大小
    ?可以設(shè)置 setMaximumSize 最大大小

    ?

    6servlet和程序用的不是一個(gè)classes12包
    ?(1)servlet調(diào)用的class12和程序調(diào)用的class12不一樣 在dafaultroot里
    ?(2)ldfserver問題主要是 oracle8i 與oracle9i客戶端不兼容 將9i的dll拷到bin目錄下即可


    7
    ?????? if (e.getValueIsAdjusting()) { //list不處理
    ????????? return;
    ?????? }

    8 setVisible(true/false) 使組件是否可見
    ?加完以后要重新布一下局.revalidate();

    9JCheckBox 可以用addActionListener() 然后在actionperformed里 查看是否isSelected

    10 JTable 必須加滾動(dòng)才出列名

    11對話框
    ?? ?? String title="Message Dialog";
    ?? ?? String message="";
    ?? ?? int type=JOptionPane.PLAIN_MESSAGE;
    ?? ?? if (cmd.equals("Show Error Icon")){
    ?? ?? ?? type=JOptionPane.ERROR_MESSAGE;
    ?? ?? ?? message="Error Message";
    ?? ?? }else if (cmd.equals("Show Information Icon")){
    ?? ?? ?? type=JOptionPane.INFORMATION_MESSAGE;
    ?? ?? ?? message="information Message";
    ?? ?? }else if (cmd.equals("Show Waring Icon")){
    ?? ?? ?? type=JOptionPane.WARNING_MESSAGE;
    ?? ?? ?? message="Waring Message";
    ?? ?? }else if (cmd.equals("Show Question Icon")){
    ?? ?? ?? type=JOptionPane.QUESTION_MESSAGE;
    ?? ?? ?? message="Question Message";
    ?? ?? }else if (cmd.equals("Show Plain Icon")){
    ?? ?? ?? type=JOptionPane.PLAIN_MESSAGE;
    ?? ?? ?? message="Plain Message";
    ?? ?? }else if (cmd.equals("Show User Define Icon")){
    ?? ?? ?? type=JOptionPane.PLAIN_MESSAGE;
    ?? ?? ?? JOptionPane.showMessageDialog(f,message,title,type,new ImageIcon("..\\icons\\glass.jpg"));
    ?? ?? ?? return ;
    ?? ?? }
    ?? ?? JOptionPane.showMessageDialog(f,message,title,type);

    12
    ??? table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);//自動(dòng)設(shè)置大小 在用滾動(dòng)條的時(shí)候管用
    ??? table.setColumnSelectionAllowed(true);//設(shè)置選擇模式 行或列


    13 list觸發(fā)兩次事件處理
    ??????? if (e.getValueIsAdjusting()) { //list不處理
    ????????? return;
    ?????? }

    14 和list里的內(nèi)容進(jìn)行比較
    ?DefaultListModel getdm=(DefaultListModel) sflist.getModel();
    ???if(getdm.contains(name))
    ???{
    ????type = JOptionPane.ERROR_MESSAGE;
    ????message = "組合算法名稱已經(jīng)存在!";
    ????JOptionPane.showMessageDialog(f, message, title, type);
    ????return;
    ???}


    15進(jìn)度條
    ?import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Rectangle;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;

    import javax.swing.*;

    public class ProgressBartr implements ActionListener {

    ?/**
    ? * @param args
    ? */
    ?JProgressBar pb = new JProgressBar();

    ?public static void main(String[] args) {
    ??// TODO 自動(dòng)生成方法存根
    ??new ProgressBartr();
    ?}
    ?public ProgressBartr() {
    ??JFrame f = new JFrame();
    ??Container con=f.getContentPane();
    ??con.setLayout(new FlowLayout());
    ??JButton jb=new JButton("button");
    ??jb.addActionListener(this);
    ??//pb.setIndeterminate(true);
    ??pb.setValue(0);
    ??pb.setMaximum(100);
    ??pb.setStringPainted(true);
    ??pb.setPreferredSize(new Dimension(250,25));
    ??pb.setMaximumSize(new Dimension(250,250));
    ??con.add(jb);
    ??con.add(pb);
    ??f.setBounds(new Rectangle(300, 300, 300, 300));
    ??f.show();
    ?}
    ?public void actionPerformed(ActionEvent arg0) {
    ??// TODO 自動(dòng)生成方法存根
    ??Thread runner = new Thread() {
    ???public void run() {
    ????pb.setStringPainted(true);
    ????for (int i = 0; i < 100; i++) {
    ?????pb.setValue(i);
    ?????try {
    ??????sleep(100);
    ?????} catch (InterruptedException e) {
    ??????// TODO 自動(dòng)生成 catch 塊
    ??????e.printStackTrace();
    ?????}
    ????}
    ????pb.setValue(0);
    ????pb.setStringPainted(false);
    ???}
    ??};
    ??runner.start();
    ?}

    }
    16 數(shù)據(jù)庫操作 日期轉(zhuǎn)換????????
    ?select * from table where MARKETDATE(date)=to_date('2006/03/19','yyyy/mm/dd')
    ?告訴 日期格式 自動(dòng)轉(zhuǎn)換

    17 applet ---->jsp
    ? public void toNext() {
    ??? try{
    ????? this.getAppletContext().showDocument(new URL(this.getCodeBase()+"pmCtrDecFiv_up.jsp?year="+year+"&unit_id="+unit_id),"_blank");
    ???? }catch(Exception ex){}
    ? }

    18?tree 線顯示為紅色
    ? UIManager.put( "Tree.hash", new ColorUIResource(Color.red) );


    19 JButton顏色切換
    ????if(obj==jb)
    ???{
    ????jb.setBackground(Color.ORANGE);
    ????jb1.setBackground(null);
    ???}
    ???if(obj==jb1)
    ???{
    ????jb1.setBackground(Color.ORANGE);
    ????jb.setBackground(null);
    ???}


    20 ftp處理
    ???try {
    ???FTPClient fc = new FTPClient("10.34.20.78");
    ???fc.login("ftp", "ftp");
    ???fc.setType(FTPTransferType.ASCII);
    ???fc.put("e:/java/ftp/ftp.TXT", "/abc/b.txt");//第一個(gè)參數(shù)為源 第二個(gè)為目的
    ???fc.quit();
    ??} catch (Exception e) {}

    21StringTokenizer
    ?????????????????? StringTokenizer st = new StringTokenizer("sss%ddd%eee%ttt%", "%");
    ????????????????? Vector val = new Vector();
    ????????????????? int l = 0;
    ????????????????? System.out.print(st.countTokens() );
    ????????????????? int num=st.countTokens() ;
    ????????????????? while (st.hasMoreElements()) {
    ??????????????????????? val.addElement(st.nextElement());
    ??????????????????????? l = l + 1;
    ????????????????? }

    22得到服務(wù)器IP

    ?this.getCodeBase().toString()

    23? Runtime.getRuntime().exec("ping 172.20.42.71");
    ?執(zhí)行命令
    ?String URL="\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\"
    http://www.china.com ";
    ??Process pp=Runtime.getRuntime().exec(URL);

    24??? 將字符串轉(zhuǎn)換為Date
    ?import java.text.SimpleDateFormat;
    ?String t="2006-05-09";
    ?SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
    ?Date d=sdf1.parase(t);

    25 setOpaque(false)設(shè)置透明

    26 OptionPane設(shè)置背景顏色
    Color oldColor1=UIManager.getColor("OptionPane.background");??????? Color oldColor2=UIManager.getColor("Panel.background");??????? String okButtonText=UIManager.getString("OptionPane.okButtonText");??????? String okButtonMnemonic=UIManager.getString("OptionPane.okButtonMnemonic");

    ?????? UIManager.put("OptionPane.background",Color.cyan);??????? UIManager.put("Panel.background",Color.yellow);??????? UIManager.put("OptionPane.okButtonText","HaHaHa!!!");??????? UIManager.put("OptionPane.okButtonMnemonic",""+((int)'H'));??????? JOptionPane.showMessageDialog(this,"<HTML><B>SUNKING</B><BR><Font Color=green>"????????????????????????????????????? +"SUNKING? </font><BR><I>SUNKING</I></html>");

    ?????? UIManager.put("OptionPane.background",oldColor1);??????? UIManager.put("Panel.background",oldColor2);??????? UIManager.put("OptionPane.okButtonText",okButtonText);??????? UIManager.put("OptionPane.okButtonMnemonic",okButtonMnemonic);

    27使用圖片 ../指上一層
    URL url=chat.MainFrame.class.getResource("../images/mm.jpg") ;

    posted on 2006-05-22 11:56 aaabbb 閱讀(374) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 又色又污又黄无遮挡的免费视| 亚洲国产精品无码成人片久久 | 黄色一级毛片免费| 亚洲精品无码专区久久久| 8888四色奇米在线观看免费看| 性xxxx黑人与亚洲| 爱情岛论坛网亚洲品质自拍| 无码国产精品一区二区免费模式 | 校园亚洲春色另类小说合集| 国产亚洲精品线观看动态图| 日本免费一区二区在线观看| 国产精品亚洲精品爽爽| 久久亚洲精品无码AV红樱桃| 免费看片A级毛片免费看| 日韩精品在线免费观看| 亚洲成在人线aⅴ免费毛片| 久久精品7亚洲午夜a| 在线免费观看国产视频| 无码一区二区三区免费| 国产亚洲精品成人久久网站| 亚洲激情电影在线| 亚洲男人在线无码视频| 曰批全过程免费视频在线观看| 久久毛片免费看一区二区三区| 亚洲av无码片在线观看| 亚洲国产成人片在线观看无码| 全免费a级毛片免费**视频| 182tv免费视频在线观看| 激情小说亚洲图片| 亚洲一区在线免费观看| 亚洲国产精品无码久久一区二区| 国产乱子伦精品免费女| 国产一卡二卡四卡免费| 国产免费无码一区二区| 一级女人18片毛片免费视频| 一本色道久久88亚洲精品综合| 亚洲AV福利天堂一区二区三| 亚洲国产精品激情在线观看| 成年女人18级毛片毛片免费 | 久久人午夜亚洲精品无码区 | 亚洲日本国产综合高清|