1 2 Previous Next 16 Replies Latest reply: May 22, 2012 11:28 AM by morgalr RSS

    Displaying photographs , after fething from the database

    kamal.java
      i want to display some photograph in to a swing application after fetching these photo graph from the database table , i dont know what swing component will be better for it and i m designing this in netbeans , so please assist me with that , how to go now and please note that it is dynamic so component should be like that :(. i m trying to create a photo album where i upload the multiple photograph first then i would like to show them each photograph will a text box when some one write some text in that text box and press enter i would like to save that text with that photo graph , I AM DONE WITH THE PHOTO UPLOADING TASK BUT DONT KNOW HOW TO DO THE REST LIKE DISPLAYING THE PHOTOGRAPH WITH THAT TEXT BOX
        • 1. Re: Displaying photographs , after fething from the database
          931373
          You can use JLabel.

          supposoe you have a JLabel component on your frame, and an Image object.
          JLabel label = new JLabel();
          //.
          // Your Frame Initialize here
          //.
          
          ImageIcon icon = new ImageIcon(imageObject);
          label.setIcon(icon);
          • 2. Re: Displaying photographs , after fething from the database
            kamal.java
            IF i have a lot of images then what should i do ?
            • 3. Re: Displaying photographs , after fething from the database
              kamal.java
              or i have to create the array of the labels as .. i have dynamic number of the images in the database that decreases or increases dynamic ally , the scenerio is i m amking a photo album there i want to display the photo graphs and want to display the text box to upate the title after uploading with each photo graph.
              • 4. Re: Displaying photographs , after fething from the database
                931373
                You can change label's text and image in runtime.
                and even you can add or remove JLabel from a panel dynamically (runtime) .

                there is no limit to that, even you can use a scroll pane to avoid screen problems when you have many images.
                Or you can use JList and override the default CellRenderer.

                If you want a really beautiful album with cute conrols and effects, then I suggest you write your own album control using java 2d.
                It is quite easy and simple.
                • 5. Re: Displaying photographs , after fething from the database
                  kamal.java
                  Could you please tell me how to use Java2d in netbeans
                  • 6. Re: Displaying photographs , after fething from the database
                    kamal.java
                    sorry silly question , actually JAVAFX was running in my mind sorry dear , yup i got that JAva2d library hmm u r right.. let me see
                    • 7. Re: Displaying photographs , after fething from the database
                      931373
                      ok,
                      first, you do not need a designer, so it does not matter to use eclipse, netbeans or anything else.

                      create a JFrame (create your own class which extends JFrame)
                      override paint method.
                      follow here and tell me if you had problem
                      [http://docs.oracle.com/javase/tutorial/uiswing/painting/]
                      • 8. Re: Displaying photographs , after fething from the database
                        kamal.java
                        k dear i wills ee n if i have any prob i will tell you , thanks a lot a lot alot.
                        • 9. Re: Displaying photographs , after fething from the database
                          kamal.java
                          Fahim one problem is there regarding to applet , i have one applet that i m displaying on the web site , i want that applet should runs only on the web site and when some one any how if download the code and try to launch that applet on the client machine , cant able to run that aplet , i had tried alot but cant able to hide the javascript displaying in the source code ... i hope u under stand what i m wanted please tell me if any other way is there. AT ALL I NEED TO PROTECT MY JAR FILES FROM MALICIOUS ACCESS OR FROM BEING EXTRACTED . :(

                          Edited by: kamal.java on Apr 30, 2012 5:50 AM
                          • 10. Re: Displaying photographs , after fething from the database
                            morgalr
                            1st of all, I will assume, since you are mentioning NetBeans so prominantly in your post, that you are trying to use the GUI developer in NetBeans--my advice to this would be: "Stop it. Stop it right now!" You need to learn how to develop a basic 2D application in Java manually--at your experience level the path you are on, using the GUI developer in NetBeans, will only lead you down a path of frustration, confusion, and eventual failure. It is a tool for the most minimal of developement or for the advanced user to use--IMO any other use of the GUI developer in NetBeans will only hinder your process.

                            Suggestions on what to use so far have been very good--read them over and consider them.

                            Here are my comments on the actual development:

                            Since you are using a DB, you have a lot of versatility--are you saving a thumbnail or small scale of your images? I would suggest you do so to allow some type of preview so all of the full images do not have to be fetched from the DB every time.

                            You should consider what is a basic element for your picture entry--picture and comment box? This can easily be implemented using 2 JPanels and a textbox--JPanel as a container for the 2nd JPanel seperate text box. You can make these into a class and populate them from the DB easily.

                            Don't be afraid to get a pencil and piece of paper out and manually design what you want each photo entry to look like--a few minutes of planning on the front end will save you hours of frustration and redesign later down the line.
                            • 11. Re: Displaying photographs , after fething from the database
                              morgalr
                              kamal.java wrote:
                              ... i had tried alot but cant able to hide the javascript displaying in the source code ...
                              If you want to have a server based application, then use server side development tools like native Java on the server or PHP or etc... If you are doing client side development and attaching to a server, then know this: you're not going to be able to hide your datasources--look at N-Tier development schemes and use them to insulate your enterprise infostructure visibility from your end users.
                              • 12. Re: Displaying photographs , after fething from the database
                                EJP
                                Ii have one applet that i m displaying on the web site , i want that applet should runs only on the web site
                                Applets run in the browser. If you don't want that, you don't want an applet.
                                I had tried alot but cant able to hide the javascript displaying in the source code
                                What javascript? Applets are written in Java. And this is a Java site, not a Javascript site.

                                You seem to be barking up the wrong tree completely.
                                • 13. Re: Displaying photographs , after fething from the database
                                  kamal.java
                                  No Dear , i m talking about the applets only , when i launch applet some javascript code is need to launch it as where i give the parameters to the applet . In the source code it display where all my .jar files are , so any one can download that files :( i want to prevent this
                                  • 14. Re: Displaying photographs , after fething from the database
                                    morgalr
                                    As stated then, use Enterprise level development methodes to fix the problem: you can either use server side scrpting, or if you must use servlets, then you need to have some Java layers of abstraction on the server to insulate (at least 1 middle tier) your users' view of your enterprise.

                                    If you cannot have access to backend development, then you are just stuck. Go find your boss and tell him you need server development privledges to complete the project, or include someone in the project that can develop on the server side.
                                    1 2 Previous Next