Java Code Examples for java.awt.Label#RIGHT
The following examples show how to use
java.awt.Label#RIGHT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SurfacePlot.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Draws string at the specified coordinates with the specified alignment. * * @param g graphics context to draw * @param x the x coordinate * @param y the y coordinate * @param s the string to draw * @param x_align the alignment in x direction * @param y_align the alignment in y direction */ private final void outString(Graphics g, int x, int y, String s, int x_align, int y_align) { if((s==null)||s.trim().equals("")) { //$NON-NLS-1$ return; } switch(y_align) { case TOP : y += g.getFontMetrics(g.getFont()).getAscent(); break; case CENTER : y += g.getFontMetrics(g.getFont()).getAscent()/2; break; } switch(x_align) { case Label.LEFT : g.drawString(s, x, y); break; case Label.RIGHT : g.drawString(s, x-g.getFontMetrics(g.getFont()).stringWidth(s), y); break; case Label.CENTER : g.drawString(s, x-g.getFontMetrics(g.getFont()).stringWidth(s)/2, y); break; } }
Example 2
Source File: ComplexSurfacePlot.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Draws string at the specified coordinates with the specified alignment. * * @param g graphics context to draw * @param x the x coordinate * @param y the y coordinate * @param s the string to draw * @param x_align the alignment in x direction * @param y_align the alignment in y direction */ private final void outString(Graphics g, int x, int y, String s, int x_align, int y_align) { switch(y_align) { case TOP : y += g.getFontMetrics(g.getFont()).getAscent(); break; case CENTER : y += g.getFontMetrics(g.getFont()).getAscent()/2; break; } switch(x_align) { case Label.LEFT : g.drawString(s, x, y); break; case Label.RIGHT : g.drawString(s, x-g.getFontMetrics(g.getFont()).stringWidth(s), y); break; case Label.CENTER : g.drawString(s, x-g.getFontMetrics(g.getFont()).stringWidth(s)/2, y); break; } }
Example 3
Source File: LWLabelPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 4
Source File: LWLabelPeer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 5
Source File: LWLabelPeer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 6
Source File: LWLabelPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 7
Source File: LWLabelPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 8
Source File: LWLabelPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 9
Source File: LWLabelPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 10
Source File: LWLabelPeer.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 11
Source File: LWLabelPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 12
Source File: LWLabelPeer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 13
Source File: LWLabelPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 14
Source File: LWLabelPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }
Example 15
Source File: LWLabelPeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Converts {@code Label} alignment constant to the {@code JLabel} constant. * If wrong Label alignment provided returns default alignment. * * @param alignment {@code Label} constant. * * @return {@code JLabel} constant. */ private static int convertAlignment(final int alignment) { switch (alignment) { case Label.CENTER: return SwingConstants.CENTER; case Label.RIGHT: return SwingConstants.RIGHT; default: return SwingConstants.LEFT; } }