Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.huguesjohnson.tiamat.graphics
Class Dialog

    java.lang.Object
      com.huguesjohnson.tiamat.graphics.Dialog

All Implemented Interfaces:
  Drawable

public class Dialog
extends java.lang.Object
implements Drawable

Dialog - a dialog to display text and accept selections

Author:
  Hugues Johnson

Constructor Summary
`Dialog(java.lang.String[] text, java.awt.Component canvas, Theme style, javax.swing.JFrame parent)` Constructor.
`Dialog(java.lang.String[] text, int x, int y, int x1, int y1, java.awt.Component canvas, Theme style, javax.swing.JFrame parent)` Constructor.
`Dialog(java.lang.String[] text, java.lang.String[] selections, java.awt.Component canvas, Theme style, javax.swing.JFrame parent)` Constructor.
`Dialog(java.lang.String[] text, java.lang.String[] selections, int x, int y, int x1, int y1, java.awt.Component canvas, Theme style, javax.swing.JFrame parent)` Constructor.

Method Summary
`boolean` | `back()` Scrolls the text behind one “screen”, also causes redraw.
`void` | `draw()` Draws the Dialog.
`void` | `draw(int x, int y)` Draws the Dialog at the specified coordinates.
`void` | `draw(int x1, int y1, int x2, int y2)` Draws the Dialog at the specified coordinates.
`boolean` | `forward()` Scrolls the text ahead one page, also causes redraw.
`java.awt.Component` | `getCanvas()` Returns the canvas.
`java.lang.String` | `getSelection(int index)` Returns the specified selection.
`java.lang.String[]` | `getSelections()` Returns all the selections that will be displayed after the last page of text.
`Theme` | `getStyle()` Returns the Theme for this Dialog.
`java.lang.String[]` | `getText()` Returns the array of text to display.
`java.lang.String` | `getText(int index)` Returns a single page of text.
`void` | `hide()` Hides the Dialog.
`void` | `onCancel()` Event called when the Dialog is closed.
`void` | `onSelection(int index)` Event invoked when the player has confirmed a selection in the dialog.
`void` | `setCanvas(java.awt.Component canvas)` Sets the canvas for this Dialog
`void` | `setSelection(java.lang.String selection, int index)` Sets the selection at the specified index.
`void` | `setSelections(java.lang.String[] selections)` Sets the selections to present after the last page of text.
`void` | `setStyle(Theme style)` Sets the Theme for this Dialog.
`void` | `setText(java.lang.String[] text)` Sets the array of text to display.
`void` | `setText(java.lang.String text, int index)` Sets one page of text to display.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Dialog

    public Dialog(java.lang.String[] text,
                  java.awt.Component canvas,
                  Theme style,
                  javax.swing.JFrame parent)

  Constructor.

Parameters:
  `text` - Array of text pages to display.
  `canvas` - Where to draw the Dialog.
  `style` - The Theme for the Dialog.
  `parent` - The parent frame for the Dialog.

### Dialog

    public Dialog(java.lang.String[] text,
                  int x,
                  int y,
                  int x1,
                  int y1,
                  java.awt.Component canvas,
                  Theme style,
                  javax.swing.JFrame parent)

  Constructor.

Parameters:
  `text` - Array of text pages to display.
  `x` - Left coordinate.
  `x1` - Right coordinate.
  `y` - Top coordinate.
  `y1` - Bottom coordinate.
  `canvas` - Where to draw the Dialog.
  `style` - The Theme for the Dialog.
  `parent` - The parent frame for the Dialog.

### Dialog

    public Dialog(java.lang.String[] text,
                  java.lang.String[] selections,
                  java.awt.Component canvas,
                  Theme style,
                  javax.swing.JFrame parent)

  Constructor.

Parameters:
  `text` - Array of text pages to display.
  `selections` - The selections to display after showing the last page of text.
  `canvas` - Where to draw the Dialog.
  `style` - The Theme for the Dialog.
  `parent` - The parent frame for the Dialog.

### Dialog

    public Dialog(java.lang.String[] text,
                  java.lang.String[] selections,
                  int x,
                  int y,
                  int x1,
                  int y1,
                  java.awt.Component canvas,
                  Theme style,
                  javax.swing.JFrame parent)

  Constructor.

Parameters:
  `text` - Array of text pages to display.
  `selections` - The selections to display after showing the last page of text.
  `x` - Left coordinate.
  `x1` - Right coordinate.
  `y` - Top coordinate.
  `y1` - Bottom coordinate.
  `canvas` - Where to draw the Dialog.
  `style` - The Theme for the Dialog.
  `parent` - The parent frame for the Dialog.

Method Detail

### setText

    public void setText(java.lang.String[] text)

  Sets the array of text to display.

  Parameters:
    `text` - The array of text to display, each element in the array represents a page of text.

### setText

    public void setText(java.lang.String text,
                        int index)

  Sets one page of text to display.

  Parameters:
    `text` - The new text to display.
    `index` - The page number to replace.

### getText

    public java.lang.String[] getText()

  Returns the array of text to display.

  Returns:
    The array of text to display, each element in the array represents a page of text.

### getText

    public java.lang.String getText(int index)

  Returns a single page of text.

  Parameters:
    `index` - The page index to return.
  Returns:
    The page of text at index, null if(page<0||page>=text.length)

### setSelections

    public void setSelections(java.lang.String[] selections)

  Sets the selections to present after the last page of text.

  Parameters:
    `selections` - An array of text selections.

### setSelection

    public void setSelection(java.lang.String selection,
                             int index)

  Sets the selection at the specified index.

  Parameters:
    `selection` - The new selection to display.
    `index` - The index of the selection to replace.

### getSelections

    public java.lang.String[] getSelections()

  Returns all the selections that will be displayed after the last page of text.

  Returns:
    All the selections that will be displayed after the last page of text.

### getSelection

    public java.lang.String getSelection(int index)

  Returns the specified selection.

  Parameters:
    `index` - The index of the selection to return.
  Returns:
    The selection at index, null if(index<0||index>selections.length)

### getStyle

    public Theme getStyle()

  Returns the Theme for this Dialog.

  Returns:
    The Theme for this Dialog.

### setStyle

    public void setStyle(Theme style)

  Sets the Theme for this Dialog.

  Parameters:
    `style` - New Theme for the Dialog.

### getCanvas

    public java.awt.Component getCanvas()

  Returns the canvas.

  Returns:
    Canvas, where this Dialog is drawn.

### setCanvas

    public void setCanvas(java.awt.Component canvas)

  Sets the canvas for this Dialog

  Parameters:
    `canvas` - Where to the draw this Dialog.

### forward

    public boolean forward()

  Scrolls the text ahead one page, also causes redraw.

  Returns:
    False if on the last page of text.

### back

    public boolean back()

  Scrolls the text behind one “screen”, also causes redraw.

  Returns:
    False if on the first page of text.

### hide

    public void hide()

  Hides the Dialog.

### onCancel

    public void onCancel()

  Event called when the Dialog is closed.

### onSelection

    public void onSelection(int index)

  Event invoked when the player has confirmed a selection in the dialog.

  Parameters:
    `index` - The index of the selection made (relative to the selections array).

### draw

    public void draw()

  Draws the Dialog.

  Specified by:
    `draw` in interface `Drawable`

### draw

    public void draw(int x,
                     int y)

  Draws the Dialog at the specified coordinates.

  Specified by:
    `draw` in interface `Drawable`
  Parameters:
    `x` - The left x cooridinate.
    `y` - The top y cooridinate.

### draw

    public void draw(int x1,
                     int y1,
                     int x2,
                     int y2)

  Draws the Dialog at the specified coordinates.

  Specified by:
    `draw` in interface `Drawable`
  Parameters:
    `x1` - The left x cooridinate.
    `x2` - The right x cooridinate.
    `y1` - The top y cooridinate.
    `y2` - The bottom y cooridinate.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD