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 10 of 10

Thread: Embedded Derby & SE GUI (Netbeans 7.4)

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Embedded Derby & SE GUI (Netbeans 7.4)

    Beginner with NetBeans and Java.

    OK.

    I have a GUI (SE Swing) that contains a JTable, 2 buttons and a JTextArea.

    I have an Embedded Derby database with a single table.

    I have done some research with regards to Derby and have (hopefully) realised that I can program the connection without using EclipseLink. But what I want to know is how to attach data from the database table to these separate parts of the GUI - some data to the JTable, (and when a row is selected in the JTable) a website (unique to each row of data in the Database table) to a button and an image (again, unique to each row of data in the Database table) to the JTextArea.

    Are there any tutorials for this - reading the Oracle pages makes me more confused - or am I asking too much of Java and Derby?

    Looking forward to positive responses.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    Step 1: Get the data. Can you write a program that simply reads the data in and prints it to the console? Can you separate the data into the different logical components? You might want to create some kind of data structure that holds the different types of data.

    Step 2: Write the GUI. Can you create a GUI that shows some hard-coded data? Can you parameterize your program so that you can change what's being displayed simply by calling a method?

    Step 3: Combine them. Make it so the parameters that the method from step 2 take match the data structures you created in step 1.

    Which step are you stuck on? Where is your MCVE?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following 2 Users Say Thank You to KevinWorkman For This Useful Post:

    Chaotic (August 12th, 2014), GregBrannon (August 11th, 2014)

  4. #3
    Junior Member
    Join Date
    Aug 2014
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    Hi Kevin,

    Step 1: I take it you mean a structured database with linked tables? That is: a table with the data for the JTable only, a table with the list of websites for the JButton and the same for the image.

    Step 2: I have the GUI already created in NetBeans - have tried various ways to display the data although now I'm getting tired (I just want to finish the damn thing) so I haven't tried the programmatical way of connecting to the Embedded Derby database yet. I really am new to this so if you could hint at what type of method I should use that would be most helpful also.

    BUT the database structure will be the next thing I must do (obviously from what you have said in step 1) and then I must check Step 2 with just showing the data in the JTable to start with and proceed from that point.

    Thank you - sensei knows the way, the student must find the way.

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    I take it you mean a structured database with linked tables?
    Not necessarily. The data can be in any form or structure you can handle.
    Step 2: I have the GUI already created in NetBeans - have tried various ways to display the data although now I'm getting tired
    I take it then that you're using the Netbeans GUIBuilder and you know little to nothing about actual Java programming, at least graphical/GUI Java programming? If so, this is not a Java question, it's a Netbeans GUIBuilder question. We don't have many here (any?) who can help you with that. If not, then please describe specifically what you need help with.

  6. The Following User Says Thank You to GregBrannon For This Useful Post:

    KevinWorkman (August 13th, 2014)

  7. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    Quote Originally Posted by Chaotic View Post
    Step 1: I take it you mean a structured database with linked tables? That is: a table with the data for the JTable only, a table with the list of websites for the JButton and the same for the image.
    Not at all. You're getting your data from a database. You need to store it in some Plain Old Java Objects. I'm talking about the step *after* the database but *before* the JTable or JButton.

    Quote Originally Posted by Chaotic View Post
    Step 2: I have the GUI already created in NetBeans
    Do yourself a favor and ditch the GUI builder. They only make things like this much harder.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #6
    Junior Member
    Join Date
    Aug 2014
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    I have created a embedded database with 4 tables linked with keys. Are you talking about something like Hibernate?

    --- Update ---

    Also, found an EventListener for the row of the JTable selected so this is what I shall be using.

  9. #7
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    Hibernate is one way to go. Or you could populate your own Objects. Either way you'll have to fill up a List or a tree or some kind of data structure.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  10. #8
    Junior Member
    Join Date
    Aug 2014
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    OK. I'm actually having problems with the connection to the embedded Derby database. I'll need to check Hibernate for this of course.

    Also, I must say that this is not a CRUD application that I am creating.
    The application is to view the embedded database, when a row in the JTable is selected further data is supplied to the JButton (web site address) and JTeaxtArea (JPEG image).
    I apologise for not saying this beforehand.

    Also, I'm keeping the GUI I've created as it indicates for me a partial advance - if I were more experienced I would ditch it and use another approach.

    Anyway, on to researching Hibernate for this.

  11. #9
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    That's the benefit of breaking it down into smaller pieces. You can isolate the part giving you trouble: now you know the problem is in your database connection, not anywhere else. Isolate that further to figure out the problem. Don't be afraid to create small test programs that try things out.

    Using a GUI builder is just going to be a huge headache, but it's yup to you. It's going to be pretty difficult to get help if you go that route, since GUI builders generally write code that isn't meant to be read by humans.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  12. #10
    Junior Member
    Join Date
    Aug 2014
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Embedded Derby & SE GUI (Netbeans 7.4)

    OK.
    Using Netbeans 7.4, I have hand coded a GUI (SE desktop distributable application), created a single table database (Java DB using 'Embedded' connection) and created (via a wizard in Netbeans) the 'Persistence.xml' file (Hibernate 2.0 setting).

    As I'm at that stage of creating a (non-CRUD) database application what would be the next steps to take with Hibernate 2.0?
    Would it be using NB wizards to create 'Mapping files and POJOs...' and the other Hibernate elements?

    Any guidance/advice would be greatly recieved - I'm a little stuck at the moment, relatively new to Java but want to learn to create this application myself.
    If there is a document/tutorial that provides these steps, please provide the link.

Similar Threads

  1. Netbeans EclipseLink and Embedded Java DB
    By Chaotic in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 1st, 2014, 01:28 PM
  2. Replies: 1
    Last Post: March 29th, 2014, 10:37 AM
  3. problem in Derby embedded database connection
    By brother in forum JDBC & Databases
    Replies: 6
    Last Post: December 24th, 2012, 02:17 PM
  4. Replies: 3
    Last Post: April 16th, 2011, 01:38 PM
  5. [SOLVED] Java app with Netbeans and Derby database
    By Kakashi in forum JDBC & Databases
    Replies: 3
    Last Post: March 17th, 2011, 02:35 PM

Tags for this Thread