2013年5月24日

学习GUI组件显示

摘要: 使用类JButton,JLabel,JCheckBox,JRadioButton,JcomboBox来创建GUI对象。package com.studyJava.stringStudy;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JRadioButton;import javax 阅读全文

posted @ 2013-05-24 16:39 ywf—java 阅读(203) 评论(0) 推荐(0) 编辑

学习JFilechooser类(9.8)

摘要: JFilechooser类是显示文件对话框。public class ReadFileUsingJFileChooser { static String path = "e:\\Users\\ywf\\Desktop"; public static void main(String[] args) throws IOException{ JFileChooser filechooser = new JFileChooser(path);//构造一个给定文件路径的文件选择器 if(filechooser.showOpenDialog(nul... 阅读全文

posted @ 2013-05-24 11:25 ywf—java 阅读(268) 评论(0) 推荐(0) 编辑

学习PrintWriter,Scanner读写文件(9.7)

摘要: 一、用PrintWriter写入文件主要用PrintWriter的print(),或者println()方法。File file = new File("文件路径");PrintWriter out = new PrintWriter(file,"GBK");out.println("文件内容");out.close();二、用Scanner读数据常用的是从控制台读取数据Scanner input = new Scanner(System.in);从文件中读取数据File file = new File("文件路径" 阅读全文

posted @ 2013-05-24 11:17 ywf—java 阅读(1216) 评论(0) 推荐(0) 编辑

导航