简体   繁体   English

如何在SWT窗口中添加文本:Java,Eclipse

[英]How to add text inside an SWT window: Java, Eclipse

I am extremely new to programming, as a matter of fact I began yesterday and have done both of the coding exercises included in Eclipse (Hello World and Hello World SWT) and would like to know how to add text inside this handy-dandy SWT window and possibly how to make choices? 我对编程非常陌生,事实上,我昨天开始学习,并且完成了Eclipse中包括的两个编码练习(Hello World和Hello World SWT),并且想知道如何在这个方便的SWT窗口中添加文本以及如何做出选择? Or even a spot to input text? 甚至是输入文字的地方? Pardon me if I'm a tad ambitious but after seeing how easy it was to make a text window, I thought it would be fairly easy to make a text adventure game. 如果我有点雄心勃勃,请原谅我,但是在看到制作文本窗口是多么容易之后,我认为制作文本冒险游戏会相当容易。 I would love any and all help, thank you. 我很乐意提供任何帮助,谢谢。

Have a look at the SWT Snippets . 看看SWT片段

There are code examples for all the widgets. 所有小部件都有代码示例。


To answer your question: 要回答您的问题:

  • Use Label or Text for simple text you want to display 对要显示的简单文本使用LabelText
  • Use Text for input 使用Text输入
  • Use a group of Button s with style SWT.RADIO for radio selection buttons 使用一组Button s的风格SWT.RADIO无线电选择按钮
  • Use a Button with style SWT.CHECK for a checkbox 使用样式为SWT.CHECKButton作为复选框

Also, here is the overview of all the widgets there are. 另外, 这里是所有小部件的概述。


And finally there is this excellent tutorial by Vogella about SWT in general and of course every SWT developers bread and butter: Understanding Layouts in SWT . 终于有这个优秀教程由Vogella有关一般SWT,当然每一个SWT开发者的面包和黄油: 在SWT了解布局

Good luck with your game :) 祝您比赛顺利:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM