Interface SmileUtilities


public interface SmileUtilities
A collection of utility methods primarily for performing common GUI-related tasks.
  • Method Details

    • getLineOfOffset

      static int getLineOfOffset(JTextComponent editor, int offset)
      Returns the line number given a text offset.
      Parameters:
      editor - the text component.
      offset - the text offset.
      Returns:
      the line number.
    • getOffsetOfLine

      static int getOffsetOfLine(JTextComponent editor, int line)
      Returns the start offset of a line.
      Parameters:
      editor - the text component.
      line - the line number.
      Returns:
      the start offset.
    • getWordAt

      static String getWordAt(JTextComponent editor, int offset) throws BadLocationException
      Returns the word ending at the text offset.
      Parameters:
      editor - the text component.
      offset - the text offset.
      Returns:
      the word ending at the text offset.
      Throws:
      BadLocationException - if the offset is invalid.
    • scaleImageIcon

      static ImageIcon scaleImageIcon(ImageIcon icon, int size)
      Scales an image icon to desired size.
      Parameters:
      icon - the input image icon.
      size - the desired icon size.
      Returns:
      the scaled image icon.
    • show

      static JFrame show(Figure figure)
      Shows the figure in a window.
      Parameters:
      figure - the figure to display.
      Returns:
      a new JFrame that contains the figure.
    • show

      static JFrame show(MultiFigurePane figure)
      Shows the figure in a window.
      Parameters:
      figure - the figure to display.
      Returns:
      a new JFrame that contains the figure.
    • show

      static JFrame show(DataFrame df)
      Shows the data frame in a window.
      Parameters:
      df - the data frame to display.
      Returns:
      a new JFrame that displays the data frame in a table.
    • show

      static JFrame show(DataFrame df, String title)
      Shows the data frame in a window.
      Parameters:
      df - the data frame to display.
      title - the title of the window.
      Returns:
      a new JFrame that displays the data frame in a table.
    • show

      static JFrame show(Matrix matrix)
      Shows the matrix in a window.
      Parameters:
      matrix - the matrix to display.
      Returns:
      a new JFrame that displays the matrix in a table.
    • show

      static JFrame show(Matrix matrix, String title)
      Shows the matrix in a window.
      Parameters:
      matrix - the matrix to display.
      title - the title of the window.
      Returns:
      a new JFrame that displays the matrix in a table.
    • show

      static JFrame show(SparseMatrix matrix)
      Shows the sparse matrix structure in a figure window.
      Parameters:
      matrix - the matrix to display.
      Returns:
      a new JFrame that displays the sparse matrix structure.