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

Livio Metton livio.metton a insiel.it
Mer 14 Ott 2009 09:07:35 BST


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);
>          }
>       });
>       
>    }
> 
> }





Maggiori informazioni sulla lista ubuntu-it