This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The java.awt.Robot class has an api to sample pixel value of any screen pixel. It can be used to build a color sampler panel that can be added to the JColorChoosers used inside NetBeans.
Created attachment 20861 [details] Implementation of the Color Sampler panel
Created attachment 20862 [details] Color Chooser Panel implementation
Created attachment 20863 [details] icon used for sampler button
Created attachment 20864 [details] Executable jar file with an example.
1. Save ColorSampler.java, ColorSampler.gif and ColorSamplerColorChooserPanel.java. 2. Compile ColorSampler.java and ColorSamplerColorChooserPanel.java 3. Run > java ColorSamplerColorChooserPanel Alternatively save ColorSampler.jar and run: > java -jar ColorSampler.jar
Actually this may become part of J2SE Swing JFileChooser. I filed an RFE: bug_id=6242279 It may take a day or two before it shows up in the external database.
A module based on the concept has been uploaded on the contrib website. Here are the details. The DesktopSampler module installs a toolbar in NetBeans IDE which has a Color Sampler and a Magnifier. (Note: Makes use of APIs from java.awt.Robot) (See the attached screenshot) Drag on the dropper icon to sample color from desktop. The sampled color is displayed in the label and the color value is set in the text field. The color value string is also copied to the system clipboard. Click on the pencil icon to select different color string formats. Various popular formats are supported that work in HTML/CSS (such as #XXXXXX, rgb(r, g, b) or Java BeanInfo Java initializer string (such as new Color(r,g,b) or NetBeans property sheet (such as [r,g,b]). Click on the magnifying glass icon to show the magnifier. Drag on the magnifier label to magnify 16x16 area of desktop. Double click on the sampled color label to show the JColorChooser with a ColorSampler tab which makes use of the same components. I use to sample colors from web pages etc while working with HTML/CSS/JSP files (hence the different formats). Here are the links to the files: http://contrib.netbeans.org/files/documents/130/544/org-netbeans-modules- desktopsampler.nbm http://contrib.netbeans.org/files/documents/130/546/DesktopSampler4.2devmodulep roject.zip http://contrib.netbeans.org/files/documents/130/545/DesktopSampler4.1moduleproj ect.zip
Created attachment 24137 [details] DesktopSampler NetBeans toolbar screenshot
The DesktopSampler module has been checked in under "contrib/". Here is the link: http://www.netbeans.org/source/browse/contrib/DesktopSampler/
It's not planned for long time. It's fair to close as WONTFIX