|
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.
|
|
|
|
|
Eddy Vluggen wrote: If it is thinking, you have arguments. You did not present those.
Perhaps my comment was not clear...
In terms of the original post, not yours, even a team would not understand what the original post (not yours) meant.
|
|
|
|
|
jschell wrote: Perhaps my comment was not clear... I read it differently, but that's my bad. I could have asked for explanation.
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.
|
|
|
|
|
hey guys, i'm developing a grocery store java desktop app, and i don't know much about databases and which one is better : an embedded data base or MySql,Postgres...considering performance and storage.
thanks.
|
|
|
|
|
 Both databases (MySQL and PostgreSQL) are very well known and have almost the same functionality. As to performance - it's opinion based only Joking! The thruth is that the performance depends on many factors, such as:
Quote:
- You are not running with a transaction log (see "The transaction log"). A transaction log improves commit time for transactions that insert, update, or delete rows.
- You are using the 16-bit version of the Windows 3.x database engine. The 32-bit version has better performance, especially for larger databases.
- You are loading huge amounts of data into a database. See "Tuning bulk operations" for methods to improve performance.
- The database engine does not have an adequate amount of memory for caching database pages. See "The database engine" for command line options for controlling the cache size. Extra memory for your computer could improve database performance dramatically.
- Your hard disk is excessively fragmented. This becomes more important as your database increases in size. The DOS and Windows database engines cannot do direct (fast) reading and writing when the database file is very fragmented. There are several utilities available for DOS and Windows to defragment your hard disk. One of these should be run periodically. You could put the database on a DOS disk partition by itself to eliminate fragmentation problems.
- You are using a small page size for a large database. The page size is determined when the database is created by the initialization utility. You can find out the page size by using DBINFO. To change page size, you need to unload and reload your database.
- The database table design is not good. A bad database design can result in time-consuming queries to get information from the database. If indexes will not solve your performance problem, consider alternative database designs.
- Your hard disk is slow. A faster hard disk, a caching disk controller or a disk array can improve performance considerably.
- In a multiuser environment, your network performance is slow.
- You are fetching or inserting many rows of data. Consider using the multi-row operations.
See:
Comparison of relational database management systems - Wikipedia
DB-Engines Ranking - popularity ranking of database management systems
SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems | DigitalOcean
Factors affecting database performance
So, decision belongs to you...
Good luck!
modified 29-Apr-19 15:29pm.
|
|
|
|
|