Click here to Skip to main content
15,888,340 members
Home / Discussions / Java
   

Java

 
AnswerRe: Bezier Curve using java Graphics2D Pin
Richard MacCutchan4-Dec-13 22:03
mveRichard MacCutchan4-Dec-13 22:03 
QuestionRe: Bezier Curve using java Graphics2D Pin
f269-Dec-13 18:39
f269-Dec-13 18:39 
AnswerRe: Bezier Curve using java Graphics2D Pin
Richard MacCutchan9-Dec-13 22:15
mveRichard MacCutchan9-Dec-13 22:15 
GeneralRe: Bezier Curve using java Graphics2D Pin
f2610-Dec-13 21:08
f2610-Dec-13 21:08 
GeneralRe: Bezier Curve using java Graphics2D Pin
li_lds20-Jan-14 18:40
li_lds20-Jan-14 18:40 
QuestionJAVA Pin
pratikbc28-Nov-13 18:33
pratikbc28-Nov-13 18:33 
AnswerRe: JAVA Pin
Chris Quinn28-Nov-13 20:58
Chris Quinn28-Nov-13 20:58 
QuestionJComboBox and ActionListener. Pin
chdboy27-Nov-13 18:42
chdboy27-Nov-13 18:42 
What I want to do is,when ever I click on any Item selected in the Combo Box it should display the result accordingly.
My code does that ,but I wanted to know is there any way that I don't use lots of IF statements?Right now it is according to Index of combo box items.

Java
else if(e.getSource().equals(jcb1))
		{
			int selectedindex = jcb1.getSelectedIndex();
			String comb_string = (String)jcb1.getSelectedItem();			
			if(selectedindex==1)
			{
				try {
				
				//String sql_command ="select * , count(*) over (partition by 1) total_rows from Employer where Employername = ? ";				
				String sql_command ="select * from Employer where Employername = ? ";
					PreparedStatement st=con.prepareStatement(sql_command);					
					st.setString(1,comb_string);
					Result = st.executeQuery();
					int test =0;
					String Store="";
					String Response ="";
					test++;
					if(Result.next())
					{						
						String add1=Result.getString(3);
						first.setText(add1);
						String add2=Result.getString(28);
						second.setText(add2);
						String add3=Result.getString(4);
						third.setText(add3);
						String add4=Result.getString(6);
						fourth.setText(add4);
						
						if(test !=0)
						{
							/*Result.absolute(test);
							DisplayData();*/
							Response = "Number of Records that Matches :"+test+Store;
							JOptionPane.showMessageDialog(null, Response);				
						}
						else
						{
							JOptionPane.showMessageDialog(null,"Could not be found");
						}
						
						
					}
				} catch (SQLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}					
			}			
		}	


EDIT:

I think
Java
if(jcb1.getSelectedItem().equals(comb_string))

this is the solution.
I have a JTextField instead ,but what this code does is ,it adds the name which I search into JComboBox and remembers it till the JFrame is open.
Questionchat room Pin
sushilshukla26-Nov-13 18:48
sushilshukla26-Nov-13 18:48 
AnswerRe: chat room Pin
Richard MacCutchan26-Nov-13 23:02
mveRichard MacCutchan26-Nov-13 23:02 
AnswerRe: chat room Pin
jschell28-Nov-13 7:17
jschell28-Nov-13 7:17 
AnswerRe: chat room Pin
Member 104383821-Dec-13 19:36
Member 104383821-Dec-13 19:36 
QuestionHow to find sum of values in JTable column in Java NetBeans Pin
Cyber1222-Nov-13 21:11
Cyber1222-Nov-13 21:11 
AnswerRe: How to find sum of values in JTable column in Java NetBeans Pin
Richard MacCutchan23-Nov-13 2:16
mveRichard MacCutchan23-Nov-13 2:16 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Cyber129-Dec-13 21:27
Cyber129-Dec-13 21:27 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Richard MacCutchan9-Dec-13 22:22
mveRichard MacCutchan9-Dec-13 22:22 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Cyber1212-Dec-13 2:24
Cyber1212-Dec-13 2:24 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Richard MacCutchan12-Dec-13 2:43
mveRichard MacCutchan12-Dec-13 2:43 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Cyber1213-Dec-13 0:48
Cyber1213-Dec-13 0:48 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Richard MacCutchan13-Dec-13 1:46
mveRichard MacCutchan13-Dec-13 1:46 
GeneralRe: How to find sum of values in JTable column in Java NetBeans Pin
Cyber1213-Dec-13 2:56
Cyber1213-Dec-13 2:56 
Questionjava character array Pin
Member 996561421-Nov-13 9:04
Member 996561421-Nov-13 9:04 
QuestionRe: java character array Pin
Richard MacCutchan21-Nov-13 22:06
mveRichard MacCutchan21-Nov-13 22:06 
AnswerRe: java character array Pin
Member 996561422-Nov-13 7:41
Member 996561422-Nov-13 7:41 
QuestionRe: java character array Pin
Richard MacCutchan22-Nov-13 20:55
mveRichard MacCutchan22-Nov-13 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.