Note that there are some explanatory texts on larger screens.

plurals
  1. PORefreshing JPanel and Switching JTabbedPane in ActionPerfmored
    text
    copied!<pre><code> private void buttonAddJobActionPerformed(java.awt.event.ActionEvent evt) { try { retrieveID(); String sqlStm = "INSERT INTO Job (employerID,title,description,type,salary,benefits,vacancies,closing,requirement,placement,applyTo,status,posted,location) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; pst = conn.prepareStatement(sqlStm); pst.setInt(1,id); pst.setString(2,txtTitle.getText()); pst.setString(3,areaDescription.getText()); pst.setString(4,comboType.getSelectedItem().toString()); pst.setString(5,txtSalary.getText()); pst.setString(6,areaBenefits.getText()); pst.setString(7,txtVac.getText()); Date close; close = txtDate.getDate(); pst.setString(8,sdf.format(close)); pst.setString(9,areaReq.getText()); pst.setString(10,comboPlace.getSelectedItem().toString()); pst.setString(11,txtWeb.getText()); pst.setString(12,comboStatus.getSelectedItem().toString()); Date now = new Date(); pst.setString(13,sdf.format(now)); pst.setString(14,txtLoc.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null,"You have successfully added a job"); //empty all JTextfields //switch to another </code></pre> <p>I am trying to empty the set of <code>JTextFields</code> in the JPanel, but instead of emptying them one by one, can I just refresh the panel? if so, how do you do this. i tried <code>repaint()</code>, <code>revalidate()</code> these dont work. perhaps I am wrong here. I would also like to switch the <code>JTabbedPane</code> to another Pane, but this doesnt work when I try with this...</p> <pre><code>JTabbedPane sourceTabbedPane = (JTabbedPane) evt.getSource(); sourceTabbedPane.setSelectedIndex(0); </code></pre> <p>can someone show an example code how to do this. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload