Advertisement
james1bow

Untitled

Feb 18th, 2024
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. public UIElement button(Player player, String Attribute, float fontsize, String text, boolean clickable){
  2.         int color = 0xFFffffff;
  3.         if(clickable==false){
  4.             color = 0x808080ff;          
  5.         }
  6.         //button
  7.         UIElement Button = new UIElement();
  8.         Button.setPivot(Pivot.MiddleCenter);
  9.         Button.setBorderColor(color);
  10.         Button.setBorder(2);
  11.         Button.setBorderEdgeRadius(15, false);
  12.         Button.setVisible(true);
  13.         Button.setClickable(clickable);
  14.         Button.setPickable(true);
  15.        
  16.         //button text
  17.         UILabel ButtonText = new UILabel();
  18.         ButtonText.setText(text);
  19.         ButtonText.setFontSize(fontsize);
  20.         ButtonText.setFontColor(color);
  21.         ButtonText.setPivot(Pivot.MiddleCenter);
  22.         ButtonText.setPosition(50, 50, true);
  23.         ButtonText.setSize(90, 90, true);
  24.         ButtonText.setVisible(true);
  25.        
  26.         Button.addChild(ButtonText);
  27.         player.setAttribute(Attribute+"_ButtonText", ButtonText);
  28.         player.setAttribute(Attribute+"_Button", Button);
  29.        
  30.     return Button;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement