-
eclipse运行命令行参数
run→run configuration→arguments→profile
-
汉字
汉字的字符编码区间[\u4e00-\u9fa5],通过Pattern.matches(reg,"")方法判断
-
frame全屏居中
this.setLocation((this.getToolkit().getScreenSize().width-this.getWidth())/2, (this.getToolkit().getScreenSize().height-this.getHeight())/2);
-
不规则图形或透明窗口
com.sun.awt.AWTUtilities.setWindowOpacity(w, 0.6f); 若报错:Window->Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and restricted API ->Forbidden reference -> 把 “error” 改为 “warning”
-
按钮可用
setEnabled(boolean)
-
文本框获取焦点
扫描二维码关注公众号,回复: 11644128 查看本文章requestFocus()
-
密码框
setEchoChar()
-
文本域自动换行
setLineWrap(boolean)
-
数组长度
二维数组通过length方法返回的是行数,通过数组名[下标].length返回的是该行元素个数
-
分割字符串
split分割字符串时 若分割字符为.,需使用转义字符
-
时间戳
System.currentTimeMillis()
-
提示语
setToolTipText();
getToolTipText(); -
打开文件
JFileChooser jf=new JFileChooser();
jf.showOpenDialog(this); //打开
jf.showSaveDialog(this); //保存
getSelectedFile()//返回选取的文件名(File类的对象)JFileChooser jfc=new JFileChooser();
int returnVal = jfc.showOpenDialog(this); -
对话框
JOptionPane jo=new JOptionPane();
jo.showMessageDialog(this,“喜欢吗”);
Java编程技巧与常用知识点[待续]
猜你喜欢
转载自blog.csdn.net/Zeno_wrj/article/details/107163909
今日推荐
周排行