Benutzer-Werkzeuge

Webseiten-Werkzeuge


en:gui-usage

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
en:gui-usage [2015/01/01 21:56] – [Turtle] roehneren:gui-usage [2022/09/02 10:20] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 7: Zeile 7:
  
 With the method setLocation(int x, int y) of a JLabel-component you can animate an image. With the method setLocation(int x, int y) of a JLabel-component you can animate an image.
 +<html><img src="http://vg08.met.vgwort.de/na/0bcd12449ac147d08ba0529b6daeced2" width="1" height="1" alt=""></html>
 \\ \\
 \\ \\
Zeile 73: Zeile 74:
 ---- ----
  
-==== JRadioButton & JButtonGroup ====+==== ButtonGroup ====
 {{:en:radiobuttonen.png}} {{:en:radiobuttonen.png}}
-JRadiobuttons offer different options, from which you can choose just one. +A Buttongroup groups Radiobuttons or CheckboxesSet the attribute Checkboxes to true if you want a group of CheckboxesEnter your options using the Items attribute. 
-To group the JRadioButtons you have to place an invisible ButtonGroup component {{:en:buttongroup.png}} on the form. +
-Write the name of this ButtonGroup for each JRadioButton as value of the attribute //ButtonGroup// in the object inspector.+
  
-The Java-Editor places this method into the java source code:+For a buttongroup of radiobuttons the Java-Editor places this method into the java source code:
  
-<code java>  public String buttonGroup1_getSelectedRadioButtonLabel() { ... }</code>+<code java>  public String buttonGroup1_getSelectedButtonGroupLabel() { ... }</code>
  
-so it's easy to get the selected JRadioButton of a ButtonGroup. Example:+so it's easy to get the selected JRadioButton of a Buttongroup. Example:
  
-<code java>  if (bgColor_getSelectedRadioButtonLabel().equals("green"))</code>+<code java>  if (bgColor_getSelectedButtonGroupLabel().equals("green"))</code>
 \\ \\
 ---- ----
Zeile 213: Zeile 212:
 If you minimize your Java-Application with a Canvas-component und show it up again, the content of the Canvas-Component is lost. To avoid this, you have to create a subclass from Canvas and do the drawing in the //paint(Graphics g)// method. Such a derived class can be placed in a GUI-form with right-click on the Canvas-Symbol. If you minimize your Java-Application with a Canvas-component und show it up again, the content of the Canvas-Component is lost. To avoid this, you have to create a subclass from Canvas and do the drawing in the //paint(Graphics g)// method. Such a derived class can be placed in a GUI-form with right-click on the Canvas-Symbol.
  
- 
-The turtle which belongs to the Java-Editor is an example of a Canvas-subclass.\\ 
 ---- ----
  
 ==== Turtle ==== ==== Turtle ====
 +{{:de:fxturtle.png}}
 +
 +Since Java-Editor version 14.04 we have an animated Turtle-component for JavaFX.
 +It's conception is based on the former Turtle-component and supports a cartesian coordinate system.
 +
 +{{:de:playgroundturtle.png}}
 +
 +Since Java-Editor version 13.00 the Turtle-component has changed. We now have an animated Turtle-Component based on the Turtle from [[http://www.aplu.ch/home/apluhomex.jsp|Ägidius Plüss]]. The Playground- and a Turtle-component are on the new Utilities-tab. You can place one or more Turtles on a Playground.
 +
 +Due to didactic reduction and technical issues the GUI doesn't react when a Turtle is drawing. 
 +
 {{:de:turtle.png}} {{:de:turtle.png}}
  
-The Turtle-component provides a drawing-area, on which you can draw with turtle-commands. You find them in the documentation of the Turtle-class.+Before Version 13.00 we had another Turtle-component. If you want to use a program with this older Turtle you have to import it like this: <code>import je.util.*;</code>
  
 As a didactic reduction the turtle has a //setOrigin(double x, double y)-method//, with which you can define a coordinatesystem as known from mathematics. As a didactic reduction the turtle has a //setOrigin(double x, double y)-method//, with which you can define a coordinatesystem as known from mathematics.
Zeile 227: Zeile 235:
 {{:de:turtlesetorigin.png}} {{:de:turtlesetorigin.png}}
  
-The Turtle and it's documentation must be installed inside des Java-Editor configuration.+Since V13.00 the //setOrigin-method// is a method of the playground.
  
 \\ \\
Zeile 233: Zeile 241:
  
 ==== JMenuBar ==== ==== JMenuBar ====
-{{:de:menubar.png}}+{{:de:menubardemo.png}}
  
 With a JMenuBar-component you can create a menu bar. The configuration is done via the menus (JMenu-components)  With a JMenuBar-component you can create a menu bar. The configuration is done via the menus (JMenu-components) 
Zeile 239: Zeile 247:
 \\ \\
 ---- ----
-==== JTable ==== 
-{{:en:jtableicon.png}} With a jTable-component you display a table. 
  
-Set the number of columns and rows with the attributes //ColCount// and //RowCount// in the object-inspector. Use the attribute //Columns// to set the column-names.  Set //AutoCreateRowSorter// to true to enable sorting after column-names.+==== JMenu ==== 
 +{{:de:jmenudemo.png}}
  
-With the method //setValueAt(Object aValue, int row, int column)// you set a value at the position (rowcolumnand with //getValueAt(int row, int column)// you read it. getSelectedRow() gets the index of the first selected row.+With a JMenu-component you create a menu for a menu bar. In the object-inspector you specify the desired menu bar at the //MenuBar// attribute, the menu commands (e. g. New, Open, Save, PrintExitat the //MenuItems// attribute and the caption of the menu (e. g. Filein the menu bar at the //Text// attribute.
  
-Example: "Anna" ist written in the first column of the selected row.+For each menu command the Java-Editor creates a corresponding event method.
  
-<code java> +\\ 
-  int i = jTabelle.getSelectedRow();   +----
-  jTabelle.setValueAt("Anna", i, 0); +
-</code>  +
  
 +==== JPopupMenu ====
 +{{:de:jpopupmenudemo.png}}  
  
 +With a JPopupMenu-component you create a popup menu. In the example a canvas component with yellow background reacts on a rightclick and shows the popup menu.
 +
 +{{:en:jpopupmenudemo2.png}}
 +
 +In the object inspector you input at the attribute //Listener// the gui-component, which shows the popup menu when rightcklicked. By the default //this// the background of the application window recacts on a rightclick. At the attribute //MenuItems// you input the menu commands (e. g. Clear, Draw, Print). Usually the attribute //Text// as label of a popup menu isn't shown.
 +
 +For each menu command the Java-Editor creates a corresponding event method.
 +
 +\\
 +----
 ==== Timer ==== ==== Timer ====
 {{:de:timer.png}} {{:de:timer.png}}
Zeile 263: Zeile 280:
 Example: Example:
  
-<code java> timer1.start();</code>+<code java>  timer1.start(); 
 +  ... do anything 
 +  timer1.stop(); 
 +</code> 
 +\\ 
 +---- 
 + 
 +==== JTable ==== 
 +{{:en:jtableicon.png}} With a jTable-component you display a table. 
 + 
 +Set the number of columns and rows with the attributes //ColCount// and //RowCount// in the object-inspector. Use the attribute //Columns// to set the column-names.  Set //AutoCreateRowSorter// to true to enable sorting after column-names. 
 + 
 +With the method //setValueAt(Object aValue, int row, int column)// you set a value at the position (row, column) and with //getValueAt(int row, int column)// you read it. getSelectedRow() gets the index of the first selected row. 
 + 
 +Example: "Anna" ist written in the first column of the selected row. 
 + 
 +<code java> 
 +  int i = jTabelle.getSelectedRow();   
 +  jTabelle.setValueAt("Anna", i, 0); 
 +</code>   
 +\\ 
 +---- 
  
en/gui-usage.1420145760.txt.gz · Zuletzt geändert: 2015/01/01 22:56 (Externe Bearbeitung)