Ich verstehe dein Problem nicht.???:L
Läuft bei mir. 
Hab lediglich die Animation schneller gemacht und eingebaut, das der Balken nicht endlos wächst.
[code=Java]import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Balkengraphics extends JPanel {
private static final long serialVersionUID = 5L;
private Timer timer;
private int balkenvar;
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Balkengraphics balkengraphics = new Balkengraphics();
frame.add(balkengraphics);
frame.pack();
frame.setVisible(true);
balkengraphics.init(frame);
}
private void init(JFrame frame) {
Balkengraphics balken2 = new Balkengraphics();
GridBagLayout gbl = new GridBagLayout();
gbl.columnWidths = new int[] { 30, 120, 30, 60, 107, 41, 17, 5, 5, 3, 30, 30, 30, 30, 30, 30, 0 };
gbl.rowHeights = new int[] { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 32, 0, 32, 30,
30 };
gbl.columnWeights = new double[] { 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, Double.MIN_VALUE };
gbl.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
setLayout(gbl);
addComponent(this, gbl, balken2, 2, 13, 10, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.CENTER);
TimerTask task = new TimerTask() {
public void run() {
balkenvar += 10;
if (balkenvar >= 400) {
timer.cancel();
}
frame.repaint();
}
};
timer.scheduleAtFixedRate(task, 0, 100);
}
Balkengraphics() {
timer = new Timer();
setPreferredSize(new Dimension(700, 200));
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Color startgreen = Color.GREEN;
Color endred = Color.RED;
GradientPaint startend = new GradientPaint(0, 50, startgreen, 400, 50, endred);
g2d.setPaint(startend);
if (balkenvar <= 400) {
g2d.fillRect(100, 50, balkenvar, 25);
}
g2d.fillRect(100, 80, 400, 25);
}
static void addComponent(Container cont, GridBagLayout gbl, Component c, int x, int y, int width, int height,
double weightx, double weighty, int fill, int anchor) {
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = x;
gbc.gridy = y;
gbc.gridwidth = width;
gbc.gridheight = height;
gbc.weightx = weightx;
gbc.weighty = weighty;
gbc.fill = fill;
gbc.anchor = anchor;
gbc.insets = new Insets(0, 0, 5, 5);
gbl.setConstraints(c, gbc);
cont.add(c);
}
}[/code]