简体   繁体   中英

Vertical oriented, right-to-left JList for Chinese text

Is this possible?

I wish I could show you my code, but I don't know where to start. I haven't found a single example on google.

If it is possible, could someone please reference me to a sample?

LstGlossary.setModel(
new javax.swing.AbstractListModel() { String[] strings = { "你好", "哈囉" }; 
public int getSize() { return strings.length; } 
public Object getElementAt(int i) { return strings[i]; } 
}); 
LstGlossary.setComponentOrientation(ComponentOrientation.RIG‌​HT_TO_LEFT);

Here's what these two strings look like with vertical text orientation going right to left in Microsoft Word:

垂直,从右到左中文文本

Use the setComponentOrientation method:

jlist.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

From the Javadoc:

Sets the language-sensitive orientation that is to be used to order the elements or text within this component. Language-sensitive LayoutManager and Component subclasses will use this property to determine how to lay out and draw components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM