要使用滚动窗格扭曲标签,可以执行以下更改:
//frame.setLayout(new FlowLayout()); - comment out - use default (Borderlayout) JLabel lbl= new JLabel(); lbl.setIcon(icon); JScrollPane jsp = new JScrollPane(lbl); //warp the label with a scrollpane //frame.add(lbl); frame.add(jsp); //add scrollpane to frame instead of lbl
您可以在此处找到更多信息。



