Hi!
I need a bit of help here. I started a new project and i need to know how to set position of JLabels(strings). Can I just set pixels or use Int x = 300, Int Y = 400??
I realy need help. I will be thankful for all the help.

Re: Setting position of JLabel 80 80

If you need some code I can post it...

Re: Setting position of JLabel 80 80

You can set the layout manager for the container to null, then use setBounds to set the size and position of your label in pixels.
However, if you do it's going to look very silly when someone runs your code on a screen with "retina" resolution, or even just on a system with a bigger system font selected.
You can keep you application looking OK across different systems by using a layout manger to position components according to the current font sizes etc.
See http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html

Re: Setting position of JLabel 80 80

So you can set more layouts in one program and then just call them with different or same JPanel??

Re: Setting position of JLabel 80 80

You set a LayoutManager for each JFrame's content pane or JPanel, it then handles the exact positioning of its contents, based on your specifications. Please see the tutorial I linked in my previous post.

Re: Setting position of JLabel 80 80

OK thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.