Forums Register Login

Double text alignment

+Pie Number of slices to send: Send
Hi. I am new here. I am developing free POS...
Is it possible to double align text, eg. 1 item on the left and price on the right?
I already figure it out I can use <html> tags to get double lines in jlist element.

[IMG=http://img600.imageshack.us/img600/8288/unled1cd.gif][/img]

Uploaded with ImageShack.us

Sorry for my bad english....
Johhny.
1
+Pie Number of slices to send: Send
Maybe you should use monospaced font, count max. size of letters and than substact or stg...
I don`t have better answer, sorry...
1
+Pie Number of slices to send: Send
I haven't followed that link. But if your question is about how to get the data in a JList to align itself into columns, well, that's what a JTable is for.
1
+Pie Number of slices to send: Send
And welcome to the Ranch
+Pie Number of slices to send: Send
Thanks! Jtable is great! Only problem is visual one. How can I make row selection without that border in the middle?

+Pie Number of slices to send: Send
I think this discussion would sit better on our GUIs forum. Moving.
+Pie Number of slices to send: Send
You can use either a JList or a JTable with a custom renderer. Read about renderers here.

For a list, the renderer could be a JPanel with two JLabels with appropriate horizontal alignment. Or you could use a BoxLayout and add a horizontal glue between the two labels.

For a table, you could extend DefaultTableCellRenderer and invoke the super implementation of getTableCellRendererComponent with the hasFocus parameter false.
+Pie Number of slices to send: Send
I am using JTable as recommended. Superimplementation removes focus (blue line), but joint edges between two horizontal cells in the middle is still there...
+Pie Number of slices to send: Send
Read the API for methods that set whether the gridlines are painted shown.
+Pie Number of slices to send: Send
The only problem is that that method also removes the horizontal lines, not just the vertical lines.

Edit: scratch that. I was only aware of the method to show all or nothing. Apparently there are also methods to show only vertical or only horizontal.
+Pie Number of slices to send: Send


or



It removes them but if 1 cell is selected, entire row gets selected. And vertical lines between cells are still visible
+Pie Number of slices to send: Send
Finally



Forget Steve. Look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1760 times.
Similar Threads
Netbeans problem in Mac OS X
Custom Button
Anyone know how to get out of Debug mode in Eclipse?
class diagram for Election
JSlider
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:09:11.