GithubHelp home page GithubHelp logo

dheid / colorpicker Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 4.0 555 KB

A nice color picker using Java Swing that contains a visual color selection and input boxes to enter RGB and HSB values manually.

Home Page: https://www.daniel-heid.de/open-source-projekte/

License: BSD 3-Clause "New" or "Revised" License

Java 100.00%
gui awt desktop java-swing multiplatform swing ui

colorpicker's People

Contributors

dependabot[bot] avatar dheid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

colorpicker's Issues

[BUG] Color slider doesn't update when using setColor()

Describe the bug
setColor() doesn't seem to update the position of the color slider (neither hue, brightness or saturation is updated)

Code snippets

public void setAccentColor(Color accentColor) {
    accentColorPicker.setColor(accentColor);
}

Capture

[BUG] NPE on using slider

Describe the bug
An NullPointerException is thrown on using the slider (tried in UiBooster test class)

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "javax.swing.JSlider.getOrientation()" because "this.slider" is null
	at com.bric.colorpicker.colorslider.SliderMouseListener.updateSliderValue(SliderMouseListener.java:24)
	at com.bric.colorpicker.colorslider.SliderMouseListener.mouseDragged(SliderMouseListener.java:42)
	at java.desktop/java.awt.Component.processMouseMotionEvent(Component.java:6662)
	at java.desktop/javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3360)
	at java.desktop/java.awt.Component.processEvent(Component.java:6383)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4990)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4822)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4565)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4489)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2769)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4822)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
	at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Code snippets
Used this code

Expected behavior
Changing the saturation of the color and not throw an exception ๐Ÿ˜Š

[BUG] NullPointerException

I have a colour picker inside a dockable frame from DockingFrames. It starts off minimized and when it is shown the colour picker throws an NPE

java.lang.NullPointerException
	at java.desktop/javax.swing.plaf.basic.BasicSliderUI.calculateFocusRect(BasicSliderUI.java:674)
	at java.desktop/javax.swing.plaf.basic.BasicSliderUI.calculateGeometry(BasicSliderUI.java:660)
	at com.bric.colorpicker.colorslider.ColorSliderUI.access$000(ColorSliderUI.java:47)
	at com.bric.colorpicker.colorslider.ColorSliderUI$ResizeListener.componentResized(ColorSliderUI.java:207)
	at java.desktop/java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:168)
	at ...

[BUG] Illegal argument exception when color wheel is tiny

Describe the bug
When the component gets too small such as when the frame is resized, the color wheel disappears entirely. However, the selection handle/circle is still visible and creates an exception when you click on it.

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: The saturation value (-5.3851647) must be between [0,1]
	at com.bric.colorpicker.ColorPickerPanel.setHSB(ColorPickerPanel.java:460)
	at com.bric.colorpicker.ColorPickerPanel$ColorPickerMouseInputListener.mousePressed(ColorPickerPanel.java:682)

[REQUEST] Horizontal layout for controls

By default the controls and preview swatch are displayed to the right of the color wheel. I'd like to see more customization available by default, specifically an option to have all the modes displayed below the color wheel by default laid out horizontally rather than vertically. It would save a lot of time :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.