Tabnine Logo
NinePatch.setPadding
Code IndexAdd Tabnine to your IDE (free)

How to use
setPadding
method
in
com.badlogic.gdx.graphics.g2d.NinePatch

Best Java code snippets using com.badlogic.gdx.graphics.g2d.NinePatch.setPadding (Showing top 6 results out of 315)

origin: libgdx/libgdx

/** Returns the first region found with the specified name as a {@link NinePatch}. The region must have been packed with
 * ninepatch splits. This method uses string comparison to find the region and constructs a new ninepatch, so the result should
 * be cached rather than calling this method multiple times.
 * @return The ninepatch, or null. */
public NinePatch createPatch (String name) {
  for (int i = 0, n = regions.size; i < n; i++) {
    AtlasRegion region = regions.get(i);
    if (region.name.equals(name)) {
      int[] splits = region.splits;
      if (splits == null) throw new IllegalArgumentException("Region does not have ninepatch splits: " + name);
      NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
      if (region.pads != null) patch.setPadding(region.pads[0], region.pads[1], region.pads[2], region.pads[3]);
      return patch;
    }
  }
  return null;
}
origin: libgdx/libgdx

/** Returns the first region found with the specified name as a {@link NinePatch}. The region must have been packed with
 * ninepatch splits. This method uses string comparison to find the region and constructs a new ninepatch, so the result should
 * be cached rather than calling this method multiple times.
 * @return The ninepatch, or null. */
public NinePatch createPatch (String name) {
  for (int i = 0, n = regions.size; i < n; i++) {
    AtlasRegion region = regions.get(i);
    if (region.name.equals(name)) {
      int[] splits = region.splits;
      if (splits == null) throw new IllegalArgumentException("Region does not have ninepatch splits: " + name);
      NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
      if (region.pads != null) patch.setPadding(region.pads[0], region.pads[1], region.pads[2], region.pads[3]);
      return patch;
    }
  }
  return null;
}
origin: libgdx/libgdx

/** Returns a registered ninepatch. If no ninepatch is found but a region exists with the name, a ninepatch is created from the
 * region and stored in the skin. If the region is an {@link AtlasRegion} then the {@link AtlasRegion#splits} are used,
 * otherwise the ninepatch will have the region as the center patch. */
public NinePatch getPatch (String name) {
  NinePatch patch = optional(name, NinePatch.class);
  if (patch != null) return patch;
  try {
    TextureRegion region = getRegion(name);
    if (region instanceof AtlasRegion) {
      int[] splits = ((AtlasRegion)region).splits;
      if (splits != null) {
        patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
        int[] pads = ((AtlasRegion)region).pads;
        if (pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
      }
    }
    if (patch == null) patch = new NinePatch(region);
    add(name, patch, NinePatch.class);
    return patch;
  } catch (GdxRuntimeException ex) {
    throw new GdxRuntimeException("No NinePatch, TextureRegion, or Texture registered with name: " + name);
  }
}
origin: libgdx/libgdx

/** Returns a registered ninepatch. If no ninepatch is found but a region exists with the name, a ninepatch is created from the
 * region and stored in the skin. If the region is an {@link AtlasRegion} then the {@link AtlasRegion#splits} are used,
 * otherwise the ninepatch will have the region as the center patch. */
public NinePatch getPatch (String name) {
  NinePatch patch = optional(name, NinePatch.class);
  if (patch != null) return patch;
  try {
    TextureRegion region = getRegion(name);
    if (region instanceof AtlasRegion) {
      int[] splits = ((AtlasRegion)region).splits;
      if (splits != null) {
        patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
        int[] pads = ((AtlasRegion)region).pads;
        if (pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
      }
    }
    if (patch == null) patch = new NinePatch(region);
    add(name, patch, NinePatch.class);
    return patch;
  } catch (GdxRuntimeException ex) {
    throw new GdxRuntimeException("No NinePatch, TextureRegion, or Texture registered with name: " + name);
  }
}
origin: com.badlogicgames.gdx/gdx

/** Returns the first region found with the specified name as a {@link NinePatch}. The region must have been packed with
 * ninepatch splits. This method uses string comparison to find the region and constructs a new ninepatch, so the result should
 * be cached rather than calling this method multiple times.
 * @return The ninepatch, or null. */
public NinePatch createPatch (String name) {
  for (int i = 0, n = regions.size; i < n; i++) {
    AtlasRegion region = regions.get(i);
    if (region.name.equals(name)) {
      int[] splits = region.splits;
      if (splits == null) throw new IllegalArgumentException("Region does not have ninepatch splits: " + name);
      NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
      if (region.pads != null) patch.setPadding(region.pads[0], region.pads[1], region.pads[2], region.pads[3]);
      return patch;
    }
  }
  return null;
}
origin: com.badlogicgames.gdx/gdx

/** Returns a registered ninepatch. If no ninepatch is found but a region exists with the name, a ninepatch is created from the
 * region and stored in the skin. If the region is an {@link AtlasRegion} then the {@link AtlasRegion#splits} are used,
 * otherwise the ninepatch will have the region as the center patch. */
public NinePatch getPatch (String name) {
  NinePatch patch = optional(name, NinePatch.class);
  if (patch != null) return patch;
  try {
    TextureRegion region = getRegion(name);
    if (region instanceof AtlasRegion) {
      int[] splits = ((AtlasRegion)region).splits;
      if (splits != null) {
        patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
        int[] pads = ((AtlasRegion)region).pads;
        if (pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
      }
    }
    if (patch == null) patch = new NinePatch(region);
    add(name, patch, NinePatch.class);
    return patch;
  } catch (GdxRuntimeException ex) {
    throw new GdxRuntimeException("No NinePatch, TextureRegion, or Texture registered with name: " + name);
  }
}
com.badlogic.gdx.graphics.g2dNinePatchsetPadding

Javadoc

Set the padding for content inside this ninepatch. By default the padding is set to match the exterior of the ninepatch, so the content should fit exactly within the middle patch.

Popular methods of NinePatch

  • <init>
    Construct a nine patch from the given nine texture regions. The provided patches must be consistentl
  • draw
  • setColor
    Copy given color. The color will be blended with the batch color, then combined with the texture col
  • getBottomHeight
  • getRightWidth
  • getTotalHeight
  • getTotalWidth
  • add
  • getLeftWidth
  • getPadBottom
    Returns the bottom padding if set, else returns #getBottomHeight().
  • getPadLeft
    Returns the left padding if set, else returns #getLeftWidth().
  • getPadRight
    Returns the right padding if set, else returns #getRightWidth().
  • getPadLeft,
  • getPadRight,
  • getPadTop,
  • getTexture,
  • getTopHeight,
  • load,
  • prepareVertices,
  • set,
  • getColor

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • getContentResolver (Context)
  • Menu (java.awt)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JList (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now