Per la seconda, sto cercando nella knowledge base:
www.java.sun.com
e fai una ricerca... piuttosto delle solite API consulta, Learning, Reference e ancor prima Bugs.
Per la prima domanda, ho scritto un micro-programma di test, a non mi da il problema a cui accennavi
codice:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class jColorChooserDemo extends JFrame implements ActionListener {
private class showDialog extends JDialog {
public showDialog(JFrame owner, String title, boolean modal) {
super(owner, title, modal);
JColorChooser jcc = new JColorChooser();
this.setSize(400, 300);
this.getContentPane().add(jcc);
this.setVisible(true);
this.validate();
}
}
public void actionPerformed (ActionEvent ae) {
showDialog sd = new showDialog(this, "Scegli il colore", true);
}
public jColorChooserDemo() {
super("Mostra colori");
this.setSize(600, 400);
this.getContentPane().setLayout(new BorderLayout());
JButton open = new JButton("Apri finestra colori");
this.getContentPane().add(open, BorderLayout.NORTH);
open.addActionListener(this);
this.getContentPane().add(new JScrollPane(new JTextArea("Del Testo\nDel Testo\nDel Testo\nDel Testo\n")), BorderLayout.CENTER);
this.getContentPane().add(new JLabel("Programma inutile"), BorderLayout.SOUTH);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public static void main (String[] args) {
jColorChooserDemo ccd = new jColorChooserDemo();
}
}
EDIT: funziona anche senza il validate