vijxtautil.java

来自「myjxta是用jxta开发的一个p2p通讯软件 有聊天 文件共享 视频3大功」· Java 代码 · 共 71 行

JAVA
71
字号
/* * Copyright (c) [2005] [Jeffrey Moore] * * Redistributions in source code form must reproduce the above copyright and  * this condition. * * The contents of this file are subject to the Sun Project JXTA License  * Version 1.1 (the "License"); you may not use this file except in compliance  * with the License. A copy of the License is available at  * http://www.jxta.org/jxta_license.html. * *//* * ViJxtaUtil.java * * Created on April 12, 2005, 12:20 PM */package net.jxta.myjxta.plugins.vijxta;import java.awt.Dimension;/** * * @author Jeff Moore */public class ViJxtaUtil {        /** Creates a new instance of ViUtil */    public ViJxtaUtil () {    }        public static String dimensionToString (Dimension d) {                return (d != null) ?            String.valueOf (String.valueOf ((int)d.getWidth ()) +                " x " +                String.valueOf ((int)d.getHeight ())) : null;    }        public static Dimension stringToDimension (String s) {                        int w = 0;        int h = 0;        Dimension rtn = null;                if(s != null) {                        String[] tmp = s.split ("x");                        if( tmp.length == 2) {                                try {                                        w = Integer.valueOf (tmp[0].trim ()).intValue ();                                        h = Integer.valueOf (tmp[1].trim ()).intValue ();                                    }catch(NumberFormatException nfx) {                    nfx.printStackTrace ();                }            }            rtn = new Dimension (w,h);        }        return rtn;            }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?