Class ButtonFactory
- java.lang.Object
-
- org.jhotdraw.draw.action.ButtonFactory
-
public class ButtonFactory extends java.lang.ObjectButtonFactory.Design pattern:
Name: Abstract Factory.
Role: Abstract Factory.
Partners:DrawApplicationModelas Client,DrawViewas Client,DrawingPanelas Client. FIXME - All buttons created using the ButtonFactory must automatically become disabled/enabled, when the DrawingEditor is disabled/enabled.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.util.List<ColorIcon>DEFAULT_COLORSMac OS X 'Apple Color Palette'.static intDEFAULT_COLORS_COLUMN_COUNTstatic java.util.List<ColorIcon>HSB_COLORSHSB color palette with a set of colors chosen based on a physical criteria.static java.util.List<ColorIcon>HSB_COLORS_AS_RGBThis is the same palette as HSB_COLORS, but all color values are specified in the sRGB color space.static intHSB_COLORS_AS_RGB_COLUMN_COUNTstatic intHSB_COLORS_COLUMN_COUNTstatic java.util.List<ColorIcon>WEBSAVE_COLORSWebsave color palette as used by Macromedia Fireworks.static intWEBSAVE_COLORS_COLUMN_COUNT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidaddAlignmentButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)Creates toolbar buttons and adds them to the specified JToolBarstatic voidaddAlignmentButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor, java.util.List<Disposable> dsp)Creates toolbar buttons and adds them to the specified JToolBar.static voidaddAttributesButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)Creates toolbar buttons and adds them to the specified JToolBarstatic voidaddColorButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)static voidaddColorButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor, java.util.List<ColorIcon> colors, int columnCount)static voidaddFontButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)static javax.swing.JToggleButtonaddSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor)static javax.swing.JToggleButtonaddSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor, java.util.Collection<javax.swing.Action> drawingActions, java.util.Collection<javax.swing.Action> selectionActions)static javax.swing.JToggleButtonaddSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor, Tool selectionTool)static voidaddStrokeButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)static javax.swing.JToggleButtonaddToolTo(javax.swing.JToolBar tb, DrawingEditor editor, Tool tool, java.lang.String labelKey, ResourceBundleUtil labels)Method addSelectionToolTo must have been invoked prior to this on the JToolBar.static voidaddZoomButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)static javax.swing.JButtoncreateApplyAttributesButton(DrawingEditor editor)Creates a button that applies the default attributes of the editor to the current selection.static javax.swing.JButtoncreateApplyAttributesButton(DrawingEditor editor, java.util.List<Disposable> dsp)static java.util.Collection<javax.swing.Action>createDrawingActions(DrawingEditor editor)static java.util.Collection<javax.swing.Action>createDrawingActions(DrawingEditor editor, java.util.List<Disposable> dsp)static JPopupButtoncreateDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateDrawingColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.lang.Class uiclass, java.util.List<Disposable> dsp)static JPopupButtoncreateDrawingColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)static JPopupButtoncreateEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateFontButton(DrawingEditor editor)static JPopupButtoncreateFontButton(DrawingEditor editor, AttributeKey<java.awt.Font> key, ResourceBundleUtil labels)static JPopupButtoncreateFontButton(DrawingEditor editor, AttributeKey<java.awt.Font> key, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static JPopupButtoncreateFontButton(DrawingEditor editor, ResourceBundleUtil labels)static javax.swing.JButtoncreateFontStyleBoldButton(DrawingEditor editor)static javax.swing.JButtoncreateFontStyleBoldButton(DrawingEditor editor, ResourceBundleUtil labels)static javax.swing.JButtoncreateFontStyleBoldButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static javax.swing.JButtoncreateFontStyleItalicButton(DrawingEditor editor)static javax.swing.JButtoncreateFontStyleItalicButton(DrawingEditor editor, ResourceBundleUtil labels)static javax.swing.JButtoncreateFontStyleItalicButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static javax.swing.JButtoncreateFontStyleUnderlineButton(DrawingEditor editor)static javax.swing.JButtoncreateFontStyleUnderlineButton(DrawingEditor editor, ResourceBundleUtil labels)static javax.swing.JButtoncreateFontStyleUnderlineButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static javax.swing.JButtoncreatePickAttributesButton(DrawingEditor editor)static javax.swing.JButtoncreatePickAttributesButton(DrawingEditor editor, java.util.List<Disposable> dsp)static java.util.Collection<javax.swing.Action>createSelectionActions(DrawingEditor editor)static JPopupButtoncreateSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)Creates a color button, with an action region and a popup menu.static JPopupButtoncreateSelectionColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.lang.Class uiclass, java.util.List<Disposable> dsp)static JPopupButtoncreateSelectionColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)static JPopupButtoncreateStrokeCapButton(DrawingEditor editor)static JPopupButtoncreateStrokeCapButton(DrawingEditor editor, ResourceBundleUtil labels)static JPopupButtoncreateStrokeCapButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static JPopupButtoncreateStrokeDashesButton(DrawingEditor editor)static JPopupButtoncreateStrokeDashesButton(DrawingEditor editor, double[][] dashes)static JPopupButtoncreateStrokeDashesButton(DrawingEditor editor, double[][] dashes, ResourceBundleUtil labels)static JPopupButtoncreateStrokeDashesButton(DrawingEditor editor, double[][] dashes, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static JPopupButtoncreateStrokeDashesButton(DrawingEditor editor, ResourceBundleUtil labels)static JPopupButtoncreateStrokeDecorationButton(DrawingEditor editor)static JPopupButtoncreateStrokeJoinButton(DrawingEditor editor)static JPopupButtoncreateStrokeJoinButton(DrawingEditor editor, ResourceBundleUtil labels)static JPopupButtoncreateStrokeJoinButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)static JPopupButtoncreateStrokePlacementButton(DrawingEditor editor)static JPopupButtoncreateStrokeTypeButton(DrawingEditor editor)static JPopupButtoncreateStrokeWidthButton(DrawingEditor editor)static JPopupButtoncreateStrokeWidthButton(DrawingEditor editor, double[] widths)static JPopupButtoncreateStrokeWidthButton(DrawingEditor editor, double[] widths, ResourceBundleUtil labels)static JPopupButtoncreateStrokeWidthButton(DrawingEditor editor, ResourceBundleUtil labels)static javax.swing.AbstractButtoncreateToggleGridButton(DrawingView view)Creates a button which toggles between two GridConstrainer for a DrawingView.static javax.swing.AbstractButtoncreateZoomButton(DrawingEditor editor)static javax.swing.AbstractButtoncreateZoomButton(DrawingView view)static javax.swing.AbstractButtoncreateZoomButton(DrawingView view, double[] factors)
-
-
-
Field Detail
-
DEFAULT_COLORS
public static final java.util.List<ColorIcon> DEFAULT_COLORS
Mac OS X 'Apple Color Palette'. This palette has 8 columns.
-
DEFAULT_COLORS_COLUMN_COUNT
public static final int DEFAULT_COLORS_COLUMN_COUNT
- See Also:
- Constant Field Values
-
WEBSAVE_COLORS
public static final java.util.List<ColorIcon> WEBSAVE_COLORS
Websave color palette as used by Macromedia Fireworks. This palette has 19 columns. The leftmost column contains a redundant set of color icons to make selection of gray scales and of the primary colors easier.
-
WEBSAVE_COLORS_COLUMN_COUNT
public static final int WEBSAVE_COLORS_COLUMN_COUNT
- See Also:
- Constant Field Values
-
HSB_COLORS
public static final java.util.List<ColorIcon> HSB_COLORS
HSB color palette with a set of colors chosen based on a physical criteria.This is a 'human friendly' color palette which arranges the color in a way that makes it easy for humans to select the desired color. The colors are ordered in a way which minimizes the color contrast effect in the human visual system.
This palette has 12 columns and 10 rows.
The topmost row contains a null-color and a gray scale from white to black in 10 percent steps.
The remaining rows contain colors taken from the outer hull of the HSB color model:
The columns are ordered by hue starting with red - the lowest wavelength - and ending with purple - the highest wavelength. There are 12 different hues, so that all primary colors with their additive complements can be selected.
The rows are orderd by brightness with the brightest color at the top (sky) and the darkest color at the bottom (earth). The first 5 rows contain colors with maximal brightness and a saturation ranging form 20% up to 100%. The remaining 4 rows contain colors with maximal saturation and a brightness ranging from 90% to 20% (this also makes for a range from 100% to 20% if the 5th row is taken into account).
-
HSB_COLORS_COLUMN_COUNT
public static final int HSB_COLORS_COLUMN_COUNT
- See Also:
- Constant Field Values
-
HSB_COLORS_AS_RGB
public static final java.util.List<ColorIcon> HSB_COLORS_AS_RGB
This is the same palette as HSB_COLORS, but all color values are specified in the sRGB color space.
-
HSB_COLORS_AS_RGB_COLUMN_COUNT
public static final int HSB_COLORS_AS_RGB_COLUMN_COUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDrawingActions
public static java.util.Collection<javax.swing.Action> createDrawingActions(DrawingEditor editor)
-
createDrawingActions
public static java.util.Collection<javax.swing.Action> createDrawingActions(DrawingEditor editor, java.util.List<Disposable> dsp)
-
createSelectionActions
public static java.util.Collection<javax.swing.Action> createSelectionActions(DrawingEditor editor)
-
addSelectionToolTo
public static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor)
-
addSelectionToolTo
public static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor, java.util.Collection<javax.swing.Action> drawingActions, java.util.Collection<javax.swing.Action> selectionActions)
-
addSelectionToolTo
public static javax.swing.JToggleButton addSelectionToolTo(javax.swing.JToolBar tb, DrawingEditor editor, Tool selectionTool)
-
addToolTo
public static javax.swing.JToggleButton addToolTo(javax.swing.JToolBar tb, DrawingEditor editor, Tool tool, java.lang.String labelKey, ResourceBundleUtil labels)Method addSelectionToolTo must have been invoked prior to this on the JToolBar.
-
addZoomButtonsTo
public static void addZoomButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
-
createZoomButton
public static javax.swing.AbstractButton createZoomButton(DrawingEditor editor)
-
createZoomButton
public static javax.swing.AbstractButton createZoomButton(DrawingView view)
-
createZoomButton
public static javax.swing.AbstractButton createZoomButton(DrawingView view, double[] factors)
-
addAttributesButtonsTo
public static void addAttributesButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)Creates toolbar buttons and adds them to the specified JToolBar
-
addColorButtonsTo
public static void addColorButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
-
addColorButtonsTo
public static void addColorButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor, java.util.List<ColorIcon> colors, int columnCount)
-
createEditorColorButton
public static JPopupButton createEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)
Creates a color button, with an action region and a popup menu. The button works like the color button in Microsoft Office:- When the user clicks on the action region, the default color of the DrawingEditor is applied to the selected figures.
- When the user opens the popup menu, a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A rectangle on the color button displays the current default color of the DrawingEditor. The rectangle has the dimensions 1, 17, 20, 4 (x, y, width, height).
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.
-
createEditorColorButton
public static JPopupButton createEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
Creates a color button, with an action region and a popup menu. The button works like the color button in Microsoft Office:- When the user clicks on the action region, the default color of the DrawingEditor is applied to the selected figures.
- When the user opens the popup menu, a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A rectangle on the color button displays the current default color of the DrawingEditor. The rectangle has the dimensions 1, 17, 20, 4 (x, y, width, height).
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
-
createEditorColorButton
public static JPopupButton createEditorColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)
Creates a color button, with an action region and a popup menu. The button works like the color button in Microsoft Office:- When the user clicks on the action region, the default color of the DrawingEditor is applied to the selected figures.
- When the user opens the popup menu, a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A shape on the color button displays the current default color of the DrawingEditor.
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.colorShape- This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.
-
createSelectionColorButton
public static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:- When the user clicks at the button a popup menu with a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A shape on the color button displays the color of the selected figures. If no figures are selected, the default color of the DrawingEditor is displayed.
- A rectangle on the color button displays the current default color of the DrawingEditor. The rectangle has the dimensions 1, 17, 20, 4 (x, y, width, height).
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.
-
createSelectionColorButton
public static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:- When the user clicks at the button a popup menu with a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A rectangle on the color button displays the current default color of the DrawingEditor. The rectangle has the dimensions 1, 17, 20, 4 (x, y, width, height).
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
-
createSelectionColorButton
public static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:- When the user clicks at the button a popup menu with a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A shape on the color button displays the color of the selected figures. If no figures are selected, the default color of the DrawingEditor is displayed.
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.colorShape- This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.
-
createSelectionColorButton
public static JPopupButton createSelectionColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
Creates a color button, with an action region and a popup menu. The button works like the color button in Adobe Fireworks:- When the user clicks at the button a popup menu with a color palette is displayed. Choosing a color from the palette changes the default color of the editor and also changes the color of the selected figures.
- A shape on the color button displays the color of the selected figures. If no figures are selected, the default color of the DrawingEditor is displayed.
- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.colorShape- This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.
-
createSelectionColorChooserButton
public static JPopupButton createSelectionColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
-
createSelectionColorChooserButton
public static JPopupButton createSelectionColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, @Nullable java.lang.Class uiclass, @Nullable java.util.List<Disposable> dsp)
-
createDrawingColorButton
public static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.
-
createDrawingColorButton
public static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.
-
createDrawingColorButton
public static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.colorShape- This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.
-
createDrawingColorButton
public static JPopupButton createDrawingColorButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.util.List<ColorIcon> swatches, int columnCount, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, java.util.List<Disposable> dsp)
Creates a color button, with an action region and a popup menu. The button acts on attributes of the Drawing object in the current DrawingView of the DrawingEditor.- Parameters:
editor- The DrawingEditor.attributeKey- The AttributeKey of the color.swatches- A list with labeled colors containing the color palette of the popup menu. The actual labels are retrieved from the supplied resource bundle. This is usually a LinkedHashMap, so that the colors have a predictable order.columnCount- The number of columns of the color palette.labelKey- The resource bundle key used for retrieving the icon and the tooltip of the button.labels- The resource bundle.defaultAttributes- A set of attributes which are also applied to the selected figures, when a color is selected. This can be used, to set attributes that otherwise prevent the color from being shown. For example, when the color attribute is set, we wan't the gradient attribute of the Figure to be cleared.colorShape- This shape is superimposed on the icon of the button. The shape is drawn with the default color of the DrawingEditor.
-
createDrawingColorChooserButton
public static JPopupButton createDrawingColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, @Nullable java.util.List<Disposable> dsp)
-
createDrawingColorChooserButton
public static JPopupButton createDrawingColorChooserButton(DrawingEditor editor, AttributeKey<java.awt.Color> attributeKey, java.lang.String labelKey, ResourceBundleUtil labels, @Nullable java.util.Map<AttributeKey,java.lang.Object> defaultAttributes, java.awt.Shape colorShape, @Nullable java.lang.Class uiclass, @Nullable java.util.List<Disposable> dsp)
-
addStrokeButtonsTo
public static void addStrokeButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
-
createStrokeWidthButton
public static JPopupButton createStrokeWidthButton(DrawingEditor editor)
-
createStrokeWidthButton
public static JPopupButton createStrokeWidthButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createStrokeWidthButton
public static JPopupButton createStrokeWidthButton(DrawingEditor editor, double[] widths)
-
createStrokeWidthButton
public static JPopupButton createStrokeWidthButton(DrawingEditor editor, double[] widths, ResourceBundleUtil labels)
-
createStrokeDecorationButton
public static JPopupButton createStrokeDecorationButton(DrawingEditor editor)
-
createStrokeDashesButton
public static JPopupButton createStrokeDashesButton(DrawingEditor editor)
-
createStrokeDashesButton
public static JPopupButton createStrokeDashesButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createStrokeDashesButton
public static JPopupButton createStrokeDashesButton(DrawingEditor editor, double[][] dashes)
-
createStrokeDashesButton
public static JPopupButton createStrokeDashesButton(DrawingEditor editor, double[][] dashes, ResourceBundleUtil labels)
-
createStrokeDashesButton
public static JPopupButton createStrokeDashesButton(DrawingEditor editor, double[][] dashes, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
createStrokeTypeButton
public static JPopupButton createStrokeTypeButton(DrawingEditor editor)
-
createStrokePlacementButton
public static JPopupButton createStrokePlacementButton(DrawingEditor editor)
-
addFontButtonsTo
public static void addFontButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)
-
createFontButton
public static JPopupButton createFontButton(DrawingEditor editor)
-
createFontButton
public static JPopupButton createFontButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createFontButton
public static JPopupButton createFontButton(DrawingEditor editor, AttributeKey<java.awt.Font> key, ResourceBundleUtil labels)
-
createFontButton
public static JPopupButton createFontButton(DrawingEditor editor, AttributeKey<java.awt.Font> key, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
createFontStyleBoldButton
public static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor)
-
createFontStyleBoldButton
public static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createFontStyleBoldButton
public static javax.swing.JButton createFontStyleBoldButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
createFontStyleItalicButton
public static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor)
-
createFontStyleItalicButton
public static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createFontStyleItalicButton
public static javax.swing.JButton createFontStyleItalicButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
createFontStyleUnderlineButton
public static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor)
-
createFontStyleUnderlineButton
public static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createFontStyleUnderlineButton
public static javax.swing.JButton createFontStyleUnderlineButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
addAlignmentButtonsTo
public static void addAlignmentButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor)Creates toolbar buttons and adds them to the specified JToolBar
-
addAlignmentButtonsTo
public static void addAlignmentButtonsTo(javax.swing.JToolBar bar, DrawingEditor editor, java.util.List<Disposable> dsp)Creates toolbar buttons and adds them to the specified JToolBar.
-
createToggleGridButton
public static javax.swing.AbstractButton createToggleGridButton(DrawingView view)
Creates a button which toggles between two GridConstrainer for a DrawingView.
-
createStrokeCapButton
public static JPopupButton createStrokeCapButton(DrawingEditor editor)
-
createStrokeCapButton
public static JPopupButton createStrokeCapButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createStrokeCapButton
public static JPopupButton createStrokeCapButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
createStrokeJoinButton
public static JPopupButton createStrokeJoinButton(DrawingEditor editor)
-
createStrokeJoinButton
public static JPopupButton createStrokeJoinButton(DrawingEditor editor, ResourceBundleUtil labels)
-
createStrokeJoinButton
public static JPopupButton createStrokeJoinButton(DrawingEditor editor, ResourceBundleUtil labels, java.util.List<Disposable> dsp)
-
createPickAttributesButton
public static javax.swing.JButton createPickAttributesButton(DrawingEditor editor)
-
createPickAttributesButton
public static javax.swing.JButton createPickAttributesButton(DrawingEditor editor, java.util.List<Disposable> dsp)
-
createApplyAttributesButton
public static javax.swing.JButton createApplyAttributesButton(DrawingEditor editor)
Creates a button that applies the default attributes of the editor to the current selection.
-
createApplyAttributesButton
public static javax.swing.JButton createApplyAttributesButton(DrawingEditor editor, java.util.List<Disposable> dsp)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG