首页 > 其他分享 >SWT组件介绍

SWT组件介绍

时间:2022-10-17 21:34:33浏览次数:93  
标签:composite import 介绍 swt org 组件 new SWT


  • 介绍

本文介绍SWT中一些组件的使用方法。

  • ScrolledComposite

[caption id="attachment_2688" align="aligncenter" width="188"]​​​​ ScrolledComposite[/caption]

[codesyntax lang="java"]


/**
* Copyright By suren.
* You can get more information from my website:
* http://surenpi.com
*/
package org.suren.swt.test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
* @author suren
* @date 2015年9月30日 下午4:57:34
*/
public class ScrolledTest
{

/**
* @param args
*/
public static void main(String[] args)
{
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());

shell.setSize(200, 100);

ScrolledComposite scroll = new ScrolledComposite(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
Composite composite = new Composite(scroll, SWT.NULL);
composite.setLayout(new RowLayout());

new Button(composite, SWT.PUSH).setText("one");
new Button(composite, SWT.PUSH).setText("one");
new Button(composite, SWT.PUSH).setText("one");
new Button(composite, SWT.PUSH).setText("one");
new Button(composite, SWT.PUSH).setText("one");
new Button(composite, SWT.PUSH).setText("one");

//下面两句必须有
scroll.setContent(composite);
composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

shell.open();
while(!shell.isDisposed()){
if(!display.readAndDispatch()){
display.sleep();
}
}
display.dispose();
}

}


[/codesyntax]


标签:composite,import,介绍,swt,org,组件,new,SWT
From: https://blog.51cto.com/suren/5764415

相关文章

  • Jmeter组件:Aggregate Report
    1、是什么AggregateReport:聚合报告,是jmeter中常用的监听器之一。2、参数详解Samples:取样器的数量Aveage:服务器平均响应时间Median:服务器响应时间中位数90%Line:90%的响应时......
  • linux基础介绍
    运维的本质运维:运行维护应用程序岗位需求:自动化运维、DBA、docker+K8s...运维职责:1.尽可能保证应用程序24小时不间断运行2.尽可能保证数据的安全3.尽......
  • linux之基本介绍
    一、运维的本质#运维运行维护应用程序#岗位需求:自动化运维、DBA、docker+K8s...#运维职责:1尽可能保证应用程序24系哦啊哈斯不间断......
  • vue-element-admin 介绍
    ​简介vue-element-admin是一个后台集成解决方案,它基于vue和element。它使用了最新的前端技术栈,内置了i18国际化解决方案,动态路由,权限验证,提炼了典型的业务模型,提供了......
  • MySQL Cluster 介绍
    ​MySQLCluster介绍MySQLCluster是一个基于NDBCluster存储引擎的完整的分布式数据库系统。不仅仅具有高可用性,而且可以自动切分数据,冗余数据等高级功能。和OracleReal......
  • LVS 搭建集群的一些介绍(方案,优化)
    ​LVS集群介绍三种运作方式VS-NAT(VirtualServerviaNAT)VS-DR(VirtualServerviaDirectRouting)VS-TUN(VirtualServerviaIPTunneling)LVS运作方式的比较/VS-NATVS......
  • 工厂MES系统功能与MES系统开发费用明细介绍
    在如今数智化时代,各行各业都在发生着巨大的变化,智能制造已逐步深入到制造业之中,工厂已进入高效生产时代。MES系统的出现,为制造业提供了全方位高效生产管理模式,可对人、设备......
  • mysql 存储结构介绍及执行过程分析
    MySQL体系结构介绍 1mysql 的体系结构  MySQL整体的逻辑结构可以分为4层,客户层、服务层、存储引擎层、数据层客户层客户层:进行相关的连接处理、权限控制、......
  • elementui半年选择组件
    1.基于elementui开发的半年选择组件2.调用<el-halfyear-pickerv-model="date":size="size"></el-halfyear-picker>3.代码<template><divclass="el-quarter-p......
  • 数据库连接池-概述、实现介绍
    数据库连接池-概述概念:其实就是一个容器,存放数据库连接的容器。当系统初始化后,容器被创建,容器中会申请一些连接对象,当用户来访问数据库时,从容器中获取连接对象,用户访问完......