/ Forside / Teknologi / Udvikling / Java / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Java
#NavnPoint
molokyle 3688
Klaudi 855
strarup 740
Forvirret 660
gøgeungen 500
Teil 373
Stouenberg 360
vnc 360
pmbruun 341
10  mccracken 320
JComponent Orientation
Fra : Chris


Dato : 28-05-03 17:36

Hello...

I've looked, and I've experimented, and I can't figure out how to do
what I want to do.

I have a JComponent, a JTextField to be specific, within a JPanel.
The JTextField centers itself, but I want to specifically set it's
orientation to the left of the JPanel.

Help!!!!

 
 
Peter Lind (28-05-2003)
Kommentar
Fra : Peter Lind


Dato : 28-05-03 20:44


"Chris" <chris@supernetpower.com> wrote in message
news:63f995ad.0305280836.11475e03@posting.google.com...
> Hello...
>
> I've looked, and I've experimented, and I can't figure out how to do
> what I want to do.
>
> I have a JComponent, a JTextField to be specific, within a JPanel.
> The JTextField centers itself, but I want to specifically set it's
> orientation to the left of the JPanel.
>
> Help!!!!

Check your LayoutManager !

A JPanel uses FlowLayout by default, and places all components in a row -
centering the entire row. Set the LayoutManager if you want a different
layout, i.e:

JPanel p = new JPanel(new BorderLayout());
JTextField field = new JTextField();
p.add(field, BorderLayout.WEST);

places the textfield in left side of the JPanel.

see http://java.sun.com/docs/books/tutorial/uiswing/components/panel.html
for more information.

mvh
Peter Lind



Søg
Reklame
Statistik
Spørgsmål : 177558
Tips : 31968
Nyheder : 719565
Indlæg : 6408924
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste