[Java]class DLThread {
void start() {
try
{
final URL url = new URL("***");
final URLConnection conn = url.openConnection();
final InputStream is = new BufferedInputStream(conn.getInputStream());
final OutputStream os =
new BufferedOutputStream(new FileOutputStream("data\\newfile.jar"));
byte[] chunk = new byte[1024];
int chunkSize;
while ((chunkSize = is.read(chunk)) != -1) {
os.write(chunk, 0, chunkSize);
}
os.flush();
os.close();
is.close();
BufferedReader in = new BufferedReader(new FileReader("data\\version "));
String Version = in.readLine();
in.close();
JOptionPane.showMessageDialog(null, "Update der Programmdaten auf " + Version + "erfolgreich!", "Erfolgreich", JOptionPane.OK_OPTION);
}
catch (Exception f)
{
JOptionPane.showMessageDialog(null, "Update Fehlgeschlagen! Keine Internet-Verbindung?\r\n" + f, "Erfolgreich", JOptionPane.OK_OPTION);
}
}
}[/Java]
und
[Java]package biber.tool;
import java.awt.BorderLayout;
import javax.swing.GroupLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.LayoutStyle;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit
Cloud Garden (Java Resources) for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Wait extends javax.swing.JFrame {
private JLabel WaitLable;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Wait inst = new Wait();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
public Wait() {
super();
initGUI();
}
private void initGUI() {
try {
GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
getContentPane().setLayout(thisLayout);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
{
WaitLable = new JLabel();
WaitLable.setText("Bitte warten ...");
}
thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
.addContainerGap(17, Short.MAX_VALUE)
.addComponent(WaitLable, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
.addContainerGap());
thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
.addContainerGap(72, 72)
.addComponent(WaitLable, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE)
.addContainerGap(82, Short.MAX_VALUE));
pack();
this.setSize(276, 101);
} catch (Exception e) {
//add your error handling code here
e.printStackTrace();
}
}
}
[/code]