Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: NetBeans GUI Builder image paintint

  1. #1
    Junior Member Kakashi's Avatar
    Join Date
    Oct 2009
    Posts
    29
    My Mood
    Confused
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default 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:
     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);
            }
        }


  2. #2
    Member
    Join Date
    Jun 2011
    Location
    Rhode Island
    Posts
    69
    My Mood
    Bored
    Thanks
    11
    Thanked 7 Times in 6 Posts

    Default 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.

  3. The Following User Says Thank You to william For This Useful Post:

    Kakashi (June 15th, 2011)

  4. #3
    Junior Member Kakashi's Avatar
    Join Date
    Oct 2009
    Posts
    29
    My Mood
    Confused
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: NetBeans GUI Builder image paintint

    Thanks for that I will try it out

Similar Threads

  1. New to NetBeans
    By _lithium_ in forum Java IDEs
    Replies: 0
    Last Post: March 1st, 2011, 08:48 PM
  2. Replies: 2
    Last Post: February 14th, 2011, 05:36 PM
  3. Process Builder Issue
    By javameanslife in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 20th, 2010, 09:13 PM
  4. Pixel Alteration in an image/image rotation
    By bguy in forum Java Theory & Questions
    Replies: 3
    Last Post: November 1st, 2009, 10:50 AM
  5. Netbeans help
    By [Kyle] in forum Java IDEs
    Replies: 2
    Last Post: September 20th, 2009, 07:32 PM