Class JDeltaBadge

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public class JDeltaBadge
    extends javax.swing.JPanel
    File history 2020-12-11 - Initially created - Darshana Ariyarathna 2021-03-20 - Change structure of the project, copy and paste file from the old structure
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DARK_BUTTON  
      (package private) java.awt.GridBagConstraints gb  
      static int INFO_BUTTON  
      static int LIGHT_BUTTON  
      static int PRIMARY_BUTTON  
      private javax.swing.JLabel primaryLabel  
      private javax.swing.JPanel primaryPanel  
      private java.lang.String primaryText  
      static int SECONDARY_BUTTON  
      private javax.swing.JLabel secondaryLabel  
      private javax.swing.JPanel secondaryPanel  
      private java.lang.String secondaryText  
      static int SUCCESS_BUTTON  
      static int WARNING_BUTTON  
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      JDeltaBadge()
      No argument constructor
      JDeltaBadge​(java.lang.String primaryText, int amount)
      This will create a basic components with light primary background and dark primary fonts with a dark secondary fonts and light secondary background
      JDeltaBadge​(java.lang.String primaryText, int amount, JDeltaColors secondaryForegroundColor, JDeltaColors secondaryBackgroundColor)
      This will create a custom colored secondary badge
      JDeltaBadge​(java.lang.String primaryText, java.lang.String secondaryText)
      This will create a basic components with light primary background and dark primary fonts with a dark secondary fonts and light secondary background
      JDeltaBadge​(java.lang.String primaryText, java.lang.String secondaryText, int buttonType)
      This constructor will create standard colored badge with the button type
      JDeltaBadge​(java.lang.String primaryText, java.lang.String secondaryText, JDeltaColors secondaryForegroundColor, JDeltaColors secondaryBackgroundColor)
      This will create a custom colored secondary badge
      JDeltaBadge​(java.lang.String primaryText, java.lang.String secondaryText, JDeltaColors primaryForegroundColor, JDeltaColors primaryBackgroundColor, JDeltaColors secondaryForegroundColor, JDeltaColors secondaryBackgroundColor)
      You can create a more colorful badge
      JDeltaBadge​(java.lang.String primaryText, java.lang.String secondaryText, JDeltaColors primaryBackgroundColor, JDeltaColors primaryForegroundColor, JDeltaFonts primaryFont, JDeltaColors secondaryBackgroundColor, JDeltaColors secondaryForegroundColor, JDeltaFonts secondaryFont, boolean rounded)
      This will create a full flexible JDeltaButton for the user
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JDeltaColors getBackgroundColor()
      Get background color of the JDeltaBadge
      JDeltaFonts getPrimaryFont()
      get primary's font
      JDeltaColors getPrimaryForegroundColor()
      get primary's foreground color
      java.lang.String getPrimaryText()
      get primary text from the jDeltaBadge
      JDeltaColors getSecondaryBackgroundColor()
      get Secondary's background color
      JDeltaFonts getSecondaryFont()
      this will get secondary's font object
      JDeltaColors getSecondaryForegroundColor()
      get secondary's foreground color
      java.lang.String getSecondaryText()
      get secondary text from the jDeltaBadge
      void setBackgroundColor​(JDeltaColors backgroundColor)
      Set background color of the JDeltaBadge
      void setPrimaryFont​(JDeltaFonts primaryFont)
      update primary's font
      void setPrimaryForegroundColor​(JDeltaColors primaryForegroundColor)
      this will update your primary foreground color
      void setPrimaryText​(java.lang.String primaryText)
      Can update your jDeltaButton's primary text
      void setSecondaryBackgroundColor​(JDeltaColors primaryBackgroundColor)
      update Secondary's background color
      void setSecondaryFont​(JDeltaFonts font)
      this will set secondary's font object
      void setSecondaryForegroundColor​(JDeltaColors primaryForegroundColor)
      this will update your secondary foreground color
      void setSecondaryText​(int amount)
      Can update your jDeltaButton's secondary text
      void setSecondaryText​(java.lang.String secondaryText)
      Can update your jDeltaButton's secondary text
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • primaryText

        private java.lang.String primaryText
      • secondaryText

        private java.lang.String secondaryText
      • primaryLabel

        private javax.swing.JLabel primaryLabel
      • secondaryLabel

        private javax.swing.JLabel secondaryLabel
      • primaryPanel

        private javax.swing.JPanel primaryPanel
      • secondaryPanel

        private javax.swing.JPanel secondaryPanel
      • gb

        java.awt.GridBagConstraints gb
    • Constructor Detail

      • JDeltaBadge

        public JDeltaBadge()
        No argument constructor
        Since:
        v1.0.0
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           java.lang.String secondaryText)
        This will create a basic components with light primary background and dark primary fonts with a dark secondary fonts and light secondary background
        Parameters:
        primaryText - Text to write as primary text
        secondaryText - Text to write as secondary text
        Since:
        v1.0.0
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           int amount)
        This will create a basic components with light primary background and dark primary fonts with a dark secondary fonts and light secondary background
        Parameters:
        primaryText - Text to write as primary text
        amount - A integer number to write as secondary text
        Since:
        v1.0.0
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           java.lang.String secondaryText,
                           JDeltaColors secondaryForegroundColor,
                           JDeltaColors secondaryBackgroundColor)
        This will create a custom colored secondary badge
        Parameters:
        primaryText - Text to write as primary text
        secondaryText - Text to write as primary text
        secondaryForegroundColor - Secondary font color
        secondaryBackgroundColor - Secondary background color
        Since:
        v1.0.0
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           int amount,
                           JDeltaColors secondaryForegroundColor,
                           JDeltaColors secondaryBackgroundColor)
        This will create a custom colored secondary badge
        Parameters:
        primaryText - Text to write as primary text
        amount - A integer number to write as secondary text
        secondaryForegroundColor - Secondary font color
        secondaryBackgroundColor - Secondary background color
        Since:
        v1.0.0
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           java.lang.String secondaryText,
                           JDeltaColors primaryForegroundColor,
                           JDeltaColors primaryBackgroundColor,
                           JDeltaColors secondaryForegroundColor,
                           JDeltaColors secondaryBackgroundColor)
        You can create a more colorful badge
        Parameters:
        primaryText - Text to write as primary text
        secondaryText - Text to write as secondary text
        primaryForegroundColor - Primary font color
        primaryBackgroundColor - Primary background color
        secondaryForegroundColor - Secondary font color
        secondaryBackgroundColor - Secondary background color
        Since:
        v1.0.0
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           java.lang.String secondaryText,
                           int buttonType)
        This constructor will create standard colored badge with the button type
        Parameters:
        primaryText - Text to write as primary text
        secondaryText - Text to write as secondary text
        buttonType - button type
        Since:
        v1.0.1
      • JDeltaBadge

        public JDeltaBadge​(java.lang.String primaryText,
                           java.lang.String secondaryText,
                           JDeltaColors primaryBackgroundColor,
                           JDeltaColors primaryForegroundColor,
                           JDeltaFonts primaryFont,
                           JDeltaColors secondaryBackgroundColor,
                           JDeltaColors secondaryForegroundColor,
                           JDeltaFonts secondaryFont,
                           boolean rounded)
        This will create a full flexible JDeltaButton for the user
        Parameters:
        primaryText - Text to write as primary text
        secondaryText - Text to write as secondary text
        primaryBackgroundColor - Primary font color
        primaryForegroundColor - Primary font color
        primaryFont - Primary font specifications
        secondaryBackgroundColor - Secondary background color
        secondaryForegroundColor - Secondary font color
        secondaryFont - Secondary font specifications
        rounded - is the JDeltaButton round in shape or not
        Since:
        v1.0.0
    • Method Detail

      • getBackgroundColor

        public JDeltaColors getBackgroundColor()
        Get background color of the JDeltaBadge
        Returns:
        background color
        Since:
        v1.0.0
      • setBackgroundColor

        public void setBackgroundColor​(JDeltaColors backgroundColor)
        Set background color of the JDeltaBadge
        Parameters:
        backgroundColor - New background color of the JDeltaBadge
        Since:
        v1.0.0
      • getSecondaryText

        public java.lang.String getSecondaryText()
        get secondary text from the jDeltaBadge
        Returns:
        secondary text of the jDeltaBadge
        Since:
        v1.0.0
      • setSecondaryText

        public void setSecondaryText​(java.lang.String secondaryText)
        Can update your jDeltaButton's secondary text
        Parameters:
        secondaryText - New secondary text
        Since:
        v1.0.0
      • setSecondaryText

        public void setSecondaryText​(int amount)
        Can update your jDeltaButton's secondary text
        Parameters:
        amount - New secondary amount
        Since:
        v1.0.0
      • getSecondaryForegroundColor

        public JDeltaColors getSecondaryForegroundColor()
        get secondary's foreground color
        Returns:
        secondary's foreground color
        Since:
        v1.0.0
      • setSecondaryForegroundColor

        public void setSecondaryForegroundColor​(JDeltaColors primaryForegroundColor)
        this will update your secondary foreground color
        Parameters:
        primaryForegroundColor - new secondary foreground color
        Since:
        v1.0.0
      • getSecondaryFont

        public JDeltaFonts getSecondaryFont()
        this will get secondary's font object
        Returns:
        secondary's font object
        Since:
        v1.0.0
      • setSecondaryFont

        public void setSecondaryFont​(JDeltaFonts font)
        this will set secondary's font object
        Parameters:
        font - new font for secondary
        Since:
        v1.0.0
      • getSecondaryBackgroundColor

        public JDeltaColors getSecondaryBackgroundColor()
        get Secondary's background color
        Returns:
        Secondary's background color
        Since:
        v1.0.0
      • setSecondaryBackgroundColor

        public void setSecondaryBackgroundColor​(JDeltaColors primaryBackgroundColor)
        update Secondary's background color
        Parameters:
        primaryBackgroundColor - Secondary's background color
        Since:
        v1.0.0
      • getPrimaryText

        public java.lang.String getPrimaryText()
        get primary text from the jDeltaBadge
        Returns:
        primary text of the jDeltaBadge
        Since:
        v1.0.0
      • setPrimaryText

        public void setPrimaryText​(java.lang.String primaryText)
        Can update your jDeltaButton's primary text
        Parameters:
        primaryText - New primary text
        Since:
        v1.0.0
      • getPrimaryForegroundColor

        public JDeltaColors getPrimaryForegroundColor()
        get primary's foreground color
        Returns:
        primary's foreground color
        Since:
        v1.0.0
      • setPrimaryForegroundColor

        public void setPrimaryForegroundColor​(JDeltaColors primaryForegroundColor)
        this will update your primary foreground color
        Parameters:
        primaryForegroundColor - new primary foreground color
        Since:
        v1.0.0
      • getPrimaryFont

        public JDeltaFonts getPrimaryFont()
        get primary's font
        Returns:
        primary's font
        Since:
        v1.0.0
      • setPrimaryFont

        public void setPrimaryFont​(JDeltaFonts primaryFont)
        update primary's font
        Parameters:
        primaryFont - primary's font
        Since:
        v1.0.0