<div>Ma con il click sui pulsanti lo sfondo cambia colore?</div>
<div> </div>
<div>Alessio<br><br></div>
<div class="gmail_quote">2009/10/14 Livio Metton <span dir="ltr">&lt;<a href="mailto:livio.metton@insiel.it">livio.metton@insiel.it</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Ho copiato il codice, compilato ed eseguito. Tutto O.K.<br><br>Ubuntu Jaunty 64 bit<br><br>Linux  2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009<br>
x86_64 GNU/Linux<br><br>java version &quot;1.6.0_16&quot;<br>Java(TM) SE Runtime Environment (build 1.6.0_16-b01)<br>Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)<br><br>Livio<br><br><br>Il giorno mer, 14/10/2009 alle 09.21 +0200, alessio rainieri ha scritto:<br>

<div>
<div></div>
<div class="h5">&gt; Questo semplice programma non mi funziona ( ho provato su due PC con<br>&gt; ubuntu jaunty 9.04 ), su Windows invece si.<br>&gt;<br>&gt; import java.awt.*;<br>&gt; import java.awt.event.*;<br>&gt; import javax.swing.*;<br>
&gt; import java.awt.peer.*;<br>&gt;<br>&gt; public class ButtonTest {<br>&gt;<br>&gt;    public static void main (String[] args){<br>&gt;<br>&gt;       ButtonFrame frame = new ButtonFrame();<br>&gt;       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br>
&gt;       frame.setVisible(true);<br>&gt;    }<br>&gt;<br>&gt; }<br>&gt;<br>&gt; class ButtonFrame extends JFrame {<br>&gt;<br>&gt;    /**<br>&gt;     *<br>&gt;     */<br>&gt;    private static final long serialVersionUID = 1L;<br>
&gt;    public ButtonFrame(){<br>&gt;<br>&gt;       setTitle(&quot;Button Test&quot;);<br>&gt;       setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);<br>&gt;<br>&gt;       Container contentPane = getContentPane();<br>&gt;       ButtonPanel panel = new ButtonPanel();<br>
&gt;       contentPane.add(panel);<br>&gt;    }<br>&gt;<br>&gt;    public static final int DEFAULT_WIDTH=300;<br>&gt;    public static final int DEFAULT_HEIGHT=200;<br>&gt; }<br>&gt;<br>&gt; class ButtonPanel extends JPanel<br>
&gt;   {<br>&gt;<br>&gt;    /**<br>&gt;     *<br>&gt;     */<br>&gt;    private static final long serialVersionUID = 1L;<br>&gt;    JButton yellowButton = new JButton(&quot;Yellowq&quot;);<br>&gt;    JButton redButton = new JButton(&quot;Red&quot;);<br>
&gt;    JButton greenButton = new JButton(&quot;Green&quot;);<br>&gt;<br>&gt;    public ButtonPanel() {<br>&gt;<br>&gt;       add(yellowButton);<br>&gt;       add(redButton);<br>&gt;       add(greenButton);<br>&gt;<br>&gt;       yellowButton.addActionListener(new ActionListener(){<br>
&gt;          public void actionPerformed(ActionEvent event){<br>&gt;             setBackground(Color.YELLOW);<br>&gt;          }<br>&gt;       });<br>&gt;<br>&gt;       redButton.addActionListener(new ActionListener(){<br>
&gt;          public void actionPerformed(ActionEvent event){<br>&gt;             setBackground(Color.RED);<br>&gt;          }<br>&gt;       });<br>&gt;<br>&gt;       greenButton.addActionListener(new ActionListener(){<br>
&gt;          public void actionPerformed(ActionEvent event){<br>&gt;             setBackground(Color.GREEN);<br>&gt;          }<br>&gt;       });<br>&gt;<br>&gt;    }<br>&gt;<br>&gt; }<br><br><br><br></div></div><font color="#888888">--<br>
ubuntu-it mailing list<br><a href="mailto:ubuntu-it@lists.ubuntu.com">ubuntu-it@lists.ubuntu.com</a><br>Opzioni d&#39;iscrizione - <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-it" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-it</a><br>
<a href="http://wiki.ubuntu-it.org/Listiquette" target="_blank">http://wiki.ubuntu-it.org/Listiquette</a><br></font></blockquote></div><br>