label1 = new JLabel("Image and Text",icon,                 JLabel.CENTER);

解决方案 »

  1.   

    参数如下:
    LEFT, CENTER, RIGHT, LEADING or TRAILING.
      

  2.   

    这个我以前试过,好像没有我要的效果啊。原码:import javax.swing.*;class test 
    {
    public static void main(String[] args) 
    {
    JFrame f=new JFrame();
    JLabel l=new JLabel("label",new ImageIcon("101-1.gif"),JLabel.LEFT);
    f.getContentPane().add(l);
    f.show();
    }
    }有什么问题吗?
      

  3.   

    这里的显示样式符合你的要求吗(地址如下)?
    http://java.sun.com/docs/books/tutorial/uiswing/components/label.html
      

  4.   

    很easy
    JLabel label = new JLabel("hello");
    ImageIcon icon = new ImageIcon("meimei.gif");
    label.setIcon(icon);
    //hehe, it is here
    label.setHorizontalTextPosition(SwingConstants.BOTTOM); 
    label.setVerticalTextPosition(SwingConstants.CENTER);that's ok!
      

  5.   

    yeah,3xps:bottom 和center反了 :)