Class DrawStringDemo

All Implemented Interfaces:
ActionListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants

public class DrawStringDemo extends ApplicationFrame implements ActionListener, ChangeListener
A demo of some of the string drawing methods in the JCommon class library.
See Also:
  • Field Details

    • combo1

      private JComboBox combo1
      The alignment anchor for the first panel.
    • combo2

      private JComboBox combo2
      The alignment anchor for the second panel.
    • combo3

      private JComboBox combo3
      The rotation anchor for the second panel.
    • slider

      private JSlider slider
      A slider for the second panel - controls the angle of rotation.
    • drawStringPanel1

      private DrawStringPanel drawStringPanel1
      String panel 1.
    • drawStringPanel2

      private DrawStringPanel drawStringPanel2
      String panel 2.
  • Constructor Details

    • DrawStringDemo

      public DrawStringDemo(String title)
      Creates a new demo instance.
      Parameters:
      title - the frame title.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Receives action events.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - the event.
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Receives change event notification from the slider.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - the event.
    • handleCombo1Change

      private void handleCombo1Change()
      Updates the display when combo 1 is updated.
    • handleCombo2Change

      private void handleCombo2Change()
      Updates the display when combo 2 is updated.
    • handleCombo3Change

      private void handleCombo3Change()
      Updates the display when combo 3 is updated.
    • createContentPane

      private JPanel createContentPane()
      Creates the content pane for the demo frame.
      Returns:
      The content pane.
    • createTab1Content

      private JPanel createTab1Content()
      Creates the content for tab 1.
      Returns:
      The content panel.
    • createTab2Content

      private JPanel createTab2Content()
      Creates the content for tab 2.
      Returns:
      The content panel.
    • displayFontDialog

      private void displayFontDialog()
      Displays a primitive font chooser dialog to allow the user to change the font.
    • populateTextAnchorCombo

      private void populateTextAnchorCombo(JComboBox combo)
      Populates a combo box with the available TextAnchor options.
      Parameters:
      combo - the combo box.
    • convertStringToAnchor

      private TextAnchor convertStringToAnchor(String text)
      Converts a string to a corresponding TextAnchor instance.
      Parameters:
      text - the text.
      Returns:
      The anchor.
    • main

      public static void main(String[] args)
      The starting point for the demo.
      Parameters:
      args - ignored.