2.5 JComponent Flashcards

1
Q

Daca vrem sa cream propria noastra componenta ( control ), ce clasa se va mosteni ?

A

JComponent

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

Care este metoda cu ajutorul careia se pot crea componentele ?

A

@Override
public void paintComponent(Grapchics g){

}

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

De ce atunci cand rulam aplicatia si desenam componenta apare doar un singur punct?

A

Deoarece trebuie setata dimensiunea componentei.

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

Creati o componenta in care sa desenati “Hello from my component”

A

public class MyComponent extends JComponent {

@Override
public void paintComponent(Graphics g) {

    g.drawString("Hello from my component", 10, 15);
}

}

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

Ce forme se pot desena cu ajutorul clasei Graphics ?

A

Clasa Graphics contine metode pentru a putea desena orice forma geometrica.

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

Cum se poate crea si prelua un text tool tip pe componenta ?

A

mc. setToolTipText(“text”);

mc. getToolTipText();

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

Ce clasa contine diferite metode pentru crearea diferitelor tipuri de bordere ?

A

BorderFactory

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

Borderul se poate seta si folosind Designerul ?

A

da, folosind Border customizer

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

Ce se intampla cand un control pierde focusul?

A

primeste propiertatea blur

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

Cum se poate seta daca un control poate avea focus sau nu ?

A

setFocusable(true/false);

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

Cum se poate verifica daca un control poate avea focus ?

A

btn.isFocusable();

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

Cum se poate verifica daca un anumit control detine focusul in momentul actual ?

A

btn.isFocusOwner();

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

Cum se poate seta ca un anumit control sa aiba focus ?

A

btn.requestFocusInWindow();

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

Folosind ce clasa putem schimba ordinea focusarii controalelor folosind tasta tab ?
Cum se numeste clasa care defineste regulile ?

A

FocusTraversal iar clasa care defineste regulile se numeste FocusTraversalPolicy

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

Cum se poate crea un focus listener pe o componenta ?

A

btn.addFocusListener(new FocusListener(){}

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