Class FileOperationChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class FileOperationChooser extends JToolBar

The FileOperationChooser class is a JToolBar that allows the user to perform basic file operations: Open, Close, Export.

The operation chooser signals a change in the selected operation by firing a PropertyChangeEvent whose property name is FileOperationChooser.OPERATION_PROPERTY, and new value contains an operation name from the constants in this class.

A static instance of this class is available via getInstance() so that a single chooser may be used from multiple classes, even though it is only included in one layout manager.

Since:
3.1.7
Author:
Peter Hollemans
See Also:
  • Field Details

  • Constructor Details

    • FileOperationChooser

      public FileOperationChooser()
      Creates a new horizontal operation chooser with text and icons. By default, the chooser is set to be not floatable.
    • FileOperationChooser

      public FileOperationChooser(int orientation, boolean showText)
      Creates a new operation chooser. By default, the chooser is set to be not floatable.
      Parameters:
      orientation - the toolbar orientation, either HORIZONTAL or VERTICAL.
      showText - the show text flag. If true, text is shown below the icon in each button. If false, no text is shown, but a tool tip is set for the button.
  • Method Details

    • setClosable

      public void setClosable(boolean flag)
      Sets the closable flag.
      Parameters:
      flag - the closable flag, true if the close button should be enabled or false if not.
    • setSavable

      public void setSavable(boolean flag)
      Sets the savable flag.
      Parameters:
      flag - the savable flag, true if the save as button should be enabled or false if not.
    • getInstance

      public static FileOperationChooser getInstance()
      Creates a static instance of this class using the default constructor.
      Returns:
      the static instance of this class.
    • main

      public static void main(String[] argv)
      Tests this class.
      Parameters:
      argv - the array of command line parameters.