|
My apologies if I'm wrong, I'm at work and can't check out the API right now.(navy so I'm not allowed any excess material here) But the method should be as simple as
comboBox.getSelectedItem(); //should return an Object, cast it to String if need be
//or
comboBox.getSelectedIndex();
I hope this helps, have a good day. (It's just off of the top of my head.)
|
|
|
|
|
You'd think that, but no. :S
I tried that and it works only for the selected item in the LAST combobox that was modified, but when you have more than one row in a jtable and each one of those rows has a combobox that's referenced by the same variable (combobox) it only returns the last change that was made to the object.
What I need to do is I have a jtable and I need to go through all of the rows to record those values in a database.
|
|
|
|
|
I want to try a simple program with java for my Nokia cell phone. Is there anybody to help me?
Sourie
|
|
|
|
|
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Internet
*/
public class Midlet123 extends MIDlet implements CommandListener{
private Command Ok;
private Display dis;
private Form form;
public Midlet123()
{
dis=Display.getDisplay(this); form=new Form("My First Middlet");
Ok=new Command("Exit",Command.OK, 1);
form.setCommandListener(this);
}
public void startApp() {
dis.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command arg0, Displayable arg1) {
if(arg0==Ok)
{
destroyApp(true);
notifyDestroyed();
}
}
}
|
|
|
|
|
The loop cant be stop eventho the key-in matches. Can anyone fix this and tell me my mistake?
Greatly appreciate it if so!
<br />
import java.io.*;<br />
<br />
public class A<br />
{<br />
public static void main(String args[]) throws IOException<br />
{<br />
BufferedReader stdin=new BufferedReader (new InputStreamReader(System.in));<br />
String name,pwd;<br />
int n1;<br />
int p2;<br />
<br />
System.out.println("\tWelcome to ");<br />
System.out.println("*******SHINE IT Training Centre*******");<br />
System.out.println("**Please login before u calculate**");<br />
<br />
do<br />
{<br />
System.out.println("Enter user name: ");<br />
name=stdin.readLine();<br />
n1=Integer.parseInt(name);<br />
System.out.println("Enter password: ");<br />
pwd=stdin.readLine();<br />
p2=Integer.parseInt(pwd);<br />
<br />
} while ((name!="2208")&&(pwd!="1234"));<br />
<br />
<br />
System.out.println("Successful Login!!");<br />
<br />
}<br />
}<br />
|
|
|
|
|
eigther change
while ((name!="2208")&&(pwd!="1234"));
to
while ((!name.equals("2208"))&&(!pwd.equals("1234")));
or
while ((n1!=2208)&&(p2!=1234));
|
|
|
|
|
oic! Thank you very much!!
|
|
|
|
|
I have a class JPanel that I want to add other JPanels onto during run-time. I can add a JPanel using the NetBeans IDE for "design", but the IDE will not let me dynamically add a new JPanel and let me position it on the main JPanel . When I look at the documentation, it appears that there are inherited methods that would allow this type of operation, such as setLocation(int, int). The IDE complains about this method, and the list of available methods that appears when editing the code, has a very limited set. Is there a way around this using the IDE?
Thanks for your time.
AF Pilot
|
|
|
|
|
Reagan Conservative wrote: I have a class JPanel
I would rename your class to something more appropriate if I were you.
If you have a look at the code Netbeans generates with the designer, then you will see something which looks like this.
JPanel jp = new JPanel();
[InsertParentControlHere].add(jp);
Add that in the code where you need it.
My failometer has shot off the end of the scale!
I seem to have misplaced my ban button.. no wait... found it!
|
|
|
|
|
I was just using this as a generic example. The actual name is not JPanel. I was going to try and use this "JPanel" to draw graphics on and place it on another "JPanel". I think that the better approach is just to draw directly to the "JPanel" without adding a whole bunch of smaller "JPanel"s.
Thanks for replying.
AF Pilot
|
|
|
|
|
Apologies, I misunderstood.
Reagan Conservative wrote: I think that the better approach is just to draw directly to the "JPanel" without adding a whole bunch of smaller "JPanel"s.
Agreed, I see what you mean about inheritence now. Overriding the paintComponant method should do the trick. Have a look at this[^], it may help.
My failometer has shot off the end of the scale!
I seem to have misplaced my ban button.. no wait... found it!
|
|
|
|
|
I want to develop a company visitors software. the software will have the following columns:
Visitors name
Purpose of visiting
Who you are visiting
time in
time out
I am having a problem in how the interface should be. I am new in programming please can you descibe for me how the interface should be. especially the time out column. the managment should be able to see those who visited.
Thank you
|
|
|
|
|
Err, this has nothing todo with Java; unless that happens to be the language used in your school.
Alternatively, if this really is for work, use a sheet of paper that visitors sign in and out on.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Some remarks:
1) Don't cross-post, this is considered rude.
2) Provide a meaningful title for your message.
3) Read the posting guidelines (the first message on top of the message boards) before posting.
|
|
|
|
|
how can Read Barcode from an image
|
|
|
|
|
|
i'm trying to overload a method in a web service using netbeans, but the problem is i don't see the overloaded method in the test page , anyone got an answer for this
|
|
|
|
|
with mobile ,Can you tell me java or c# can easier to develop and more popular at The developing country,example viet nam
thanks
|
|
|
|
|
It really depends on the type of mobilephones you want to develop for.
I'd say that for most of the simple mobile phones, you'll better go with Java, but there are more and more smartphones coming up with windows mobile which will perfectly fit with C# (Compact Framework).
I won’t not use no double negatives.
modified on Wednesday, May 27, 2009 7:52 AM
|
|
|
|
|
|
Here is my code of JSP
<% if(request.getParameter("txtTextInput")!=null && request.getParameter("LangGroup").equals("English") ) {
String file=CreateSoundFile( request.getParameter("txtTextInput"), "en");
%>
<embed src="<%=file%>" ></embed>
while CreateSoundFile creates the sound file and give back its path
but the sound file is not played on the client and if the program is being run 2nd time the previous text is being played on the client browser where as the file in the folder on server is changed.
why the file is not downloaded at client when it exists on the serve r
|
|
|
|
|
You have to upload music file and then after you may play it.
A DATAPOST COMPUTER CENTRE
(K.V Prajapati)
|
|
|
|
|
i have postfix installed on my ubuntu and test it to send message to other user in my localhost, and i found no problem using it. But when i try to fetch the message using pop3, i do :
out.write(("USER :"+user+"\r\n").getBytes());<br />
out.write(("PASS :"+pass+"\r\n").getBytes());
and i always get the respon :
+OK Hello there.
+OK Password required.
-ERR Login failed.
+OK Better luck next time.
What is wrong with my code?
|
|
|
|
|
Are you sure that the username and password are correct?
|
|
|
|
|
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn=DriverManager.getConnection("jdbc:odbc:gaurav","","");
String sql="SELECT * FROM optrdata WHERE name=? ANd password=?";
PreparedStatement pst=cn.prepareStatement(sql);
pst.setString(1,t2.getText().trim());
pst.setString(2,t3.getText().trim());
THE ABOVE LINE OF CODE CONNECTS JAVA WITH FORXPRO NOW I WANT TO USE THE SAME CODE CONNECTED TO MY SQL PLEASE GIVE ME THE CODE FOR THE CONNECTIVITY OF MYSQL WITH JAVA....
|
|
|
|