Java-Swing编程之对话框案例详解
来源:互联网 发布:王奔宏淘宝店网址 编辑:程序博客网 时间:2024/06/14 08:53
package com.xushouwei.cn.photo;
import java.awt.GraphicsConfiguration;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class FeedInfo extends JFrame {
private JLabel jl1,jl2,jl3;
private JTextField jtf1,jtf2,jtf3;
private JPanel jp1;
public FeedInfo(){
// TODO Auto-generated constructor stub
super("Feed Information");
setSize(400,105);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jl1=new JLabel("Name:",SwingConstants.RIGHT);
jl2=new JLabel("URL:",SwingConstants.RIGHT);
jl3=new JLabel("Type:",SwingConstants.RIGHT);
String response1=JOptionPane.showInputDialog(null,"Enter the site name:");
jtf1=new JTextField(response1,20);
String response2=JOptionPane.showInputDialog(null,"Enter the site address:");
jtf2=new JTextField(response2,20);
String[] choices={"Personal","Commercial","Unknown"};
int response3=JOptionPane.showOptionDialog(null, "What type of site is it?", "Site Type", 0, JOptionPane.QUESTION_MESSAGE, null, choices, choices[0]);
jtf3=new JTextField(choices[response3],20);
this.setLayout(new GridLayout(3,2));
this.add(jl1);
this.add(jtf1);
this.add(jl2);
this.add(jtf2);
this.add(jl3);
this.add(jtf3);
this.setLookAndFeel();
this.setVisible(true);
}
private void setLookAndFeel() {
// TODO Auto-generated method stub
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
FeedInfo fi=new FeedInfo();
}
}
- Java-Swing编程之对话框案例详解
- java高级图形界面编程-Swing中的对话框
- Java 学习之 Swing 编程
- Swing 之 对话框
- java swing 案例
- JAVA SWING编程技术应用:JTABLE表格案例分享
- [Java Swing图形界面开发与案例详解.pdf 免费下载
- java之GUI文件对话框javax.swing.JFileChooser
- Java学习之图形界面编程Swing
- java swing 编程之网格布局
- Swing图形界面之文件对话框
- Java Swing 编程一二
- Java Swing编程
- java swing编程
- Java-swing编程
- java的Swing编程
- java swing编程学习
- JAVA中Swing编程
- 预处理器简介
- UVA111 LCS
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:
- spring 注解 singleton prototype request session global session
- 什么是LAMP?
- Java-Swing编程之对话框案例详解
- PHP中编译Memcached的扩展
- 如何用简单易懂的例子解释隐马尔可夫模型?
- javascript闭包的学习
- email验证
- jQuery中$.fn的用法示例介绍
- shmget函数与shmat
- nginx整合多个tomcat
- 串口转以太网W5500 SPI驱动