Tem sim. Para isso voce pode usar o metodo setBounds(int x, int y, int l,
int w). Para que este método funcione voce deve setar o layout para null e
posicionar cada componente do layout "na mão" utilizando o setBounds.

E setando o layout para null, cada vez que você redimensionar a tela os
componentes NÃO irão ajustar sua posição automaticamente.

Abraços

--
Leonardo Borba

Contato <http://www.meadiciona.com/leonardoborba>




Em 2 de julho de 2011 20:27, Matheus Henrique Klem Galvez <
[email protected]> escreveu:

> Alguns ambientes gráficos tem uma forma de layoult que é ponto a
> ponto, ou seja, você pode indicar onde na tela cada componente vai
> ficar. Isso é muito util quando vc quer fazer algo simples mas nao
> quer ficar procurando (ou dependendo de) algum layoult manager que
> faça isso por você. O Swing tem essa opção?
>
> 2011/7/2, Miguel Jonathan <[email protected]>:
> > Matheus, experimente:
> >
> > import java.awt.GridBagConstraints;
> > import java.awt.GridBagLayout;
> >
> > import javax.swing.*;
> >
> > public class JanelaCentrada {
> >
> >     public static void main(String args[]) {
> >         JFrame frame = new JFrame();
> >         JButton bot = new JButton("Estou Centrado!");
> >
> >     //O GridBagLayout é muito complicado, mas o default dele é centrar...
> >         GridBagConstraints constr = new GridBagConstraints();
> >         frame.getContentPane().setLayout(new GridBagLayout());
> >         frame.getContentPane().add(bot, constr);
> >
> >         frame.setBounds(100,100,300,300);
> >         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> >         frame.setVisible(true);
> >     }
> > }
> >
> > Tem muita solução disponível na web. Essa aí eu me inspirei colocando as
> > palavras chave seguintes no Google: "how to center a component" swing
> >
> > abraços,
> > Jonathan
> >
> > 2011/7/1 Matheus Henrique Klem Galvez <[email protected]>
> >
> >> Qual o melhor layoult para centralizar um objeto exatamente no centro
> >> do container (tanto vertical como horizontalmente). Não estou
> >> conseguindo este efeito com os layoults padrão.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Comp 2 - Geral" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >> http://groups.google.com/group/comp2-geral?hl=en.
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Comp 2 - Geral" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> > http://groups.google.com/group/comp2-geral?hl=en.
> >
> >
>
>
> --
> ___________________________________
> *"Se, a princípio, a ideia não é absurda, então não há esperança para ela."
> Albert Einstein :D *
> ___________________________________
>
> --
> You received this message because you are subscribed to the Google Groups
> "Comp 2 - Geral" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/comp2-geral?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Comp 
2 - Geral" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/comp2-geral?hl=en.

Responder a