public class JFrameLabel extends JFrame{? ? public JFrameLabel(){? ? ? ? super("路紅云的問題!");? ? ? ? Container c=getContentpane();? ? ? ? c.setLayout(new FlowLayout(FlowLayout.LEFT));? ? ? ? int temp = 0;? ? ? ? ImageIcon[] ic={null,new ImageIcon(getClass().getResource("image.jpg")),new ImageIcon(getClass().getResource("/D:/tupian/"+temp+".jpg"))};? ? ? ? String[] s={"文本標(biāo)簽","文字在圖形左方","文字在圖形下方"};? ? ? ? int [] ih={0, JLabel.LEFT, JLabel.CENTER};? ? ? ? int [] iv={0, JLabel.CENTER, JLabel.BOTTOM};? ? ? ? for(int i=0;i<3;i++){? ? ? ? ? ?JLabel label=new JLabel(s[i],ic[i],JLabel.LEFT);? ? ? ? ? ?if(i>0)? ? ? ? ? ?{? ? ? ? ? ? ? ?label.setHorizontalTextPosition(ih[i]);? ? ? ? ? ? ? ?label.setHorizontalTextPosition(iv[i]);? ? ? ? ? ?}? ? ? ? ? ?label.setToolTipText("第"+(i+1)+"個標(biāo)簽");? ? ? ? ? ?c.add(label);? ? ? ? }? ? }? ?public satic void main(String[] args) {? ? ? ?JFrameLabel app=new JFrameLabel();? ? ? ?app.setSize(600,300);? ? ? ?app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);? ? ? app.setVisible(true);}運(yùn)行時顯示c.setLayout(new FlowLayout(FlowLayout.LEFT))出現(xiàn)問題,
問什么出現(xiàn)下面的錯誤
JAVV開發(fā)
2018-07-23 14:07:52