Anyone can tell me how to reload or reset JFrame ?
6 replies to this topic
#1
Posted 09 May 2011 - 09:39 AM
|
|
|
#2
Posted 10 May 2011 - 08:12 AM
frame.setContentPane( new JPanel( new BorderLayout() ) );Then run the code again to build up the frame.
#3
Posted 10 May 2011 - 08:15 AM
ya i just try that but what I mean is I designed a program ... the program requires the user to open files, save file and the calculate the value and display it out in a file... however I need to reload or refresh the program so that it will allow me to perform another new set of set ... such as when I press the calculate button it will not calculate back the old set of numbers.
#4
Posted 10 May 2011 - 08:21 AM
So when the program runs the first time,you also press the calculate button and then a jfilechoser opens?
#5
Posted 10 May 2011 - 08:31 AM
yup... now I need to refresh the program so that it will create another new set of value instead of the old ones ...
#6
Posted 10 May 2011 - 08:39 AM
How come it works the first time? If it's with an if-statement, just make sure that after the calculation is done, your if-statement results in what it results at the start.
#7
Posted 10 May 2011 - 08:45 AM
ok here's the code :
OpenSecreeningBase.setEnabled(false);
SaveScreeningBase.setEnabled(false);
convertScreeningBase.setText("STOP");
screeningProgressBar.setBounds(523, 390, 150, 17);
panel2.add(screeningProgressBar);
try {
FileWriter writer = new FileWriter(screeningbase);
for (File moleculeFile : screeningBase.listFiles()) {
BitSet fingerprint = convertToFingerprint(moleculeFile); //call function
writer.append(moleculeFile.getName());
Screening_Ready.setText("Processing : " + moleculeFile.getName() + " ...");
writer.append(" ");
{
for (int i = 0; i < fingerprint.size(); i++) {
[COLOR="red"] if (fingerprint.get(i)) {
writer.append("1");
writer.flush();
} else {
writer.append("0");
writer.flush();
}[/COLOR]
screeningProgressBar.setValue(i);
screeningProgressBar.repaint();
}
writer.append("\n");
}
}
writer.close();
convertScreeningBase.setText("CONVERT");
Screening_Ready.setText("Process Completed!");
JOptionPane.showMessageDialog(null, "\t\tProcess Completed!", "Completed", JOptionPane.INFORMATION_MESSAGE);
OpenSecreeningBase.setEnabled(true);
SaveScreeningBase.setEnabled(true);
} catch (Exception e) {
e.printStackTrace();
}
this part ?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









