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
Nächste ÜberarbeitungBeide Seiten der Revision
en:gui-usage [2015/01/01 17:23] – [JScrollBar] roehneren:gui-usage [2015/01/02 12:40] – [JMenu] roehner
Zeile 185: Zeile 185:
 A JScrollPane-component provides a horizontal and a vertical JScrollBar-component for a twodimensional scrolling. A JScrollPane-component provides a horizontal and a vertical JScrollBar-component for a twodimensional scrolling.
  
-The Java-Editor adds to JTextArea, JList, JTable, JTree, JEditorPane und JTextPane-components automatically a JScrollPane-component. +The Java-Editor adds to JTextArea, JList, JTable, JTree, JEditorPane und JTextPane-components automatically a JScrollPane-component. 
 +\\ 
 +---- 
 + 
 +==== JPanel ==== 
 +{{:de:panel.png}} 
 + 
 +JPanel-components are used for structuring of graphical user interfaces. Each JPanel-component is a container which can hold other gui-components. With the object-inspector you can set a border to a JPanel-component. 
 +\\ 
 +---- 
 +  
 +==== Canvas ==== 
 +{{:de:canvas.png}} 
 + 
 +A Canvas-component provides a drawing-area. 
 + 
 +To draw on the drawing-area you can get a graphic-context from the Canvas-component. This graphic-context is used as a paint-box with many drawing-possibilities. 
 + 
 +You get the graphics-context from your Canvas-component in this way: 
 + 
 +<code java>  Graphics g = myCanvas.getGraphics();</code> 
 + 
 +With the graphics-context you are able to draw e. g. a rectangle: 
 + 
 +<code java>  g.fillRect(100, 50, 200, 250);</code> 
 + 
 +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 ==== 
 +{{: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. 
 + 
 +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. 
 + 
 +Example: 
 +{{:de:turtlesetorigin.png}} 
 + 
 +The Turtle and it's documentation must be installed inside des Java-Editor configuration. 
 + 
 +\\ 
 +---- 
 + 
 +==== JMenuBar ==== 
 +{{:de:menubardemo.png}} 
 + 
 +With a JMenuBar-component you can create a menu bar. The configuration is done via the menus (JMenu-components)  
 +to be displayed in the menu bar. 
 +\\ 
 +---- 
 + 
 +==== JMenu ==== 
 +{{:de:jmenudemo.png}} 
 + 
 +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, Print, Exit) at the //MenuItems// attribute and the caption of the menu (e. g. File) in the menu bar at the //Text// attribute. 
 + 
 +For each menu command the Java-Editor creates a corresponding event method. 
 + 
 +\\ 
 +---- 
 + 
 +==== 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. 
 + 
 +\\ 
 +----
 ==== JTable ==== ==== JTable ====
 {{:en:jtableicon.png}} With a jTable-component you display a table. {{:en:jtableicon.png}} With a jTable-component you display a table.
en/gui-usage.txt · Zuletzt geändert: 2022/09/02 10:20 von 127.0.0.1