File "test.java"

Full Path: /home/analogde/www/Ebook/Informatique/JAVA/NetBeansProjects/JavaApplication2/src/test.java
File size: 2.01 KB
MIME-type: text/x-c++
Charset: utf-8

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Patrice
 */
//import javax.swing.JFrame;
//import javax.swing.JButton;
//import javax.swing.JLabel;

import javax.swing.*;
import java.awt.event.*;
 
// contentPane   getContentPane()  JFrame
// JPanel


public class test {
  public static void main(String[] args){

      
        essai pipo = new essai():
   /* JFrame fenetre = new JFrame();
    fenetre.setLayout(null);
    JLabel label = new JLabel("coucou");
    label.setBounds(100, 10, 80, 30);
    
    JPanel panel = new JPanel();
    
    JButton bouton = new JButton("bouton");
    
    bouton.setBounds(10, 10, 80, 30);
    
    panel.add(label);
    
    fenetre.getContentPane().add(panel);
    fenetre.getContentPane().add(bouton);
    
   fenetre.getContentPane().add(label);
   
    //JButton bouton = new JButton("Mon premier bouton");
    //fenetre.getContentPane().add(bouton);
    
    //Définit un titre pour notre fenêtre
    fenetre.setTitle("Ma première fenêtre Java");
    //Définit sa taille : 400 pixels de large et 100 pixels de haut
    fenetre.setSize(400, 100);
    //Nous demandons maintenant à notre objet de se positionner au centre
    fenetre.setLocationRelativeTo(null);
    //Termine le processus lorsqu'on clique sur la croix rouge
    fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Et enfin, la rendre visible        
    fenetre.setVisible(true);
        
    
    Point a = new Point ('C', 2.5) ;
    a.affiche() ;
    Point b = new Point ('D', 5.25) ;
    b.affiche() ;
    b.translate(2.25) ;
    b.affiche() ;*/
  }       
}

class Point
{ public Point (char c, double x) // constructeur
{ nom = c ;
abs = x ;
}
public void affiche ()
{ System.out.println ("Point de nom " + nom + " d'abscisse " + abs) ;
}
public void translate (double dx)
{ abs += dx ;
}
private char nom ; // nom du point
private double abs ; // abscisse du point
}