« GFrame and GPanel » : différence entre les versions

De GENIUS
Aller à la navigation Aller à la recherche
(Page créée avec « ==== GFrame and GPanel ==== ---- <fc #556B2F>**GENIUS**</fc> proposes most of the same principles as those used by swing with classes as: * javadoc>fr/cnes/genius/c... »)
 
Aucun résumé des modifications
 
(27 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
==== GFrame and GPanel ====
<font color=#556B2F>'''GENIUS'''</font> proposes most of the same principles as those used by <font color=#FF8C00>swing</font> with classes as:


----
* [{{PathCurrentJavaDoc}}/fr/cnes/genius/lowLevel/GFrame.html GFrame]
* [{{PathCurrentJavaDoc}}/fr/cnes/genius/lowLevel/GPanel.html GPanel]
* …
* [{{PathCurrentJavaDoc}}/fr/cnes/genius/lowLevel/GButton.html GButton]


<fc #556B2F>**GENIUS**</fc> proposes most of the same principles as those used by swing with classes as:
== GFrame ==


  * [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html|GFrame]]
About [{{PathCurrentJavaDoc}}/fr/cnes/genius/lowLevel/GFrame.html GFrame], nothing particular, except the <font color=#4169E1>display()</font> method which allows the display more easily.
  * [[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 ===
<syntaxhighlight lang="java">
 
About [[javadoc>fr/cnes/genius/current/fr/cnes/genius/lowLevel/GFrame.html|GFrame]], nothing particular, except the <fc #4169E1>display()</fc> method which allows the display more easily.
 
 
<code java>
GFrame frame = new GFrame("Test", pan); // see below for the pan object ...
GFrame frame = new GFrame("Test", pan); // see below for the pan object ...
frame.display();
frame.display();
</code>
</syntaxhighlight>
 
== GPanel ==


=== GPanel ===
[{{PathCurrentJavaDoc}}/fr/cnes/genius/lowLevel/GPanel.html GPanel] object is a bit more « complex » because, when created, it is necessary to implement both following methods:
* <font color=#4169E1>display()</font>
* <font color=#4169E1>generic()</font>


[[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:
<font color=#4169E1>display()</font> method will indicate which graphical objects will be concerned for '''displaying'''. By these means, it is up to GENIUS to <u>automatically manage refresh</u> (no need to call to a « refresh » method);
  * <fc #4169E1>display()</fc>
To decide what will be displayed, we only need to call in this method, the <font color=#4169E1>put()</font> method with the object as argument :
  * <fc #4169E1>generic()</fc>


<fc #4169E1>display()</fc> 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);
<syntaxhighlight lang="java">
To decide what will be displayed, we only need to call in this method, the <fc #4169E1>put()</fc> method with the object as argument :
put(objectName)
<code java>put(objectName)</code>
</syntaxhighlight>


<fc #4169E1>generic()</fc> 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 …).
<font color=#4169E1>generic()</font> 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 <fc #4169E1>put()</fc> method into <fc #4169E1>generic()</fc> and, inside <fc #4169E1>display()</fc> method, only calling the <fc #4169E1>generic()</fc> method.
Another solution is then to store calls to the <font color=#4169E1>put()</font> method into <font color=#4169E1>generic()</font> and, inside <font color=#4169E1>display()</font> method, only calling the <font color=#4169E1>generic()</font> method.


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




<code java>
<syntaxhighlight lang="java">
// Example using display method
// Example using display method
public class MyPanel extends GPanel {
public class MyPanel extends GPanel {
Ligne 45 : Ligne 43 :
     but = new GButton("Button");
     but = new GButton("Button");
   }
   }
   public void display() throws GException {
   public void display() throws GException {
     put(but);
     put(but);
Ligne 59 : Ligne 56 :


};
};
</code>
</syntaxhighlight>


<code java>
<syntaxhighlight lang="java">
// Example using generic method
// Example using generic method
public class MyPanel extends GPanel {
public class MyPanel extends GPanel {
Ligne 86 : Ligne 83 :


};
};
</code>
</syntaxhighlight>
 


//[[user_manual:introduction|Return to the introduction ↑]]//\\
[[WELCOME_TO_THE_GENIUS_WIKI|Return to the introduction ↑]]  
//[[user_manual:main_widgets|Go to the next page →]]//
[[Main_Widgets|Go to the next page →]]

Dernière version du 15 décembre 2017 à 08:45

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

GFrame

About GFrame, nothing particular, except the display() method which allows the display more easily.

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

GPanel

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 displaying 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 →