Results 1 to 6 of 6
Thread: Help me
- 05-14-2011, 10:23 PM #1
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 :)
-
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
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.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
Hopefully you've already got non-GUI code for adding/storing data as there is no one-size fits all answer for this.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
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.2- Delete :t1.setText("");// this one will delete the data right ?
This question needs to be more specific and have more details to be answerable.3- Update : How?
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.the Move- Button:
1- move first :?
2-move last:?
3-move next:?
4- move previous :?
Much luck.
- 05-14-2011, 11:12 PM #3
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-
-
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.
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.-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-
- 05-14-2011, 11:42 PM #5
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 .
-


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks