class pictureShow{ JFrame fr1,fr2; JLabel pictureLabel1,pictureLabel2; JPanel pan1,pan2; pictureShow(){ } public void Show1() { fr1=new JFrame("根据酒店地理位置分簇的展示图"); pan1=new JPanel(); pictureLabel1=new JLabel(new ImageIcon(".\\picture1.png"));//相对路径 pan1.add(pictureLabel1, BorderLayout.CENTER); fr1.setContentPane(pan1); fr1.pack(); fr1.setVisible(true); } public void Show2() { fr2=new JFrame("根据酒店价格分簇的展示图"); pan2=new JPanel(); pictureLabel2=new JLabel(new ImageIcon("D:\\Eclipse\\workbench\\zyq_kmeans\\picture2.png"));//绝对路径 pan2.add(pictureLabel2, BorderLayout.CENTER); fr2.setContentPane(pan2); fr2.pack(); fr2.setVisible(true); } }
时间: 2024-10-03 09:00:47