Skip to content

Commit 4f44662

Browse files
hansonrhansonr
authored andcommitted
tests for right-alignment
Very odd requirement for CSS right:0 (invalid CSS!)
1 parent 5ad524c commit 4f44662

1 file changed

Lines changed: 111 additions & 97 deletions

File tree

sources/net.sf.j2s.java.core/src/test/JalviewJSTest.java

Lines changed: 111 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import javax.swing.JLabel;
1717
import javax.swing.JMenu;
1818
import javax.swing.JMenuBar;
19+
import javax.swing.JMenuItem;
1920
import javax.swing.JPanel;
2021
import javax.swing.JRadioButton;
2122
import javax.swing.JRadioButtonMenuItem;
@@ -73,116 +74,129 @@ Container getVisualPaneContent(JMenu menu)
7374
*/
7475
Font font = new Font("Verdana", Font.PLAIN, 11);
7576

76-
JLabel l1 = new JLabel(getImage("test2.png"));
77-
l1.setText("trailing right");
78-
l1.setHorizontalTextPosition(SwingConstants.TRAILING);
79-
l1.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
80-
l1.setHorizontalAlignment(SwingConstants.RIGHT);
81-
82-
JLabel l2 = new JLabel(getImage("test2.png"));
83-
l2.setText("leading left");
84-
l2.setFont(font);
85-
l2.setHorizontalTextPosition(SwingConstants.LEADING);
86-
l2.setHorizontalAlignment(SwingConstants.LEFT);
87-
88-
JButton b1 = new JButton("right left");
89-
b1.setIcon(getImage("test2.png"));
90-
b1.setFont(font);
91-
b1.setHorizontalTextPosition(SwingConstants.RIGHT);
92-
b1.setHorizontalAlignment(SwingConstants.LEFT);
93-
94-
firstColumn.add(l1);
95-
firstColumn.add(l2);
96-
firstColumn.add(b1);
77+
// JLabel l1 = new JLabel(getImage("test2.png"));
78+
// l1.setText("trailing right");
79+
// l1.setHorizontalTextPosition(SwingConstants.TRAILING);
80+
// l1.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
81+
// l1.setHorizontalAlignment(SwingConstants.RIGHT);
82+
//
83+
// JLabel l2 = new JLabel(getImage("test2.png"));
84+
// l2.setText("leading left");
85+
// l2.setFont(font);
86+
// l2.setHorizontalTextPosition(SwingConstants.LEADING);
87+
// l2.setHorizontalAlignment(SwingConstants.LEFT);
88+
//
89+
// JButton b1 = new JButton("right left");
90+
// b1.setIcon(getImage("test2.png"));
91+
// b1.setFont(font);
92+
// b1.setHorizontalTextPosition(SwingConstants.RIGHT);
93+
// b1.setHorizontalAlignment(SwingConstants.LEFT);
94+
//
95+
// firstColumn.add(l1);
96+
// firstColumn.add(l2);
97+
// firstColumn.add(b1);
98+
99+
//
100+
// JCheckBox cb3 = new JCheckBox("leading,left-to-right,rt");
101+
// cb3.setFont(font);
102+
// cb3.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
103+
// cb3.setHorizontalTextPosition(SwingConstants.LEADING);
104+
// cb3.setHorizontalAlignment(SwingConstants.TRAILING);
105+
//
106+
// JCheckBox cb4 = new JCheckBox("leading,right-to-left");
107+
// cb4.setFont(font);
108+
// cb4.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
109+
// cb4.setHorizontalTextPosition(SwingConstants.LEADING);
110+
//
111+
// JCheckBox cb5 = new JCheckBox("trailing,left-to-right");
112+
// cb5.setFont(font);
113+
// cb5.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
114+
// cb5.setHorizontalTextPosition(SwingConstants.TRAILING);
115+
//
116+
// JRadioButton rb1 = new JRadioButton("trailing,right-to-left");
117+
// rb1.setFont(font);
118+
// rb1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
119+
// rb1.setHorizontalTextPosition(SwingConstants.TRAILING);
120+
//
121+
// JRadioButton rb2 = new JRadioButton("right,left-to-right");
122+
// rb2.setFont(font);
123+
// rb2.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
124+
// rb2.setHorizontalTextPosition(SwingConstants.RIGHT);
125+
//
126+
// JRadioButton rb3 = new JRadioButton("right,r2l");
127+
// rb3.setFont(font);
128+
// rb3.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
129+
// rb3.setHorizontalTextPosition(SwingConstants.RIGHT);
130+
//
97131

98132

99-
JCheckBox cb3 = new JCheckBox("leading,left-to-right,rt");
100-
cb3.setFont(font);
101-
cb3.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
102-
cb3.setHorizontalTextPosition(SwingConstants.LEADING);
103-
cb3.setHorizontalAlignment(SwingConstants.TRAILING);
104-
105-
JCheckBox cb4 = new JCheckBox("leading,right-to-left");
106-
cb4.setFont(font);
107-
cb4.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
108-
cb4.setHorizontalTextPosition(SwingConstants.LEADING);
109-
110-
JCheckBox cb5 = new JCheckBox("trailing,left-to-right");
111-
cb5.setFont(font);
112-
cb5.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
113-
cb5.setHorizontalTextPosition(SwingConstants.TRAILING);
114-
115-
JRadioButton rb1 = new JRadioButton("trailing,right-to-left");
116-
rb1.setFont(font);
117-
rb1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
118-
rb1.setHorizontalTextPosition(SwingConstants.TRAILING);
119-
120-
JRadioButton rb2 = new JRadioButton("right,left-to-right");
121-
rb2.setFont(font);
122-
rb2.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
123-
rb2.setHorizontalTextPosition(SwingConstants.RIGHT);
124-
125-
JRadioButton rb3 = new JRadioButton("right,right-to-left");
126-
rb3.setFont(font);
127-
rb3.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
128-
rb3.setHorizontalTextPosition(SwingConstants.RIGHT);
129-
130-
131-
132-
firstColumn.add(cb3);
133-
firstColumn.add(cb4);
134-
firstColumn.add(cb5);
135-
firstColumn.add(rb1);
136-
firstColumn.add(rb2);
137-
firstColumn.add(rb3);
133+
// firstColumn.add(cb3);
134+
// firstColumn.add(cb4);
135+
// firstColumn.add(cb5);
136+
// firstColumn.add(rb1);
137+
// firstColumn.add(rb2);
138+
// firstColumn.add(rb3);
138139
firstColumn.setBounds(200, 20, 200, 500);
139140

140-
JCheckBoxMenuItem cb3m = new JCheckBoxMenuItem("leading,left-to-right");
141-
cb3m.setFont(font);
142-
cb3m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
143-
cb3m.setHorizontalTextPosition(SwingConstants.LEADING);
144-
145-
JCheckBoxMenuItem cb4m = new JCheckBoxMenuItem("leading,right-to-left");
146-
cb4m.setFont(font);
147-
cb4m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
148-
cb4m.setHorizontalTextPosition(SwingConstants.LEADING);
149-
150-
JCheckBoxMenuItem cb5m = new JCheckBoxMenuItem("trailing,left-to-right");
151-
cb5m.setFont(font);
152-
cb5m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
153-
cb5m.setHorizontalTextPosition(SwingConstants.TRAILING);
154-
155-
JCheckBoxMenuItem cb6m = new JCheckBoxMenuItem("trailing,right-to-left");
156-
cb6m.setFont(font);
157-
cb6m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
158-
cb6m.setHorizontalTextPosition(SwingConstants.TRAILING);
159-
160-
JRadioButtonMenuItem rb1m = new JRadioButtonMenuItem("trailing,right-to-left");
161-
rb1m.setFont(font);
162-
rb1m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
163-
rb1m.setHorizontalTextPosition(SwingConstants.TRAILING);
164-
165-
JRadioButtonMenuItem rb2m = new JRadioButtonMenuItem("right,left-to-right");
166-
rb2m.setFont(font);
167-
rb2m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
168-
rb2m.setHorizontalTextPosition(SwingConstants.RIGHT);
169-
170-
JRadioButtonMenuItem rb3m = new JRadioButtonMenuItem("right,right-to-left");
141+
// JCheckBoxMenuItem cb3m = new JCheckBoxMenuItem("leading,left-to-right");
142+
// cb3m.setFont(font);
143+
// cb3m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
144+
// cb3m.setHorizontalTextPosition(SwingConstants.LEADING);
145+
//
146+
// JCheckBoxMenuItem cb4m = new JCheckBoxMenuItem("leading,right-to-left");
147+
// cb4m.setFont(font);
148+
// cb4m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
149+
// cb4m.setHorizontalTextPosition(SwingConstants.LEADING);
150+
//
151+
// JCheckBoxMenuItem cb5m = new JCheckBoxMenuItem("trailing,left-to-right");
152+
// cb5m.setFont(font);
153+
// cb5m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
154+
// cb5m.setHorizontalTextPosition(SwingConstants.TRAILING);
155+
//
156+
// JCheckBoxMenuItem cb6m = new JCheckBoxMenuItem("trailing,right-to-left");
157+
// cb6m.setFont(font);
158+
// cb6m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
159+
// cb6m.setHorizontalTextPosition(SwingConstants.TRAILING);
160+
//
161+
// JRadioButtonMenuItem rb1m = new JRadioButtonMenuItem("trailing,right-to-left");
162+
// rb1m.setFont(font);
163+
// rb1m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
164+
// rb1m.setHorizontalTextPosition(SwingConstants.TRAILING);
165+
//
166+
// JRadioButtonMenuItem rb2m = new JRadioButtonMenuItem("right,left-to-right");
167+
// rb2m.setFont(font);
168+
// rb2m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
169+
// rb2m.setHorizontalTextPosition(SwingConstants.RIGHT);
170+
//
171+
JRadioButtonMenuItem rb3m = new JRadioButtonMenuItem("rr2l");
171172
rb3m.setFont(font);
172173
rb3m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
173174
rb3m.setHorizontalTextPosition(SwingConstants.RIGHT);
174175

176+
JMenuItem mb3 = new JMenuItem("rtf");
177+
mb3.setFont(font);
178+
mb3.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
179+
mb3.setHorizontalTextPosition(SwingConstants.RIGHT);
180+
181+
JMenuItem mb4 = new JMenuItem("right,right-to-left");
182+
mb4.setFont(font);
183+
mb4.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
184+
mb4.setHorizontalTextPosition(SwingConstants.RIGHT);
185+
186+
175187
JMenu m1 = new JMenu("left");
176188
JMenu m2 = new JMenu("right");
177189
menu.add(m1);
178190
menu.add(m2);
179-
m1.add(cb3m);
180-
m2.add(cb4m);
181-
m1.add(cb5m);
182-
m2.add(cb6m);
183-
m2.add(rb1m);
184-
m1.add(rb2m);
191+
// m1.add(cb3m);
192+
// m2.add(cb4m);
193+
// m1.add(cb5m);
194+
// m2.add(cb6m);
195+
// m2.add(rb1m);
196+
// m1.add(rb2m);
185197
m2.add(rb3m);
198+
m2.add(mb3);
199+
m2.add(mb4);
186200

187201
JPanel theTab = new JPanel();
188202

0 commit comments

Comments
 (0)