How to get the color of a point?

Hi.
I have a JPanel with some black circles draw on it (with drawOval() method), now i need to scan all the JPanel and search the black points and the withe ones.
I couldn't do this
i can found any method that give me the properties of a point in a JPanel.
can anyone tell where to look for this?, any method that controls the properties of a point?
PD: if is necessary, i can change the JPanel for a Canvas
TKS

hi. i make what you told me, but the getRGB() method is always giving me -1 as return.
here is my code, it's simple but i only need to make a matriz with this circles.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class GUI extends JFrame{
     private JPanel panel;
     private JFrame frame;
     public GUI () {
          frame = new JFrame("Puntos Espaciales.");
          JButton button = new JButton("Draw Circle");
          JButton button2 = new JButton("1");
          Container con = frame.getContentPane();
          panel = new JPanel();
          panel.setBorder(BorderFactory.createTitledBorder("Hello"));
          panel.setBackground(Color.WHITE);
          con.add(panel, BorderLayout.CENTER);
          con.add(button, BorderLayout.SOUTH);
          con.add(button2, BorderLayout.EAST);
          frame.setSize(800,600);
          frame.setVisible(true);
          button.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent event) {
                 Graphics g = panel.getGraphics();
                 g.setColor(Color.BLACK);
                   g.fillOval(50, 50, 50, 50);
          button2.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent event) {
                 BufferedImage image = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
                 Graphics2D g2d = image.createGraphics();
                 panel.paint( g2d );
                 g2d.dispose();
                 System.out.println("5,5" + image.getRGB(5, 5));
                 System.out.println("50,50" + image.getRGB(50, 50));
     public static void main(String[] args) {
          GUI gui = new GUI();
}tks for your help
PD: sorry for the delay

Similar Messages

  • How I get the 68881/68882 floating point emulator?

    I already installed LabView 4.01 Full devepment system over a macintosh Power PC 6100/60, it's using Mac Os. 7.5.
    I can't run LabView, because there appears a error message that says "LabView is built to run on a Mac at Motorola 680x0 processors. It can be run on a power Macintosh but requires software 68881/68882 floating point emulator".
    So my question is how I get the floating point emulator?

    The emulator you are looking for will have
    to be retreived from Apple. It is a piece of
    software that fools programs into believeing
    you have harware that is not present in your system. I am no Mac guru so this is all I can tell you.
    I will warn you however that you are using a very outdated version of Labview (the latest is 6.0.2).
    Kevin Kent

  • How to get the color interpretation ( transparency/opacity)

    Hi all,
    I am trying to translate colors that may be affected by opacity & transparency into a strong color.
    Input colors may be RGB, CMYK and LAB.
    Right now, I am :
    1) duplicating source color (because Paper/Black can't be tweaked, I need to work on a copy)
    2) Setting duplicated color space to CMYK
    3) creating a dummy color in CMYK
    4) affect CMYK values of the duplicated color by transparency and opacity
    ie : source color is Black [0,0,0,100] at 50% opacity and 50% transparent ( frame effects) => [ 0*0.5*0.5 , 0*0.5*0.5 , 0*0.5*0.5 , 100*0.5*0.5 ] = > [0 , 0, 0, 25 ];
    5) setting dummy color space to source color space
    6) Do my computations based on dummyColor
    6) remove duplicated color
    7) remove dummy color
    The process is working but deltas on teh colors are a serious issue. Not big deltas but enough to corrupt the trust on the color interpretation.
    SO question is : Is there any way to get a correct interpretation of a color affected by opacity/transparency settings ?
    Do you have any link towars an understandable paper about how lab/rgb and CMYK colors are affected by opacity/transparency ?
    Thanks in advance,
    best,
    Loic

    @Loic – nothing much to offer here from my side. Just a source by Adobe which is very likely outdated, but you can look for hints doing research on the theme:
    "Transparency in PDF, Adobe Developer Technologies, Technical Note #5407" from 30 May 2000 at:
    http://www.planetpdf.com/mainpage.asp?webpageid=837
    Especially chapters:
    3 Color Compositing Computations
    4 Shape and Opacity Computations
    5 Groups
    6 Soft Masks
    7 Color Space and Color Rendering Issues
    should get you going. At least a bit. See for yourself…
    Uwe

  • How to get the color value matching with HTML?

    Hello,
    I'd like to have the color value based on the HTML pattern using JS like InDesign file is having the value c=80,M=20,Y=40,K=20 and getting the HTML pattern as #29a37a during HTML export.
    Please advise to get the same type of value for all the colors in InDesign without doing HTML export using JS.
    Thanks,
    Praveen

    @Gejaraja – read the following to get an idea:
    Harbs
    Hexadecimal Swatches in InDesign
    http://in-tools.com/article/scripts-blog/hexadecimal-swatches-in-indesign/
    Uwe

  • How to get the colors value of each pixel (ps cs3 ,JS) ?

    hi all,
    i use something below, and they dont work.
    var colorvalue=docRef.colorSamplers[0].color.red
    fileOut.write("value=")
    fileOut.write(colorvalue)
    thanks!

    > var colorvalue=docRef.colorSamplers[0].color.red
    should be:
    var colorvalue=docRef.colorSamplers[0].color.rgb.red
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • How to get the Swatch Options Color Type?

    How to get the Swatch Options Color Type name that is "Process Color" or "Spot Color" which shown in the Color Type via scripting..
    Thanks...

    Could you please provide any example for how to get the color type name that is process or spot. Thanks for looking into this.
    Advance thanks,
    Maria Prabudass

  • To get the color View property from a file

    How can get the color view property value of a framemaker file using framemaker API ?

    Hi Asha,
    Color views do not have object handles; rather, they are modified at the color (FO_Color) object level. That is, each color has a property called FP_ColorViewCtl which defines its behavior in each of the six built-in color views. If you want to modify the makeup of a color view, you should modify the colors themselves with respect to the desired view.
    The FP_SpotColorView property only sets the active view... it doesn't modify the view.
    Search the FDK ref for FP_ColorViewCtl and you find an explanation, under the FO_Color object properties.
    Russ

  • How do I get the colors back in Itunes 12 sidebar icons

    Hi. I have a hard time getting used to every new itunes version with the user interface getting harder and less friendly than the previous version, probably since itunes 8 or so. I NEED colorful icons to be able to differentiate what is what in the sidebar, and I have always found a work around, since they dropped the much loved colors, in exchange for increasingly monochrome, drab Gray. There is no differentiation even in the grey, no bold letters for titles, headings, album names etc.   In  iTunes 12 however I tried changing the itunes.rsrc file in this version and it really messed my itunes up, to the point where I had to trash it and start all over with new itunes. Does anyone know how to bring the colorful icons back in iTunes 12? This is ONE of the problems, search is not working right for me either for itunes 11 or 12. I would love it if Apple could give us the option of using old Itunes, such as 8 or something similar where everything was more clearly defined and intuitive, at least for me. Thanks!

    PS I am using OSX 10.9.5

  • The app icons I have on the iPad have just come up blank with the app name under it. How do I get the colorful icons to appear? The apps do work though

    The Ipad icons are all just a grey box. How do I get the colorful icons?

    First thing to try is a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

  • I have an IPhone 4S. My color pictures and all icons have lost their color. How do I get the color back? Did I touch a wrong button?

    I have an IPhone 4S. All my color pictures and icons turned to looking like a negative.  No color! How do I get the color back on my phone?

    Hi ladwwd56,
    Welcome to the Support Communities!
    Is it possible that you may have an Accessibility feature called "White on Black" turned on?
    See page 244 of the iPhone User Guide PDF:
    http://manuals.info.apple.com/MANUALS/1000/MA1539/en_US/iPhone_iOS4_User_Guide.p df
    White on Black
    Use White on Black to invert the colors on the iPhone screen, which may make it easier to read the screen. When White on Black is turned on, the screen looks like a photographic negative.
    Invert the screen’s colors: In Settings, choose General > Accessibility and tap the “White on Black” switch.
    If that is not the case, try restarting / resetting the iPhone:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    If that does not resolve the issue, refer to page 146 in the iPhone User Guide to Reset All Settings:
    iPhone User Guide for iOS 7
    manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    Happy New Year!
    - Judy

  • How to get the reverse color of a color

    how to get the reverse color of a color
    thanks

    int red = Math.abs(255 - oldColor.getRed());
    int green = Math.abs(255 - oldColor.getGreen());
    int blue = Math.abs(255 - oldColor.getBlue());
    java.awt.Color inverseColor = new java.awt.Color(red, green, blue);
    Where oldColor is a java.awt.Color object.
    Hope this is want u need !!!

  • Recently i have been getting the color wheel a lot and it is screwing with my happiness.  Any thoughts on how to clean the computer up so this stops?

    Recently i have been getting the color wheel a lot and it is screwing with my happiness.  Any thoughts on how to clean the computer up so this stops?

    Back up all data immediately as your boot drive may be failing.
    If you have more than one user account, these instructions must be carried out as an administrator.
    Triple-click anywhere in the line below on this page to select it:
    syslog -k Sender kernel -k Message CReq 'Channel t|GPU D|I/O|Previous Sh' | tail | open -ef
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear.
    A TextEdit window will open with the output of the command. If the command produced no output, the window will be empty. Post the contents of the TextEdit window (not the Terminal window), if any — the text, please, not a screenshot. The title of the window doesn't matter, and you don't need to post that.

  • How to get the silverish white color in Java

    Hi
    I want to know how to get the silver color in Java
    I am currently using
    R , G , B
    setBackground(new color(255,255,255));
    I am getting bright white color.
    How do I get the polished white(silverish white color) color.
    Thank You

    RGB Color Chart...
    http://www.htmlcenter.com/tutorials/tutorials.cfm/89/General/
    perhaps new Color(223,223,255) ???

  • How to get the entry point in the ActiveX/COM adaptor

    below is the description of the Demo of using the ActiveX/COM to call new seq . 
    API Demo
    1. Manually add a Message Popup step to the MainSequence of a
    new sequence file. Save the sequence file as launch.seq.
    2. Create another sequence file and save the file as caller.seq.
    3. In the MainSequence of the caller.seq file, add Action steps
    using the ActiveX/COM Adapter to call into the TestStand API and
    launch the launch.seq file in a new execution.You might need the
    following two methods to complete this step.
    . Engine.GetSequenceFileEx
    . Engine.NewExecution
    so the question as follows:
    1.i call the method of get sequencefileEx
    2. call the method of getmodlesequenceFile
    3.call the method of evalEntryPointNameExpression
    4.call the method of NewExecution.
    but at the step of 3. i haven't get the entry point.
    so how to solve this issue? thanks
    Attachments:
    QQ图片20140115200924.jpg ‏58 KB
    QQ图片20140115201708.jpg ‏100 KB

    This is a duplicate post of this:
    http://forums.ni.com/t5/NI-TestStand/How-to-get-the-entry-point-in-the-ActiveX-COM-adaptor/m-p/27005...

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

Maybe you are looking for