zoukankan      html  css  js  c++  java
  • Java Swing界面编程(18)---单行文本输入组件:JTextField

    版权声明:本文为博主原创文章。未经博主同意不得转载。 https://blog.csdn.net/xuejiawei123/article/details/27565407

    下面的程序与上一例有一点差别,细致对照不难发现当中的不同之处。

    package com.beyole.util;
    
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    
    public class test17 {
    	public static void main(String[] args) {
    		JFrame frame = new JFrame("Crystal");
    		JTextField nameField = new JTextField(30);
    		JTextField location = new JTextField("beyole", 10);
    		JLabel name = new JLabel("输入姓名");
    		JLabel locat = new JLabel("所属单位");
    		location.setEnabled(false);
    		name.setBounds(10, 10, 100, 20);
    		locat.setBounds(10, 40, 100, 20);
    		nameField.setBounds(80, 10, 90, 20);
    		location.setBounds(80, 40, 50, 20);
    		frame.setLayout(null);
    		frame.add(locat);
    		frame.add(name);
    		frame.add(location);
    		frame.add(nameField);
    		frame.setSize(300, 100);
    		frame.setLocation(300, 200);
    		frame.setVisible(true);
    	}
    }
    

    程序截图:
查看全文
  • 相关阅读:
    第八章 1 元组简介
    第七章 5 字典生成式
    第七章 4 字典的视图操作、字典的遍历、字典的特点
    第七章 3 字典的常用操作(增删改查)
    第七章 2 字典的创建以及字典元素的获取
    第七章 1 字典介绍
    Java 中 Executors.newSingleThreadExecutor() 与Executors.newFixedThreadPool(1)有什么区别
    Java 使用线程池执行若干任务
    使用Jacoco获取 Java 程序的代码执行覆盖率
    基于 Golang 完整获取百度地图POI数据的方案
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10767817.html
  • Copyright © 2011-2022 走看看