Archived Legacy DynamicHUD
  • Dynamic HUD
  • Import using Gradle
  • Widgets
    • Adding Widgets
      • TextWidget
      • ItemWidget
      • ArmorWidget
    • Creating your own Widget class
    • Widget class
    • WidgetManager
    • WidgetBox
  • Saving and Loading
    • Saving and Loading
    • Changing save file name and directory
  • Moveable Screen
    • AbstractMoveableScreen
    • Default Moveable Screen
    • Using the default Moveable Screen
    • Creating and using your own MoveableScreen class
  • ContextMenu
    • ContextMenu class
    • ContextMenuOptionsProvider interface
    • DoubleInputScreen
    • DataInputScreen
  • Slider Widget
    • Slider
  • SliderWidgetBuilder
  • ColorPicker
    • ColorGradientPicker
      • ColorPickerButton
      • GradientBox
      • GradientSlider
  • Helpers
    • ColorHelper
    • DrawHelper
    • TextureHelper
Powered by GitBook
On this page
  • ColorPickerButton
  • Fields
  • Constructors
  • Methods
  1. ColorPicker
  2. ColorGradientPicker

ColorPickerButton

This page talks about ColorPickerButton class

PreviousColorGradientPickerNextGradientBox

ColorPickerButton

The class provides functionality for creating and displaying color picker buttons in Minecraft Fabric.

Fields

  • x: The x position of the button.

  • y: The y position of the button.

  • width: The width of the button.

  • height: The height of the button.

  • isPicking: Whether the button is currently in picking mode.

Constructors

ColorPickerButton(int x, int y, int width, int height)

Constructs a ColorPickerButton object with the given position and size.

Methods

render(MatrixStack matrices)

Renders this button on screen.

onClick(double mouseX, double mouseY, int button)

Handles mouse clicks on this button. This method sets the picking mode to true if the mouse is over the button and the left mouse button was clicked.

isPicking()

Returns whether this button is currently in picking mode.

setPicking(boolean picking)

Sets whether this button is currently in picking mode.

// Create a new ColorPickerButton
ColorPickerButton button = new ColorPickerButton(10, 10, 100, 20);

// Render the ColorPickerButton
button.render(matrices);

// Handle mouse input
if (button.onClick(mouseX, mouseY)) {
    // The mouse was clicked on the button
}

In this example, we create a new ColorPickerButton with a position of (10, 10) and a size of (100, 20). We then render the ColorPickerButton on screen using its render method. We also handle mouse input by calling its onClick method.

The ColorPickerButton is already called and present in . But if you still want to add it yourself somewhere you can do it by:

ColorPickerButton
ColorGradientPicker