Back to project page snappyfrog.
The source code is released under:
Apache License
If you think the Android project snappyfrog listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.masseranolabs.snappyfrog; //from w w w . ja va2s .c o m import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle; import com.badlogic.gdx.scenes.scene2d.utils.Drawable; public class ButtonFactory { private static boolean initialized = false; // Always call this on each method private static void Initialize(){ if (!initialized){ // Make sure we add padding to the textures for the buttons. // This needs to be done only once! final int BUTTON_PADDING = ResHelper.LinearHeightValue(10); Drawable up = Game.getSkin().getDrawable("misc/basic-button"); up.setLeftWidth(up.getLeftWidth() + BUTTON_PADDING); up.setRightWidth(up.getRightWidth() + BUTTON_PADDING); up.setTopHeight(up.getTopHeight() + BUTTON_PADDING); up.setBottomHeight(up.getBottomHeight() + BUTTON_PADDING); initialized = true; } } public static TextButton MakeStandardButton(String caption){ Initialize(); TextButtonStyle buttonStyle = new TextButtonStyle(); buttonStyle.up = Game.getSkin().getDrawable("misc/basic-button"); buttonStyle.down = Game.getSkin().getDrawable("misc/basic-button-down"); buttonStyle.font = Game.getButtonFont(); buttonStyle.fontColor = Color.BLACK; return new TextButton(caption, buttonStyle); } }