[ubuntu-it] Problemi su ubuntu jaunty 9.04 con java.awt

alessio rainieri alessiorainieri a gmail.com
Mer 14 Ott 2009 09:10:35 BST


Ma con il click sui pulsanti lo sfondo cambia colore?

Alessio

2009/10/14 Livio Metton <livio.metton a insiel.it>

> Ho copiato il codice, compilato ed eseguito. Tutto O.K.
>
> Ubuntu Jaunty 64 bit
>
> Linux  2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009
> x86_64 GNU/Linux
>
> java version "1.6.0_16"
> Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
> Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
>
> Livio
>
>
> Il giorno mer, 14/10/2009 alle 09.21 +0200, alessio rainieri ha scritto:
>  > Questo semplice programma non mi funziona ( ho provato su due PC con
> > ubuntu jaunty 9.04 ), su Windows invece si.
> >
> > import java.awt.*;
> > import java.awt.event.*;
> > import javax.swing.*;
> > import java.awt.peer.*;
> >
> > public class ButtonTest {
> >
> >    public static void main (String[] args){
> >
> >       ButtonFrame frame = new ButtonFrame();
> >       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> >       frame.setVisible(true);
> >    }
> >
> > }
> >
> > class ButtonFrame extends JFrame {
> >
> >    /**
> >     *
> >     */
> >    private static final long serialVersionUID = 1L;
> >    public ButtonFrame(){
> >
> >       setTitle("Button Test");
> >       setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
> >
> >       Container contentPane = getContentPane();
> >       ButtonPanel panel = new ButtonPanel();
> >       contentPane.add(panel);
> >    }
> >
> >    public static final int DEFAULT_WIDTH=300;
> >    public static final int DEFAULT_HEIGHT=200;
> > }
> >
> > class ButtonPanel extends JPanel
> >   {
> >
> >    /**
> >     *
> >     */
> >    private static final long serialVersionUID = 1L;
> >    JButton yellowButton = new JButton("Yellowq");
> >    JButton redButton = new JButton("Red");
> >    JButton greenButton = new JButton("Green");
> >
> >    public ButtonPanel() {
> >
> >       add(yellowButton);
> >       add(redButton);
> >       add(greenButton);
> >
> >       yellowButton.addActionListener(new ActionListener(){
> >          public void actionPerformed(ActionEvent event){
> >             setBackground(Color.YELLOW);
> >          }
> >       });
> >
> >       redButton.addActionListener(new ActionListener(){
> >          public void actionPerformed(ActionEvent event){
> >             setBackground(Color.RED);
> >          }
> >       });
> >
> >       greenButton.addActionListener(new ActionListener(){
> >          public void actionPerformed(ActionEvent event){
> >             setBackground(Color.GREEN);
> >          }
> >       });
> >
> >    }
> >
> > }
>
>
>
> --
> ubuntu-it mailing list
> ubuntu-it a lists.ubuntu.com
> Opzioni d'iscrizione - https://lists.ubuntu.com/mailman/listinfo/ubuntu-it
> http://wiki.ubuntu-it.org/Listiquette
>
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: https://lists.ubuntu.com/archives/ubuntu-it/attachments/20091014/c43e3314/attachment-0001.htm 


Maggiori informazioni sulla lista ubuntu-it