|
|
And I want a Ferrari and £1,000,000,000.
But it doesn't work like that. "I want" is not a question.
We're more than willing to help those who have tried and got stuck. But nobody here is going to do your work for you.
If you genuinely don't know where to start, then talk to your teacher.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
hey guys i have this code
table.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.UPDATE)
{
int column = e.getColumn();
if (column == 2 )
{
pricetext.setText(Integer.toString(calculatesum()));
}
}
textsearch.grabFocus();
textsearch.requestFocus();
}
});
both focus methods arent working and i dont know why , thanks for help
|
|
|
|
|
|
hey thanks for the tip , i meant that both methods fail to set focus on the searchtext field, when i execute the method the cursor is set on the search textfield but then lost again and set into the cell of the table
|
|
|
|
|
Sorry, but it is impossible to guess what may be happening.
[edit]
I have just run a simple test with both methods and they work fine. There must be something else happening in your code.
[/edit]
modified 23-May-19 7:54am.
|
|
|
|
|
|
Hello, Im working on project about algorithme genetic using cloudsim
about bees life algorithme BLA if any one has information or code java about this algorithm please I realy need that me on that I have tried algorithm genetic
|
|
|
|
|
|
Hey guys i have a Jtable shown as : IdP | NameProduct | Quantity | Price |Stock
i have created this method :
public int calculatesum(){
int total=0;
for(int i=0;i<table.getRowCount();i++){
int amount = Integer.parseInt((String)table.getValueAt(i, 2).toString());
int amprice = Integer.parseInt((String)table.getValueAt(i, 3).toString());
total=total+(amount*amprice);
}
return total;
}
that calculates multipilication of (Price*Quantity) and put result in a Jtexfield and called this method in a button action:
private void buttonsearchActionPerformed(java.awt.event.ActionEvent evt) {
conn = DatabaseConnection.dbConnection();
try {
String Sql="select idp,nomp,prix,stock from produit where codep='" + textsearch.getText() + "'";
pst = conn.prepareStatement(Sql);
ResultSet rs = pst.executeQuery();
Object[] columns = {"Id Produit", "Nom Produit", "Quantité", "Prix", "Stock"};
Object[] row = new Object[5];
if (rs.next()){
row[0] = rs.getInt("idp");
row[1] = rs.getString("nomp");
row[2] = 1;
row[3] = rs.getString("prix");
row[4] = rs.getString("stock");
DefaultTableModel model = (DefaultTableModel) table.getModel();
model.addRow(row);}
calculatesum();
pricetext.setText(Integer.toString(calculatesum()));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
My problem is: any changes on quantity won't update the Jtextfield automatically until the button is pressed again. so How can i make the Jtextfield (aka result) changes on the time i change quantity
thanks for help
|
|
|
|
|
|
Thanks for reply ,what do i implement in this methode , isnt there some option to bind jtexfield to table values?
|
|
|
|
|
I don't know, Google for "JTextfield binding" and see what comes up.
|
|
|
|
|
Im working on a programme on cloudsim using java eclisps, its about Genitique algorithme
with algorithme bees life, the question is can any one help me on that please. I have worked on may algorithme like pso, rond robin..
|
|
|
|
|
Member 14239062 wrote: the question is can any one help me on that Yes, we can. As soon as you have a specific question, post it and you shall receive an answer.
If you are looking for people on your team, then this is not the place. We do questions, not projects.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: If you are looking for people on your team
I am thinking that even members of a team would have problems figuring out what that meant.
|
|
|
|
|
jschell wrote: I am thinking If it is thinking, you have arguments. You did not present those.
jschell wrote: even members of a team would have problems figuring out what that meant. Plain English should not be that hard.
Anything else?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: Plain English should not be that hard. To be honest the phrase was open to interpretation. In theory plain English should not be too hard, but in practice it is a language that can easily confuse: Time flies like an arrow, fruit flies like a banana.
|
|
|
|
|
Richard MacCutchan wrote: To be honest the phrase was open to interpretation. Is it the "looking for" that is making it so?
Richard MacCutchan wrote: In theory plain English should not be too hard, but in practice it is a language that can easily confuse ..and no debugger.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: If you are looking for people on your team Which could be (mis)interpreted to mean, "have you come here to look for people who are (already) on your team". Whereas, what you meant (I presume) was, "If you are here looking for people to join your team". It probably sounded correct to you in, and translated from, Dutch. But English has so many different ways to express things, it can catch you out. And that applies to native English speakers as much as to anyone else.
|
|
|
|
|
Richard MacCutchan wrote: Which could be (mis)interpreted to mean, "have you come here to look for people who are (already) on your team".
Thanks, and yes, now it makes a lot more sense
Richard MacCutchan wrote: It probably sounded correct to you in, and translated from, Dutch. But English has so many different ways to express things, it can catch you out. Yes and regularly.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Since I do not speak any foreign languages (apart from American, and a few words of French, Spanish, Greek, Turkish and Hebrew) I have the greatest respect for people who can speak and write English, when it is not their native language.
|
|
|
|
|
Richard MacCutchan wrote: I have the greatest respect for people who can speak and write English, when it is not their native language. Speaking and writing was easier than learning to listen; especially if two English people with different accents begin to talk to each other.
At least English still has a recognizable alphabet. When I see Greek or Hebrew I can only guess at the complexity.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: When I see Greek or Hebrew I can only guess at the complexity. Greek is quite easy because some of the letters are similar to ones we are used to. And some are math symbols which we often recognise. Hebrew is quite alien (and the wrong way round) but can still be learned with a bit of study.
|
|
|
|