Unterschiede
Hier werden die Unterschiede zwischen der gewählten und der aktuellen Version gezeigt.
en:swing:gridbaglayout 2012/09/24 16:41 | en:swing:gridbaglayout 2020/01/22 21:00 aktuell | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | [[awt:awt|AWT]] | + | [[en:swing:swing|Java - AWT/Swing]]\\ |
====== GridBagLayout ====== | ====== GridBagLayout ====== | ||
Again and again you hear that the GridBagLayout is so complicated. It is really very extensive, but as a general rule you only need a few methods. | Again and again you hear that the GridBagLayout is so complicated. It is really very extensive, but as a general rule you only need a few methods. | ||
Zeile 103: | Zeile 103: | ||
- | Natürlich hat das GridBagLayout noch mehr Möglichkeiten. | + | Of course, GridBagLayout has more possibilities as well. |
- | Häufig verwendet werden auch noch die GridBagConstraints-Parameter | + | GridBagConstraints-parameter are also used often, too. |
weightx | weightx | ||
- | und | + | and |
weighty | weighty | ||
. | . | ||
- | Diese können Werte zwischen 0.0 und 1.0 einnehmen und geben an, wie der verbleibende Freiraum aufgeteilt wird. | + | These can take values between 0.0 and 1.0 and indicate how the lingering freedom will be divided up. |
- | Beispiel: Ein Dialog habe eine verfügbare Breite von 600 Pixeln. In diesem Dialog seien zwei Elemente A und B angeordnet. Dabei habe Element A ein minimalen Platzbedarf von 300 Pixeln und Element B einen minimalen Platzbedarf von 100 Pixeln. Damit bleiben 200 Pixel über. Diese werden im Verhältnis der beiden Werte für weightx aufgeteilt. Angenommen Element A habe ein weightx von 0.75 und Element B ein weigtx von 0.25, so wird das Gitterfeld für A eine Breite von 450 Pixeln (300+0.75*200) und Gitterfeld B eine Breite von 150 (100+0.25*200) Pixeln erhalten. | + | Example: A dialogue has an available width of 600 pixel. There are laid out two elements A and B in this dialogue. With it, element A has a minimal place requirement of 300 pixel and element B has a minimal place requirement of 100 pixel. Therefore, there are 200 pixel left. These are divided up for weightx proportional to both values. Assuming that element A has a weightx of 0.75 and element B a weightx of 0.25, the grid field for A will contain a width of 450 pixel (300+0.75*200) and the grid field B will contain a width of 150 (100+0.25*200). |
- | Wird ergänzt... | + | To be continued... |