NetBeans GUI Builder image paintint
Well I am using the NetBean 6.9 Desktop appliction builder and am stuck with getting to paint an image into a jPanel. I have it code right I think but for some reason it does not show up in the pannel do I have to set it to visable or something?
Thanks for any help
here is what I am doing:
Code :
private void userinfosubActionPerformed(java.awt.event.ActionEvent evt) {
// this is for submit button to access user info on server
userName = usertext.getText();
System.out.println("User Name: " + userName);
userPass = passText.getText();
System.out.println("User Password: " + userPass);
//now validate user infor from server:
//then print out user name and a nice little welcome mesg
userInfo.setText("Welcome Back " + userName + " to the best shoping you can get!");
ProductDescriptionArea.append("Product Name: \n" + productName+ "\n");
ProductDescriptionArea.append("Product Discription: \n" + productDis);
try {
BufferedImage myPicture = ImageIO.read(new File("C:/Users/Kenshin/Desktop/Products/inuFinalAct.jpg"));
JLabel picLabel = new JLabel(new ImageIcon( myPicture ));
picturePane.add(picLabel);
} catch (IOException ex) {
Logger.getLogger(Project4GUIView.class.getName()).log(Level.SEVERE, null, ex);
}
}
Re: NetBeans GUI Builder image paintint
Kakashi,
ensure that if you are using pack you may want to set the width and height of your image/JPanel. I often have problems with the JPanel not being visible when its only a dot on the JFrame. I debug with a border around the JPanel to determine its size.
hope it helps.
Re: NetBeans GUI Builder image paintint
Thanks for that I will try it out