Question

I'm trying to implement a custom JColorChooser.

colorPanel.setLayout(new GridLayout(1,2));
    JColorChooser tcc = new JColorChooser();
    AbstractColorChooserPanel [] panels = tcc.getChooserPanels();
    for(AbstractColorChooserPanel p : panels){
        if(p.getDisplayName().equals("RVB")){
                colorPanel.add(p);
        }
    }

    final JDialog j = new JDialog(jframe, true);
    j.setSize(800, 300);
    j.setLayout(new BorderLayout(1,2));
    createListColor();
    j.add(colorPanel);

This works well and show me the following :

enter image description here

No i'm stuck on how I can get the listeners for the widgets because the problem is that the panel isn't created by me. How can I get the components (TextField, etc.) of the AbstractColorChooserPanel p ?

How can I catch the events on the widgets and how can I get the value of the textFields in the component?

Was it helpful?

Solution

I don't think there is any API to get the individual components.

You can use Darryls' SwingUtils to access the components on any panel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top