Jump to content

Anyone know how to reset or reload JFrame ?

- - - - -

  • Please log in to reply
6 replies to this topic

#1
xxxxjayxxx

xxxxjayxxx

    Programmer

  • Members
  • PipPipPipPip
  • 123 posts
Anyone can tell me how to reload or reset JFrame ?

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
frame.setContentPane( new JPanel( new BorderLayout() ) );
Then run the code again to build up the frame.

#3
xxxxjayxxx

xxxxjayxxx

    Programmer

  • Members
  • PipPipPipPip
  • 123 posts
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
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
So when the program runs the first time,you also press the calculate button and then a jfilechoser opens?

#5
xxxxjayxxx

xxxxjayxxx

    Programmer

  • Members
  • PipPipPipPip
  • 123 posts
yup... now I need to refresh the program so that it will create another new set of value instead of the old ones ...

#6
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
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
xxxxjayxxx

xxxxjayxxx

    Programmer

  • Members
  • PipPipPipPip
  • 123 posts
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