但是程序却报错Exception in thread "main" java.lang.IllegalArgumentException: horizontalAlignment
at javax.swing.JLabel.checkHorizontalKey(Unknown Source)
at javax.swing.JLabel.setHorizontalAlignment(Unknown Source)
at javax.swing.JLabel.<init>(Unknown Source)
at javax.swing.JLabel.<init>(Unknown Source)
at gui.FrameDemo.main(FrameDemo.java:15)
不会是eclipse又却什么jar吧....求老师指点
同时问一下老师 用Eclipse IDE for Java EE Developers这个版本好吗,这个版本是不是最全的作者: 于星星 时间: 2012-7-30 00:20 本帖最后由 于星星 于 2012-7-30 00:23 编辑
报的是new JLabel("haha",JLabel.EAST);参数类型错误。我查了一下jdk文档:
JLabel
public JLabel(String text,
int horizontalAlignment)Creates a JLabel instance with the specified text and horizontal alignment. The label is
centered vertically in its display area.
Parameters:
text - The text to be displayed by the label.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.