Hamad Sultan

Greenhorn
+ Follow
since Mar 16, 2020
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hamad Sultan

Please give me a code which i follow to do the job efficiently.

Thanks
"
I would request starting with the basics. Create a connection at the start of your program and store it somewhere where you'll have access to it. Then when you want to access the data, write the code which creates and configures a PreparedStatement (or Statement) and then executes it. Don't forget to close those things and the ResultSets that they can produce. The try-with-resources statement is the best way to do that.
"
Respected Forum Members;

As i mention i am beginner. Can any one guide me the Generic class as  Paul Clapham suggested. My application have 3 tables in the database and only one URL is used for the Web Server. It is not a enterprise application.

Regards
Hello;
Thanks for good suggestion. Can you guide me what is the best approach to insert, select, update and delete data from the database.

1. Create connection and result sets in each function separately?

2. Make a Generic class and create its object and then pass the parameters and get result?

Please guide me what is best approach for database application? I am beginner and required experts opinion.

Regards
Hello Experts;

Good day. I am stuck and it is very confusing for me that when i passed the name of the user in the select statement the data id feteched from Mysql database. When i passed the variable i can'nt get any record.
The code is below.



Early reply will be appreciated.

Thanks
Hello experts;

Please help me about add action listener.

Regards
1 week ago
Hi Campbell;

Here is the complete code


[/code]

Now I want to add a Action Listener of  LoginButton from LoginWindow.java into the Main_Frame.java. I mean I want to add Action Listener in the Main_Frame.java, The JButton name LoginButton in the LoginWindow.java

Regards
1 week ago
Hello Campbell;

Good day. Here is the code


Regards

1 week ago
Hello Friends;

According to Campbell i insert JToolBar directly to the JFrame instaed of JPanel.
Now we have Three Toolbars. We have three Users when User1 Login The other Two Users Tool Bars must be Disable.
For Example
Optoolbar.setEnabled(false);

But its not working.......


How i fix it

Regards
1 week ago
Hello Campbell;

Good day. I understand your meaning that you want to say that make a class which extends with JToolbar instead of JPanel. Then add buttons in that toolbar. Suppose JButton1 add in the toolbar.

So open the toolbar in the Main_Frame class like

MyToolBar tool=New MyToolBar();
too.add(this);
tool.setBounds(5,5,24,300);

Now action performed
tool.JButton1.addActionListener(what i write here?); am i right?

Please guide me with code. I am very thankful to you.

Regards
1 week ago
Hello Campbell and others Friends;
I just give an example for expert advise. I always Use the meaningful name of the class. Campbell thanks for your reply but i am still confused. Here i again explain my ambiguity.

I Have one class in which main interface develop like JFrame and JDesktopPane. This class name is Main_Frame.java and it have no main method to run. I have another class Master.java which have public static void main method and create of instance of Main_Frame.java to run the application.

Now i want to make a new class which extends with JPanel and it have JToolBar. The JButton adds in the JToolBar and tool bar add to JPanel. Its class name is MyPanle.Java

Now i want to add JButton ActionListner in the Main_Frame.java. I create an instance of MyPanel.java in Main_Frame.java and add panel in the JFrame. Button on the toolbar is also accessible but I am not successful to write a action Listeners in Main_Frame.java.

First is this approach is good?
Please give me an example to understand this?

Regards
1 week ago
Hello Friends;
I am developing the java application by using netbeans. I hava a panel1 class with extends by JPanel and it have a Jbutton name check.
I have another class Main_Frame extends with JFRame.
I write a code in Main_Frame like this
panel1 p1= New panel1();

Now i want to add  an action listener of JButton check in Main_Frame how i do it?

Regards
1 week ago