en:gui-usage
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungNächste ÜberarbeitungBeide Seiten der Revision | ||
en:gui-usage [2015/01/01 17:24] – roehner | en:gui-usage [2015/01/02 12:43] – roehner | ||
---|---|---|---|
Zeile 186: | Zeile 186: | ||
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 ==== | ||
+ | {{: | ||
+ | |||
+ | 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. | ||
\\ | \\ | ||
---- | ---- | ||
- | ==== JTable | + | ==== Canvas |
- | {{:en:jtableicon.png}} | + | {{:de:canvas.png}} |
- | Set the number of columns and rows with the attributes // | + | A Canvas-component provides a drawing-area. |
- | With the method // | + | To draw on the drawing-area |
- | Example: " | + | You get the graphics-context from your Canvas-component in this way: |
- | <code java> | + | <code java> |
- | int i = jTabelle.getSelectedRow(); | + | |
- | | + | With the graphics-context you are able to draw e. g. a rectangle: |
- | </ | + | |
+ | <code java> | ||
+ | |||
+ | 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 // | ||
+ | |||
+ | |||
+ | The turtle which belongs to the Java-Editor is an example of a Canvas-subclass.\\ | ||
+ | ---- | ||
+ | |||
+ | ==== Turtle ==== | ||
+ | {{: | ||
+ | |||
+ | The Turtle-component provides a drawing-area, | ||
+ | |||
+ | As a didactic reduction the turtle has a // | ||
+ | |||
+ | Example: | ||
+ | {{: | ||
+ | |||
+ | The Turtle and it's documentation must be installed inside des Java-Editor configuration. | ||
+ | |||
+ | \\ | ||
+ | ---- | ||
+ | |||
+ | ==== JMenuBar ==== | ||
+ | {{: | ||
+ | |||
+ | 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 ==== | ||
+ | {{: | ||
+ | |||
+ | 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 // | ||
+ | |||
+ | For each menu command the Java-Editor creates a corresponding event method. | ||
+ | |||
+ | \\ | ||
+ | ---- | ||
+ | |||
+ | ==== JPopupMenu ==== | ||
+ | {{: | ||
+ | |||
+ | 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. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | In the object inspector you input at the attribute // | ||
+ | For each menu command the Java-Editor creates a corresponding event method. | ||
+ | \\ | ||
+ | ---- | ||
==== Timer ==== | ==== Timer ==== | ||
{{: | {{: | ||
Zeile 214: | Zeile 273: | ||
<code java> timer1.start();</ | <code java> timer1.start();</ | ||
+ | \\ | ||
+ | ---- | ||
+ | |||
+ | ==== JTable ==== | ||
+ | {{: | ||
+ | |||
+ | Set the number of columns and rows with the attributes // | ||
+ | |||
+ | With the method // | ||
+ | |||
+ | Example: " | ||
+ | |||
+ | <code java> | ||
+ | int i = jTabelle.getSelectedRow(); | ||
+ | jTabelle.setValueAt(" | ||
+ | </ | ||
+ | \\ | ||
+ | ---- | ||
+ | |||
en/gui-usage.txt · Zuletzt geändert: 2022/09/02 10:20 von 127.0.0.1