1.3 Swing Layouts Flashcards

1
Q

Ce este Layout-ul ?

A

Layout-ul reprezinta modul in care vor fii aranjate controalele in cadrul containerului

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Care sunt Layout-urile din Swing ?

A

GroupLayout
BoxLayout
SpringLayout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Care este Layout-ul implicit din NetBeans Designer ?

A

GroupLayout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Cum sunt adaugate componentele intr-un container care foloseste BoxLayout?

A

Sunt adaugate una dupa alta, pe axa X sau pe axa Y in functie de setare.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Creati un exemplu in care folosind BoxLayout, adaugati 8 butoane pe axa Y.

A
void initComponents() {
        this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
        this.setSize(400, 400);
        this.setVisible(true);
    }
    public void addButtons() {
        for (int i = 0; i < 8; i++) {
            this.getContentPane().add(new JButton("Button " + i));
        }
    }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Folosind layout-ul corespunzator, pozitionati un buton pe coordonatele 200 WEST, 150 NORTH

A
SpringLayout layout = new SpringLayout();
        this.setLayout(layout);
    layout. putConstraint(SpringLayout.WEST, button, 200, SpringLayout.WEST, this);
    layout. putConstraint(SpringLayout.NORTH, button, 200, SpringLayout.NORTH, this);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly