Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Creative Greenfoot: RAW
  • Table Of Contents Toc
  • Feedback & Rating feedback
Creative Greenfoot: RAW

Creative Greenfoot: RAW

By : Haungs
4.7 (3)
close
close
Creative Greenfoot: RAW

Creative Greenfoot: RAW

4.7 (3)
By: Haungs

Overview of this book

This book is for coding students and Java programmers of all levels interested in building engaging, interactive applications with Greenfoot. Familiarity with the very basics of Greenfoot is assumed.
Table of Contents (12 chapters)
close
close
11
Index

UIWorld


In this section, we will explain how to write the following user interface elements: buttons, textboxes, menus, and heads-up displays (HUDs). We are going to work through a Greenfoot scenario (shown in Figure 1) that only contains user interface elements, so we can discuss each element independently.

Some of the code we write will be general and able to be applied to many different scenarios. In other cases, we will write user interface code that will only need minor modification to be used across scenarios. In the next section, we will add these elements to the MazeWorld scenario that we wrote in the previous chapter, to make it a more polished and playable game.

Figure 1: This shows UI MainWorld

To work through this scenario, start with a new Greenfoot scenario named UIMainWorld, create a subclass of World named UIMainWorld, and then associate a plain background to it. The background I chose was bluerock.jpg. Here is the code for UIMainWorld:

import greenfoot.*;
import java.awt.Color...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Creative Greenfoot: RAW
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon