Package org.beryl.gui.widgets

Examples of org.beryl.gui.widgets.Label


   * @return The result (RESULT_YES/RESULT_NO/RESULT_CANCEL)
   */
  public static int showYesNoCancelDialog(Frame frame, String title, String message) throws GUIException {
    YesNoCancelEventListener listener = new YesNoCancelEventListener();
    Dialog dialog = (Dialog) WidgetFactory.getInstance().constructWidget(DialogUtils.class, "YesNoCancelDialog", listener);
    Label label = (Label) dialog.getWidget("DialogCaption");
    label.setProperty("text", message);
    dialog.initDialog(frame);
    dialog.setProperty("title", title);
    dialog.show();
    return listener.getResult();
  }
View Full Code Here


    TableRow row,
    String key)
    throws GUIException {
    Color color = (Color) value;
    Panel panel = new Panel(null, null);
    Label label = new Label(panel, null);

    label.setProperty("opaque", Boolean.TRUE);
    label.setProperty("background", color);

    int lightness = (color.getRed() + color.getBlue() + color.getGreen()) / 3;

    if (lightness > 127)
      label.setProperty("foreground", Color.black);
    else
      label.setProperty("foreground", Color.white);

    label.setProperty(
      "text",
       toString(color));

    label.setProperty("horizontalAlignment", new Integer(JLabel.CENTER));
    label.setProperty("border", BorderFactory.createEmptyBorder(3, 3, 3, 3));
    panel.setProperty("layout", new BorderLayout());
    panel.addChild(label, BorderLayout.CENTER);
    return panel;
  }
View Full Code Here

    boolean hasFocus,
    TableRow row,
    String key)
    throws GUIException {

    Label label = new Label(null, null);
    ImageIcon icon = (ImageIcon) value;
    Image inImage = icon.getImage();

    /* Resize the image */
    double scale = (double) maxImageSize / (double) inImage.getHeight(null);

    if (inImage.getWidth(null) > inImage.getHeight(null)) {
      scale = (double) maxImageSize / (double) inImage.getWidth(null);
    }
    int scaledW = (int) (scale * inImage.getWidth(null));
    int scaledH = (int) (scale * inImage.getHeight(null));
    BufferedImage outImage = new BufferedImage(scaledW, scaledH, BufferedImage.TYPE_INT_RGB);
    AffineTransform tx = new AffineTransform();

    if (scale < 1.0d) {
      tx.scale(scale, scale);
    }

    Color bgColor = null;
    Graphics2D g2d = outImage.createGraphics();
    g2d.setColor(bgColor);
    g2d.fillRect(0, 0, scaledW, scaledH);
    g2d.drawImage(inImage, tx, null);
    g2d.dispose();

    label.setIcon(new ImageIcon(outImage));
    label.setProperty("horizontalAlignment", new Integer(JLabel.CENTER));
    label.setProperty("opaque", Boolean.TRUE);
    return label;
  }
View Full Code Here

      boolean isSelected,
      boolean hasFocus,
      TableRow row,
      String key)
      throws GUIException {
        Label label = new Label(null, null);
        label.setProperty("text", "["+value+"]");
        return label;
    }
View Full Code Here

      boolean isSelected,
      boolean hasFocus,
      TableRow row,
      String key)
      throws GUIException {
      Label label = new Label(null, null);
      if (value instanceof Dimension) {
        Dimension dimension = (Dimension) value;
        label.setProperty("text", (int) dimension.getWidth() + ", " + (int) dimension.getHeight());
      } else {
        Point point = (Point) value;
        label.setProperty("text", point.x + ", " + point.y);
      }

      return label;
    }
View Full Code Here

TOP

Related Classes of org.beryl.gui.widgets.Label

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.