Tabnine Logo
java.awt
Code IndexAdd Tabnine to your IDE (free)

How to use java.awt

Best Java code snippets using java.awt (Showing top 20 results out of 17,343)

origin: stackoverflow.com

 enum Color { BLACK, WHITE };

Color nothing = null;
if (nothing == Color.BLACK);      // runs fine
if (nothing.equals(Color.BLACK)); // throws NullPointerException
origin: libgdx/libgdx

protected static JFrame findJFrame (Component component) {
  Container parent = component.getParent();
  while (parent != null) {
    if (parent instanceof JFrame) {
      return (JFrame)parent;
    }
    parent = parent.getParent();
  }
  return null;
}
origin: libgdx/libgdx

@Override
public void setCursorPosition (int x, int y) {
  if (robot != null) {
    robot.mouseMove(canvas.getLocationOnScreen().x + x, canvas.getLocationOnScreen().y + y);
  }
}
origin: skylot/jadx

public SettingsGroup(String title) {
  setBorder(BorderFactory.createTitledBorder(title));
  setLayout(new GridBagLayout());
  c = new GridBagConstraints();
  c.insets = new Insets(5, 5, 5, 5);
  c.weighty = 1.0;
}
origin: skylot/jadx

  @Override
  public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g.create();
    try {
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      super.paint(g2d);
    } finally {
      g2d.dispose();
    }
  }
}
origin: log4j/log4j

protected void setFontSize(Component component, int fontSize) {
 Font oldFont = component.getFont();
 Font newFont =
   new Font(oldFont.getFontName(), oldFont.getStyle(), fontSize);
 component.setFont(newFont);
}
origin: spring-projects/spring-framework

  @Override
  public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest webRequest) {
    return new Color(0);
  }
}
origin: libgdx/libgdx

public Node (int x, int y, int width, int height, Node leftChild, Node rightChild, String leaveName) {
  this.rect = new Rectangle(x, y, width, height);
  this.leftChild = leftChild;
  this.rightChild = rightChild;
  this.leaveName = leaveName;
}
origin: libgdx/libgdx

public static DisplayMode getDesktopDisplayMode () {
  GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice device = genv.getDefaultScreenDevice();
  java.awt.DisplayMode mode = device.getDisplayMode();
  return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(),
    mode.getBitDepth());
}
origin: skylot/jadx

private void applyRenderHints(Graphics g) {
  if (g instanceof Graphics2D) {
    Graphics2D g2d = (Graphics2D) g;
    if (DESKTOP_HINTS != null) {
      g2d.setRenderingHints(DESKTOP_HINTS);
    } else {
      g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    }
  }
}
origin: stackoverflow.com

 Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
origin: skylot/jadx

public void setLocationAndPosition() {
  if (this.settings.loadWindowPos(this)) {
    return;
  }
  GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
  DisplayMode mode = gd.getDisplayMode();
  int w = mode.getWidth();
  int h = mode.getHeight();
  setLocation((int) (w * BORDER_RATIO), (int) (h * BORDER_RATIO));
  setSize((int) (w * WINDOW_RATIO), (int) (h * WINDOW_RATIO));
}
origin: skylot/jadx

public static void registerBundledFonts() {
  GraphicsEnvironment grEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
  if (Utils.FONT_HACK != null) {
    grEnv.registerFont(Utils.FONT_HACK);
  }
}
origin: libgdx/libgdx

public <K> K getCurrentCard(Container container){
  Component c[] = container.getComponents();
  int i = 0;
  int j = c.length;
  while (i < j) {
    if (c[i].isVisible()) {
      return (K)c[i];
    }
    else
      i ++;
  }
  return null;
}
origin: libgdx/libgdx

void log (final String text) {
  EventQueue.invokeLater(new Runnable() {
    public void run () {
      ui.textArea.append(text + "\n");
      ui.textArea.setCaretPosition(ui.textArea.getDocument().getLength());
    }
  });
}
origin: libgdx/libgdx

public Node (int x, int y, int width, int height, Node leftChild, Node rightChild, String leaveName) {
  this.rect = new Rectangle(x, y, width, height);
  this.leftChild = leftChild;
  this.rightChild = rightChild;
  this.leaveName = leaveName;
}
origin: libgdx/libgdx

public static DisplayMode getDesktopDisplayMode () {
  GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice device = genv.getDefaultScreenDevice();
  java.awt.DisplayMode mode = device.getDisplayMode();
  return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(),
    mode.getBitDepth());
}
origin: libgdx/libgdx

protected static JFrame findJFrame (Component component) {
  Container parent = component.getParent();
  while (parent != null) {
    if (parent instanceof JFrame) {
      return (JFrame)parent;
    }
    parent = parent.getParent();
  }
  return null;
}
origin: libgdx/libgdx

public <K> K getCurrentCard(Container container){
  Component c[] = container.getComponents();
  int i = 0;
  int j = c.length;
  while (i < j) {
    if (c[i].isVisible()) {
      return (K)c[i];
    }
    else
      i ++;
  }
  return null;
}
origin: libgdx/libgdx

@Override
public void setCursorPosition (int x, int y) {
  if (robot != null) {
    robot.mouseMove(canvas.getLocationOnScreen().x + x, canvas.getLocationOnScreen().y + y);
  }
}
java.awt

Most used classes

  • Color
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • Dimension
    The Dimension class encapsulates the width and height of a component (in integer precision) in a sin
  • BufferedImage
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Graphics2D
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Font
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Container,
  • Rectangle,
  • Graphics,
  • Toolkit,
  • MouseEvent,
  • Component,
  • ActionEvent,
  • Insets,
  • Point,
  • GridBagLayout,
  • GridBagConstraints,
  • FontMetrics,
  • AffineTransform,
  • GridLayout
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