import java.awt.*;
import javax.swing.*;
//<applet code=DialogType1.class width=300 height=280>
//</applet>
public class DialogType1 extends JApplet
{
JLabel jlabel;
public void init()
{
Container c=getContentPane();
jlabel=new JLabel();
c.add(jlabel,BorderLayout.CENTER);
//创建图标为信息类型的消息对话框
JOptionPane.showMessageDialog(DialogType1.this,"this is a information dialog","information dialog",JOptionPane.INFORMATION_MESSAGE);
//创建图标为错误类型的消息对话框
JOptionPane.showMessageDialog(DialogType1.this,"this is a error dialog","error dialog",JOptionPane.ERROR_MESSAGE);
//创建图标为警告类型的消息对话框
JOptionPane.showMessageDialog(DialogType1.this,"this is a warning dialog","waring dialog",JOptionPane.WARNING_MESSAGE);
//创建图标为问题类型的消息对话框
JOptionPane.showMessageDialog(DialogType1.this,"this is a question dialog","question dialog",JOptionPane.QUESTION_MESSAGE);
//创建无图标的消息对话框
JOptionPane.showMessageDialog(DialogType1.this,"this is a plain dialog","plain dialog",JOptionPane.PLAIN_MESSAGE);
//创建具有三个按钮的确认对话框,并通过判断按钮返回值在状态栏中显示不同的文本
int result=JOptionPane.showConfirmDialog(DialogType1.this,"this is a confirm dialog","confirm dialog",JOptionPane.YES_NO_CANCEL_OPTION);
if(result==JOptionPane.YES_OPTION)
{
showStatus("You clicked yes button");
}else if(result==JOptionPane.NO_OPTION){
showStatus("You clicked no button");
}else {
showStatus("You clicked cancel button");
}
//创建一个图标为消息类型的输入对话框,并将所输入的文本显示在标签上
String txt=JOptionPane.showInputDialog(DialogType1.this,"pls input a integer number:","input dialog",JOptionPane.INFORMATION_MESSAGE);
jlabel.setForeground(Color.blue);
jlabel.setText("the text that you inputed is: "+txt);
}
}
进度条、对话框设计.rar_java 制作 进度条_java 进度条_组合框_组合框 颜色_进度条
版权申诉
188 浏览量
2022-09-14
14:22:13
上传
评论
收藏 9KB RAR 举报
小贝德罗
- 粉丝: 69
- 资源: 1万+
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈