Package ij.text

Class TextPanel

All Implemented Interfaces:
ClipboardOwner, ActionListener, AdjustmentListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, Runnable, EventListener, Accessible

This is an unlimited size text panel with tab-delimited, labeled and resizable columns. It is based on the hGrid class at http://www.lynx.ch/contacts/~/thomasm/Grid/index.html.
See Also:
  • Constructor Details

    • TextPanel

      public TextPanel()
      Constructs a new TextPanel.
    • TextPanel

      public TextPanel(String title)
      Constructs a new TextPanel.
  • Method Details

    • setColumnHeadings

      public void setColumnHeadings(String labels)
      Clears this TextPanel and sets the column headings to those in the tab-delimited 'headings' String. Set 'headings' to "" to use a single column with no headings.
    • getColumnHeadings

      public String getColumnHeadings()
      Returns the column headings as a tab-delimited string.
    • updateColumnHeadings

      public void updateColumnHeadings(String labels)
    • setFont

      public void setFont(Font font, boolean antialiased)
    • appendLine

      public void appendLine(String text)
      Adds a single line to the end of this TextPanel.
    • append

      public void append(String text)
      Adds one or more lines to the end of this TextPanel.
    • append

      public void append(ArrayList list)
      Adds strings contained in an ArrayList to the end of this TextPanel.
    • appendWithoutUpdate

      public void appendWithoutUpdate(String data)
      Adds a single line to the end of this TextPanel without updating the display.
    • updateDisplay

      public void updateDisplay()
    • adjustmentValueChanged

      public void adjustmentValueChanged(AdjustmentEvent e)
      Specified by:
      adjustmentValueChanged in interface AdjustmentListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • run

      public void run()
      For better performance, open double-clicked files on separate thread instead of on event dispatch thread.
      Specified by:
      run in interface Runnable
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent event)
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
    • addKeyListener

      public void addKeyListener(KeyListener listener)
      Unused keyPressed and keyTyped events will be passed to 'listener'.
      Overrides:
      addKeyListener in class Component
    • addMouseListener

      public void addMouseListener(MouseListener listener)
      Overrides:
      addMouseListener in class Component
    • keyPressed

      public void keyPressed(KeyEvent e)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent e)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent e)
      Specified by:
      keyTyped in interface KeyListener
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • lostOwnership

      public void lostOwnership(Clipboard clip, Transferable cont)
      Specified by:
      lostOwnership in interface ClipboardOwner
    • rowIndex

      public int rowIndex(int y)
      Converts a y coordinate in pixels into a row index.
    • copySelection

      public int copySelection()
      Copies the current selection to the system clipboard. Returns the number of characters copied.
    • clearSelection

      public void clearSelection()
      Deletes the selected lines.
    • clear

      public void clear()
      Deletes all the lines.
    • selectAll

      public void selectAll()
      Selects all the lines in this TextPanel.
    • resetSelection

      public void resetSelection()
      Clears the selection, if any.
    • setSelection

      public void setSelection(int startLine, int endLine)
      Creates a selection and insures that it is visible.
    • save

      public void save(PrintWriter pw)
      Writes all the text in this TextPanel to a file.
    • saveAs

      public boolean saveAs(String path)
      Saves all the text in this TextPanel to a file. Set 'path' to "" to display a save as dialog. Returns 'false' if the user cancels the save as dialog.
    • getText

      public String getText()
      Returns all the text as a string.
    • setTitle

      public void setTitle(String title)
    • getLineCount

      public int getLineCount()
      Returns the number of lines of text in this TextPanel.
    • getLine

      public String getLine(int index)
      Returns the specified line as a string. The argument must be greater than or equal to zero and less than the value returned by getLineCount().
    • setLine

      public void setLine(int index, String s)
      Replaces the contents of the specified line, where 'index' must be greater than or equal to zero and less than the value returned by getLineCount().
    • getSelectionStart

      public int getSelectionStart()
      Returns the index of the first selected line, or -1 if there is no slection.
    • getSelectionEnd

      public int getSelectionEnd()
      Returns the index of the last selected line, or -1 if there is no slection.
    • setResultsTable

      public void setResultsTable(ResultsTable rt)
      Sets the ResultsTable associated with this TextPanel.
    • getResultsTable

      public ResultsTable getResultsTable()
      Returns the ResultsTable associated with this TextPanel, or null.
    • getOrCreateResultsTable

      public ResultsTable getOrCreateResultsTable()
      Returns the ResultsTable associated with this TextPanel, or attempts to create one and returns the created table.
    • scrollToTop

      public void scrollToTop()