-
Notifications
You must be signed in to change notification settings - Fork 0
/
Title.java
36 lines (26 loc) · 925 Bytes
/
Title.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Title here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Title extends Actor
{
public String mainTitle = "";
public static String title;
// don't like using act
public void act()
{
if (title.contains("Day") && title.contains(":"))
{
String dayTitle = title;
title = dayTitle.split(":")[1];
mainTitle = dayTitle.split(":")[0] + ":";
}
GreenfootImage subheading = new GreenfootImage("\n" + title,20,Color.GRAY,new Color(0,0,0,0));
setImage(subheading);
GreenfootImage heading = new GreenfootImage(mainTitle, 20,Color.GRAY,new Color(0,0,0,0));
subheading.drawImage(heading, 0, 0);
}
}