Buggy code:
public class SimulatorGui extends JFrame { private static final SimulatorGui INSTANCE = new SimulatorGui ( ) ; private JPanel contentPane ; private JButton simulationStartenButton ; private JButton simulationPausierenButton ; private JButton demoShitButton ; private JPanel panel ; private JPanel repository ; private JComboBox scenarioDropDown ; private JSplitPane splitPane ; private JButton saveButton ; private String theme = "Simpel" ; private List < BufferedImage > images ; private List < BufferedImage > icons ; private BufferedImage dragAndDropImage = null ; private Container passageStart = null ; private long lastStimulation ; private int stimulatorCounter = 0 ; private SimulatorGui ( ) throws HeadlessException { } public static SimulatorGui getInstance ( ) { } private void reloadAssets ( String theme ) { } private void createUIComponents ( ) { panel = new JPanel ( ) { @ Override protected void paintComponent ( Graphics g ) { super . paintComponent ( g ) ; for ( PetriNetManager . PassageContainer c : PetriNetManager . getInstance ( ) . getPassageContainers ( ) ) { Graphics2D g2d = ( ( Graphics2D ) ( g ) ) ; g2d . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; g2d . setRenderingHint ( RenderingHints . KEY_ALPHA_INTERPOLATION , RenderingHints . VALUE_ALPHA_INTERPOLATION_QUALITY ) ; Vector2f start = new Vector2f ( ( ( c . getStart ( ) . x ) + 25 ) , ( ( c . getStart ( ) . y ) + 25 ) ) ; Vector2f end = new Vector2f ( ( ( c . getEnd ( ) . x ) + 25 ) , ( ( c . getEnd ( ) . y ) + 25 ) ) ; g2d . drawLine ( ( ( int ) ( start . x ) ) , ( ( int ) ( start . y ) ) , ( ( int ) ( end . x ) ) , ( ( int ) ( end . y ) ) ) ; AffineTransform xForm = new AffineTransform ( ) ; Vector2f tipPosition = new Vector2f ( start ) . add ( new Vector2f ( end ) . subtract ( start ) . multiply ( 0.5F ) ) ; Vector2f direction = end . subtract ( start ) ; xForm . setToIdentity ( ) ; xForm . translate ( ( ( tipPosition . x ) - 6.5 ) , ( ( tipPosition . y ) - 6.5 ) ) ; float angle = new Vector2f ( 1 , 0 ) . getAngle ( direction ) ; if ( ( new Vector2f ( 0 , 1 ) . getAngle ( direction ) ) > ( Math . toRadians ( 90 ) ) ) angle *= - 1 ; xForm . rotate ( angle ) ; g2d . drawImage ( icons . get ( 3 ) , xForm , null ) ; Passage p = c . getPassage ( ) ; for ( int i = 0 ; i < ( p . tokens . size ( ) ) ; i ++ ) { <START_BUG> Vector2f pos = new Vector2f ( start ) . add ( end . subtract ( start ) . multiply ( p . tokens . get ( i ) . extent ) ) ; <END_BUG> g2d . drawImage ( icons . get ( 2 ) , ( ( int ) ( pos . x ) ) , ( ( int ) ( pos . y ) ) , null ) ; } } for ( PetriNetManager . Container container : PetriNetManager . getInstance ( ) . getContainers ( ) ) { NetElement component = container . getComponent ( ) ; boolean slot = component instanceof Slot ; g . drawImage ( images . get ( ( slot ? 0 : 1 ) ) , container . getPosition ( ) . x , container . getPosition ( ) . y , null ) ; float tokenCount = component . tokens . size ( ) ; for ( int i = 0 ; i < tokenCount ; i ++ ) { g . drawImage ( icons . get ( 2 ) , ( ( ( ( int ) ( ( ( ( container . getPosition ( ) . x ) + 25 ) - ( ( tokenCount // 2 ) * 13 ) ) - ( ( ( tokenCount // 2 ) - 0.5F ) * 4 ) ) ) + ( i * 13 ) ) + ( i * 4 ) ) , ( ( ( container . getPosition ( ) . y ) - 4 ) - 13 ) , null ) ; } } } } ; repository = new JPanel ( ) { @ Override protected void paintComponent ( Graphics g ) { super . paintComponent ( g ) ; for ( int i = 0 ; i < ( images . size ( ) ) ; i ++ ) { g . drawImage ( images . get ( i ) , ( 5 + ( 55 * i ) ) , 5 , null ) ; } } } ; } private void loadImages ( ) { } private void loadIcons ( ) { } public JPanel getDrawPanel ( ) { } }

Fix:
Vector2f pos = new Vector2f ( start ) . add ( direction . multiply ( p . tokens . get ( i ) . extent ) ) ;