Advertisement
Guest User

Reduntanten Code auslagern

a guest
Sep 13th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. //Dein Code    
  2. ...
  3. f.enemy_intL.setBounds((int)f.screensize.getWidth() / 2 - 425, (int)f.screensize.getHeight() / 2 - 340, 500, 35);
  4.     f.enemy_intL.setVisible(false);
  5.     f.enemy_intL.setFont(font);
  6.     f.enemy_intL.setForeground(Color.WHITE);
  7.    
  8.     f.survival_time_Label.setBounds((int)f.screensize.getWidth() / 2 - 425, (int)f.screensize.getHeight() / 2 + 325,    500, 35);
  9.     f.survival_time_Label.setVisible(false);
  10.     f.survival_time_Label.setFont(font);
  11.     f.survival_time_Label.setForeground(Color.WHITE);
  12. ...
  13.    
  14. //Besser:
  15. ...
  16. setStandardLook(f.enemy_intL,425,340,500,35);
  17. setStandardLook(f.survival_time_Label,425,325,500,35);
  18. ...
  19. private void setStandardLook(JLabel jl,int offsetx,int offsety,int width,int height){
  20. jl.setBounds((int)f.screensize.getWidth() / 2 -offsetx, (int)f.screensize.getHeight() / 2 + offsety,    width, height);
  21.     jl.setVisible(false);
  22.     jl.setFont(font);
  23.     jl.setForeground(Color.WHITE);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement