---
title: "Swt - Shell的 不同样式"
author: "seong"
date: "2011-10-01T23:11:18Z"
tags: ["SWT", "display", "shell"]
categories: ["编程语言"]
slug: "swt-shell"
draft: false
lastmod: "2011-10-01T23:11:18Z"
id: 1184395
url: "https://seong.iteye.com/blog/1184395"
---

在Swt里面 Shell可充当主要窗口的角色 也可充当子窗口或者对话框的角色 如果要建立一个主要窗口的话 应该在构造方法里面添加Display为参数 如果是创建子窗口或者对话框就应该在构造函数里添加父窗口的Shell

Shell parent = new Shell(Display display, int style); 建立主窗口

Shell dialog = new Shell(Shell parent, int style); 建立子窗口

以下为Shell的不同样式

![](http://dl.iteye.com/upload/attachment/563666/f95d7b70-f7c7-328c-8102-3a474cbc0333.jpg)