|
When posting your question please:- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-fou
|
|
|
|
|
I was playing around with annotation processing and was unable to use generated files directly via an import in my code. Instead I had to prepend the generated class with its complete package. I posted a SO question error: package generated.schema does not exist.
In the end I figured out the reason for this, turned out to be pretty simple, see my answer to the same post. Turned out the error was because I was generating the files at last round of processing, instead of anywhere in between.
So my questions are:
How does generating files at last round vs generating files at in between rounds changes accessing the generated files in code?
Is there a specific reason (Java-related or otherwise) for this behavior?
P.S. I posted the question on SO.
|
|
|
|
|
|
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 row = e.getFirstRow();
int column = e.getColumn();
if (column == 2 )
{
//TableModel model = table.getModel();
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);}
//table.repaint();
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.
|
|
|
|