Results 1 to 5 of 5
- 12-16-2008, 11:57 PM #1
Member
- Join Date
- Sep 2008
- Location
- Ankara-TURKEY
- Posts
- 42
- Rep Power
- 0
[SOLVED] how to put string to JLabel with coordinate
Hi everybody,
I have a question about Jlabel and Jpanel . How can I put string to JLabel and Jpanel( I dont know which one is useful ) with coordinate which I will decide. Thanks in advance.
Kind regards,
Salih Ozan IRBIK.Last edited by tOpach; 12-17-2008 at 12:30 AM.
A stitch in time saves nine:D
- 12-17-2008, 04:48 PM #2
Member
- Join Date
- Sep 2008
- Location
- Ankara-TURKEY
- Posts
- 42
- Rep Power
- 0
I really need that thing. I can add JTextField like;
JTextField f1= new JTextField();
f1.setBounds(30,70,100,30);
add(f1);
And I would like to add text "User Name" above JTextField, again by using setBound. Is ıt possible.If it is could you give an sample example?A stitch in time saves nine:D
- 12-17-2008, 05:40 PM #3
ya. Thats Swing correct? I'm assuming it works the same as SWT in which
I have 3 columns in my view so setting the horizontal span to 2 makes the input field 2 fields long.Java Code:new Label(banner, SWT.NONE).setText("Name:"); buildNameText = new Text(banner, SWT.BORDER); GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; buildNameText.setLayoutData(gridData); buildNameText.setText("");
|Name|_input|field _|
If you want something like this
|Name| blank | blank |
|input field goes here|
you just need to do change my first line of code to
Java Code:Label name = new Label(banner, SWT.NONE); name.setText("Name:"); GridData nameData = new GridData(); nameData.horizontalSpan = //what your max columns is set to
- 12-17-2008, 05:41 PM #4
eh dont forget name.setLayoutData(nameData);
- 12-17-2008, 05:57 PM #5
Member
- Join Date
- Sep 2008
- Location
- Ankara-TURKEY
- Posts
- 42
- Rep Power
- 0
Similar Threads
-
How to write multiline String in a JLabel
By JavaBean in forum AWT / SwingReplies: 4Last Post: 12-14-2009, 05:09 AM -
How to show pixel Coordinate and RGB value when mouse is tracking over an image
By Mazharul in forum Java 2DReplies: 1Last Post: 08-25-2008, 08:48 PM -
set coordinate to an image
By nuur in forum AWT / SwingReplies: 2Last Post: 04-01-2008, 08:08 AM -
X&Y Coordinate Drawing on jPanel
By BHCluster in forum Java 2DReplies: 2Last Post: 03-27-2008, 10:47 AM -
Finding the exact length of a string in a JLabel (in pixels)
By Clarkey in forum Advanced JavaReplies: 2Last Post: 03-25-2008, 05:49 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks