This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
String sql="SELECT * FROM tablename"; | |
pst=conn.prepareStatement(sql); | |
rs = pst.executeQuery(sql); | |
if(rs.next()){ | |
lbl_Name.setText(rs.getString("Name")); | |
lbl_address.setText(rs.getString("address")); | |
lbl_contact.setText(rs.getString("contact")); | |
}else{ | |
lbl_Name.setText(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
String sql="SELECT * FROM tablename"; | |
pst=conn.prepareStatement(sql); | |
rs = pst.executeQuery(sql); | |
while(rs.next()){ | |
office.addItem(rs.getString("Description")); | |
} | |
}catch(SQLException e) { | |
JOptionPane.showMessageDialog(this, e.getMessage()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//encrypt character | |
String pass = pass_security.encrypt(password.getText()); | |
newPassword.setText(pass); | |
//decrypt character | |
String pass = pass_security.decrypt(password.getText()); | |
newPassword.setText(pass); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String encrypt(String key) { | |
String result = ""; | |
int l = key.length(); | |
char ch; | |
for(int i = 0; i < l; i++){ | |
ch = key.charAt(i); | |
ch += 10; | |
result += ch; | |
} | |
return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String reportName = "yourproject/report1.jasper"; | |
InputStream is = this.getClass().getClassLoader().getResourceAsStream(reportName); | |
HashMap hm = new HashMap(); | |
hm.put("lastname", city.getSelectedItem().toString()); | |
JasperPrint jp; | |
try { | |
jp = JasperFillManager.fillReport(is, hm, conn); | |
JRViewer jv = new JRViewer(jp); | |
JInternalFrame bl = new JInternalFrame(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.sf.jasperreports.engine.JRException; | |
import net.sf.jasperreports.engine.JasperFillManager; | |
import net.sf.jasperreports.engine.JasperPrint; | |
import net.sf.jasperreports.swing.JRViewer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String sql = "SELECT * FROM user WHERE userid=? and pass=?"; | |
try{ | |
pst=conn.prepareStatement(sql); | |
pst.setString(1, userid.getText()); | |
pst.setString(2, pass.getText()); | |
rs=pst.executeQuery(); | |
if(rs.next()){ | |
FORM f = new FORM(); | |
this.dispose(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JInternalFrame1 bn = new JInternalFrame1(); | |
Dimension desktopSize = jDesktopPane1.getSize(); | |
Dimension jInternalFrameSize = bn.getSize(); | |
bn.setLocation((desktopSize.width - jInternalFrameSize.width)/2, | |
(desktopSize.height- jInternalFrameSize.height)/2); | |
jDesktopPane1.add(bn); | |
bn.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
if (data1.getText().equals("")){ | |
JOptionPane.showMessageDialog(null, "Data1 is empty"); | |
}else if (data2.getText().equals("")){ | |
JOptionPane.showMessageDialog(null, "Data2 is empty"); | |
}else if (data3.getText().equals("")){ | |
JOptionPane.showMessageDialog(null, "Data3 is empty"); | |
}else{ | |
int p = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this item?","Delete",JOptionPane.YES_NO_OPTION); | |
if (p==0){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
if (data1.getText().equals("")){ | |
JOptionPane.showMessageDialog(null, "Data1 is empty"); | |
}else if (data2.getText().equals("")){ | |
JOptionPane.showMessageDialog(null, "Data2 is empty"); | |
}else if (data3.getText().equals("")){ | |
JOptionPane.showMessageDialog(null, "Data3 is empty"); | |
}else{ | |
String str="UPDATE tablename SET d1='" + data1.getText + "',d2='" + data2.getText + "'d3='" + data3.getText + "' WHERE id='" + id + "'"; | |
pst=conn.prepareStatement(str); |
NewerOlder