import java.util.Timer;
import javax.swing.JLabel;
import javax.swing.UIManager;
/**
*
* @author Torsten
*/
public class MainFrame extends javax.swing.JFrame {
/** Creates new form MainFrame */
public MainFrame() {
initComponents();
}
public boolean check = false;
public void lauf() {
Timer timer = new Timer();
// nach 1 Sek gehts los und dann alle 10 Sekunden
timer.schedule(new Task(), 1, 10000);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
toolBar = new javax.swing.JToolBar();
start = new javax.swing.JButton();
label1 = new java.awt.Label();
urlList = new java.awt.List();
jMenuBar1 = new javax.swing.JMenuBar();
menu = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
toolBar.setEnabled(false);
start.setText("Start");
start.setPreferredSize(new java.awt.Dimension(65, 23));
start.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
startActionPerformed(evt);
}
});
label1.setText("label1");
menu.setText("Datei");
jMenuBar1.add(menu);
setJMenuBar(jMenuBar1);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(toolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(229, 229, 229)
.add(start, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(10, 10, 10))
.add(layout.createSequentialGroup()
.addContainerGap()
.add(urlList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(toolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(urlList, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(start, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
pack();
}// </editor-fold>
private void startActionPerformed(java.awt.event.ActionEvent evt) {
if (start.getText().equals("Start")){
start.setText("Stop");
lauf();
//label1.setText("test");
//setList();
} else {
start.setText("Start");
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName() );
} catch( Exception e ) {
e.printStackTrace();
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainFrame().setVisible(true);
}
});
}
public void setList(){
label1.setText("Test");
}
//static javax.swing.JLabel jLabel1;
// Variables declaration - do not modify
private javax.swing.JMenuBar jMenuBar1;
private java.awt.Label label1;
private javax.swing.JMenu menu;
private javax.swing.JButton start;
private javax.swing.JToolBar toolBar;
private java.awt.List urlList;
// End of variables declaration
}