mohd sherrez

Greenhorn
+ Follow
since Aug 03, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by mohd sherrez

Hi i am currently making some disk alogrithms and need some help( i managed to do SSTF ,FCFS and SCAN)
I have two problems
1.firstly i would like to change my scan alogrithm to work with my inward movement going away from zero ( i have supplied my code for scan for movement towards zero anybody could help me convert it?)
2.Secondly i have no idea how to implement c-scan,Look or c-look alogrithms in java could you guys help?

10 years ago
-Hi guys can i have some opinions on how to change my ui in which i have a combobox which list areas (e.g. kfc,nandos,mac donalds)
on combo box select it will change two labels one which displays the image of the location and the second a description
-My problem is i am bad t designing so im not sure how to beautify it .
-The only thing i feel i can do is enclose all of it a in a jpanel to make it neater
-Help much appericated,please be frank even if it a complete redesign.
10 years ago
THANKS guys it all works You guys have taught me to read apis ! thanks so much!
may god bless you
10 years ago
Hi I can't find that part is it in handling events of combobox?
10 years ago
Hi what's the action listener I have to use for the combobox popmenu becomes invisible or action performed to allow switching of image the combobox api is confusing.
Secondly will the jlabel icon still switch if I have a preexisting icon set
10 years ago
Hi may I ask is it possible to switch images (on jlabel)on combobox item select. I
If (combobox.selecteditem = value)
{
SetIcon (resource)//I'm using the default auto generated code used by eclipse when we set an icon for a jlabel in the gui
}
10 years ago

Maneesh Godbole wrote:

mohd sherrez wrote:
Connection con;
like that?


Ummm...yes.
Please don't take this the wrong way, but if you need to ask how to declare variables, maybe you took a few steps back and started off with basics?
Check out http://docs.oracle.com/javase/tutorial/java/javaOO/variables.html


the con thing dosent work even with declaration
hi i am quite advanced into java i just have trouble trying to select a combobox item from that retrieve some values from a database and display it into my jtextfields
can i ask you for some help
how do i convert the following
public void popupMenuWillBecomeInvisible(PopupMenuEvent arg0) {

ResultSet rs = null;

String tmp=(String)cb_countries.getSelectedItem();
String sql="SELECT * FROM seacountries where country=?";
try{
PreparedStatement pst=con.prepareStatement(sql);
pst.setString(1, tmp);
rs=pst.executeQuery();
if(rs.next()){
String add1=rs.getString("IOC");
tb_ioc.setText(add1);


}
}



catch(Exception e){

}

//////INTO THIS FORMAT////
Step 1 -connect to database
db.getConnection();

step 2 - declare the SQL statement
String sql="SELECT * FROM seacountries where country=?";
rs = db.readRequest(dbQuery);
try{
while (rs.next())}
catch{
}
much thanks
10 years ago

Maneesh Godbole wrote:Welcome to the Ranch!

Have you declared con as a variable?


hi how do i do that?
Connection con;
like that?
10 years ago
public void popupMenuWillBecomeInvisible(PopupMenuEvent arg0) {

String tmp=(String)cb_countries.getSelectedItem();
String sql="SELECT * FROM seacountries where country=?";
try{
PreparedStatement pst=con.prepareStatement(sql);
}



catch(Exception e){

}



}
Hi guys i have an error on this part of the code PreparedStatement pst=con.prepareStatement(sql);
the con is underlined in red whats wrong?
10 years ago