ViewGridCell

floodsim.view.component.ViewGridCell
class ViewGridCell(cellRow: Int, cellCol: Int)(using imageCache: ImageCache[CellType], weatherImageCache: ImageCache[Weather]) extends UIComponent[JPanel]

A single grid cell view that renders:

  • a base tile image for the current floodsim.model.cell.CellType,
  • an optional semi-transparent color overlay,
  • an optional weather overlay image,
  • an optional text label with a dark backdrop for readability.

Value parameters

cellCol

the column index of this cell

cellRow

the row index of this cell

Attributes

Graph
Supertypes
trait UIComponent[JPanel]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

Returns the current cell type.

Returns the current cell type.

Attributes

Returns

the CellType of this cell

def col: Int

Returns the column index of this cell.

Returns the column index of this cell.

Attributes

Returns

the column index

def component: JPanel

Returns the underlying Swing component.

Returns the underlying Swing component.

Attributes

def row: Int

Returns the row index of this cell.

Returns the row index of this cell.

Attributes

Returns

the row index

def setOverlay(color: Color, intensity: Double): Unit

Sets a color overlay with the specified intensity (0.0 to 1.0) and repaints the component.

Sets a color overlay with the specified intensity (0.0 to 1.0) and repaints the component.

Value parameters

color

the overlay color

intensity

the overlay intensity (0.0 = transparent, 1.0 = opaque)

Attributes

def setShowWeather(show: Boolean): Unit

Hides the text label and repaints the component.

Hides the text label and repaints the component.

Value parameters

show

true to show weather overlay, false to hide

Attributes

def showLabel(text: String): Unit

Shows a text label with a dark backdrop for readability and repaints the component.

Shows a text label with a dark backdrop for readability and repaints the component.

Value parameters

text

the text to display

Attributes

def updateCellType(ct: CellType): Unit

Updates the cell type and repaints the component.

Updates the cell type and repaints the component.

Value parameters

ct

the new CellType

Attributes

def updateWeather(w: Weather): Unit

Hides the text label and repaints the component.

Hides the text label and repaints the component.

Value parameters

w

the new Weather to display

Attributes