GFrame and GPanel : Différence entre versions

De Wiki
Aller à : navigation, rechercher
Ligne 3 : Ligne 3 :
 
https://logiciels-pp.cst.cnes.fr/sites/default/files/javadoc/1491391747/documentation/lowLevel/GFrame.html
 
https://logiciels-pp.cst.cnes.fr/sites/default/files/javadoc/1491391747/documentation/lowLevel/GFrame.html
  
 +
* [http://tu-dctsb-p02.cst.cnes.fr/javadoc/fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html GFrame]
 
* [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html|GFrame]]
 
* [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html|GFrame]]
 
* [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GPanel.html|GPanel]]
 
* [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GPanel.html|GPanel]]

Version du 2 mai 2017 à 10:23

GENIUS proposes most of the same principles as those used by swing with classes as:

https://logiciels-pp.cst.cnes.fr/sites/default/files/javadoc/1491391747/documentation/lowLevel/GFrame.html

  • GFrame
  • [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html|GFrame]]
  • [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GPanel.html|GPanel]]
  • [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GButton.html|GButton]]

GFrame

About [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html|GFrame]], nothing particular, except the display() method which allows the display more easily.

  1. GFrame frame = new GFrame("Test", pan); // see below for the pan object ...
  2. frame.display();

GPanel

[[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GPanel.html|GPanel]] object is a bit more « complex » because, when created, it is necessary to implement both following methods:

  • display()
  • generic()

display() method will indicate which graphical objects will be concerned for **displaying**. By these means, it is up to GENIUS to __automatically manage refresh__ (no need to call to a « refresh » method); To decide what will be displayed, we only need to call in this method, the put() method with the object as argument : put(objectName)

generic() method allows to indicate which graphical objects will be concerned for **displaying** … but also for **reading** or **writing** into files (we will see it later …). Another solution is then to store calls to the put() method into generic() and, inside display() method, only calling the generic() method.

Examples below show both solutions for dsiplaying a [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GButton.html|GButton]] object.


// Example using display method public class MyPanel extends GPanel {

 private GButton but;
 
 public MyPanel () {
   but = new GButton("Button");
 }
 public void display() throws GException {
   put(but);
 }
 public void generic() { }
 
 public static void main(String[] args) {
   MyPanel pan = new MyPanel();
   GFrame frame = new GFrame("Test", pan);	
   frame.display();
 }

};

// Example using generic method public class MyPanel extends GPanel {

 private GButton but;
 
 public MyPanel () {
   but = new GButton("Button");
 }
 public void display() {
   generic();
 }
 public void generic() throws GException {
   put(but);
 }
 
 public static void main(String[] args) {
   MyPanel pan = new MyPanel();
   GFrame frame = new GFrame("Test", pan);	
   frame.display();
 }

};

//Return to the introduction ↑//\\ //Go to the next page →//