简体   繁体   中英

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? 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 .

There are code examples for all the widgets.


To answer your question:

  • Use Label or Text for simple text you want to display
  • Use Text for input
  • Use a group of Button s with style SWT.RADIO for radio selection buttons
  • Use a Button with style SWT.CHECK for a checkbox

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 .

Good luck with your game :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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