Results 1 to 6 of 6

Thread: Help me

  1. #1
    o0oNorao0o's Avatar
    o0oNorao0o is offline Member
    Join Date
    Oct 2009
    Posts
    51
    Rep Power
    0

    Default Help me

    I'm requested to do a sample database using Java Swing platform .
    I only know the basic of swing could you help me what should I do step by step
    I will demonstrate what I want the project to be look like :



    First : The interface
    How can I make a titledborder? and line border inside the titled border ?I searched and I found this method

    public static TitledBorder createTitledBorder(Border border,
    String title)
    but I don't know where should I put it and what is Border and the value of border


    Second :
    the buttons function
    1- Add : How can I add new data ?
    and if I add data , will they be stored in the program ? IF no then then how can I store them

    2- Delete :t1.setText("");// this one will delete the data right ?
    3- Update : How?

    the Move- Button:
    1- move first :?
    2-move last:?
    3-move next:?
    4- move previous :?

    Thanx in advance :)

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by o0oNorao0o View Post
    I'm requested to do a sample database using Java Swing platform .
    I only know the basic of swing could you help me what should I do step by step
    That may be asking a bit more than a forum staffed by volunteers would be able to do. Your best bet is to go to the Java tutorials which you can find here: Java Tutorials, Big Index, scroll down to the Swing section and learn how to code Swing where most of us learned it. Then if you get stuck in any particular part of your project, please feel free to come back, ask a specific question, show your code, and we'll likely be more than able and willing to help you.

    :)


    Regarding your specific questions
    First : The interface
    How can I make a titledborder? and line border inside the titled border ?I searched and I found this method

    public static TitledBorder createTitledBorder(Border border,
    String title)
    but I don't know where should I put it and what is Border and the value of border
    I've usually used a BorderFactory method, in this case I believe it's createTitledBorder(...) and use the Border returned as the parameter for your JComponent's setBorder(....) method.


    Second :
    the buttons function
    1- Add : How can I add new data ?
    and if I add data , will they be stored in the program ? IF no then then how can I store them
    Hopefully you've already got non-GUI code for adding/storing data as there is no one-size fits all answer for this.


    2- Delete :t1.setText("");// this one will delete the data right ?
    Usually this will delete the text from a text component such as a JTextField or JTextArea, but the best way to find out is to simply try it in your code and see.


    3- Update : How?
    This question needs to be more specific and have more details to be answerable.


    the Move- Button:
    1- move first :?
    2-move last:?
    3-move next:?
    4- move previous :?
    Again, this all will depend on your non-GUI code. If you're wondering how to get your program to respond to JButton presses, again check out the Swing tutorial, how to use buttons section and the how to use actionlistener section.

    Much luck.

  3. #3
    o0oNorao0o's Avatar
    o0oNorao0o is offline Member
    Join Date
    Oct 2009
    Posts
    51
    Rep Power
    0

    Default

    Fubarable

    Oh Thanks and sorry for missing up the questions and the detailed non-clear ones :S
    -For the traversing and add delete buttons do you advice me to read how to create database in java using swings ?
    -I wish I could make the Titled border But I don't know how!? I have used
    import javax.swing.border.Border;
    import javax.swing.border.TitledBorder;
    .
    .
    .
    Border border = new TitledBorder(Color.BLACK, "Employee");
    still doesn't work !?

    could you write the method if you don't mind ??-please-

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by o0oNorao0o View Post
    -For the traversing and add delete buttons do you advice me to read how to create database in java using swings ?
    You have two completely separate issues here:
    1) Interacting with a database with Java, and
    2) Creating a Swing GUI (it's Swing, not swings).

    And the code for these two problems should be kept somewhat separate if possible. There's a tutorial on how to interact with databases in the link provided. Then once you've got that working, you'll only need to have your button's action listener call your already working database interaction code.

    -I wish I could make the Titled border But I don't know how!? I have used
    import javax.swing.border.Border;
    import javax.swing.border.TitledBorder;
    .
    .
    .
    Border border = new TitledBorder(Color.BLACK, "Employee");
    still doesn't work !?

    could you write the method if you don't mind ??-please-
    You may have made the border correctly doing this, but creating a border isn't very useful if you don't do anything with it. Again, please re-read my note above -- you must call setBorder on the component that you wish to add the border to, passing in your newly created border as the method's parameter.

  5. #5
    o0oNorao0o's Avatar
    o0oNorao0o is offline Member
    Join Date
    Oct 2009
    Posts
    51
    Rep Power
    0

    Default

    Actually I know how to use ActionListner for buttons pretty well but I have 0% knoweledge of how I can link a database in Java . I used to do it through access and visual basic , but in Java never used before that's why I'm a little bit confusing :( .

    I will do what you have suggest me to do about the titled border and I will told you what happens .
    Thanks very much for taking minutes of your time to respond to my questions .

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by o0oNorao0o View Post
    Actually I know how to use ActionListner for buttons pretty well but I have 0% knoweledge of how I can link a database in Java . I used to do it through access and visual basic , but in Java never used before that's why I'm a little bit confusing :( .
    I understand. When you learn it, you will be one up on me, since I haven't done database programming in Java yet. Get good at it please, because I will likely have questions for you in the future.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •