コード例 #1
0
  public void paint(final Graphics g, final JComponent c) {
    JComponent component = tooltip.getComponent();
    if (component != null && component.isEnabled() || backgroundInactiveColor == null) {
      g.setColor(tooltip.getBackground());
      LookAndFeel.installBorder(c, "ToolTip.border");
    } else {
      g.setColor(backgroundInactiveColor);
      LookAndFeel.installBorder(c, "ToolTip.borderInactive");
    }
    g.fillRect(0, 0, tooltip.getWidth(), tooltip.getHeight());

    String tipText = tooltip.getTipText();
    FontMetrics fm = Utilities.getFontMetrics(tooltip);
    Dimension stringSize = Utilities.getStringSize(tipText, fm);
    int textX =
        component instanceof AbstractButton && ((AbstractButton) component).getMnemonic() != 0
            ? 4
            : (tooltip.getWidth() - stringSize.width) / 2;
    int textY = fm.getAscent();
    Color foreground =
        component != null && component.isEnabled() || foregroundInactiveColor == null
            ? tooltip.getForeground()
            : foregroundInactiveColor;
    Utilities.drawString(g, tipText, textX, textY, fm, foreground, -1);
  }
コード例 #2
0
 /** Sets whether this JInternalFrame is to use a palette border or not */
 public void setPalette(boolean isPalette) {
   if (isPalette) {
     LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
   } else {
     LookAndFeel.installBorder(frame, "InternalFrame.border");
   }
   titlePane.setPalette(isPalette);
 }
コード例 #3
0
 /**
  * Sets the frame type according to the specified type constant. This must be one of the
  * SwingConstants.
  */
 private void setFrameType(String frameType) {
   if (frameType.equals(OPTION_DIALOG)) {
     LookAndFeel.installBorder(frame, "InternalFrame.optionDialogBorder");
     titlePane.setPalette(false);
   } else if (frameType.equals(PALETTE_FRAME)) {
     LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
     titlePane.setPalette(true);
   } else {
     LookAndFeel.installBorder(frame, "InternalFrame.border");
     titlePane.setPalette(false);
   }
 }
コード例 #4
0
  protected void installDefaults(final JComponent c) {
    LookAndFeel.installColorsAndFont(c, "ToolTip.background", "ToolTip.foreground", "ToolTip.font");
    LookAndFeel.installBorder(c, "ToolTip.border");

    backgroundInactiveColor = UIManager.getColor("ToolTip.backgroundInactive");
    foregroundInactiveColor = UIManager.getColor("ToolTip.foregroundInactive");
  }
コード例 #5
0
 /** Connection Editor creating new Connection */
 public CConnectionEditor() {
   super();
   setName("ConnectionEditor");
   CConnectionEditor_MouseListener ml = new CConnectionEditor_MouseListener();
   //  Layout
   m_text.setEditable(false);
   m_text.setBorder(null);
   m_text.addMouseListener(ml);
   m_server.setIcon(new ImageIcon(getClass().getResource("Server16.gif")));
   m_server.setFocusable(false);
   m_server.setBorder(null);
   m_server.setOpaque(true);
   m_server.addMouseListener(ml);
   m_db.setIcon(new ImageIcon(getClass().getResource("Database16.gif")));
   m_db.setFocusable(false);
   m_db.setBorder(null);
   m_db.setOpaque(true);
   m_db.addMouseListener(ml);
   LookAndFeel.installBorder(this, "TextField.border");
   //
   setLayout(new BorderLayout(0, 0));
   add(m_server, BorderLayout.WEST);
   add(m_text, BorderLayout.CENTER);
   add(m_db, BorderLayout.EAST);
 } //  CConnectionEditor
コード例 #6
0
 /** Installs the default colors, border, and painter of the task pane container. */
 protected void installDefaults() {
   LookAndFeel.installColors(
       taskPane, "TaskPaneContainer.background", "TaskPaneContainer.foreground");
   LookAndFeel.installBorder(taskPane, "TaskPaneContainer.border");
   LookAndFeelAddons.installBackgroundPainter(taskPane, "TaskPaneContainer.backgroundPainter");
   LookAndFeel.installProperty(taskPane, "opaque", Boolean.TRUE);
 }
コード例 #7
0
  protected void installDefaults(AbstractButton b) {
    // load shared instance defaults
    String pp = getPropertyPrefix();

    defaultTextShiftOffset = UIManager.getInt(pp + "textShiftOffset");

    // set the following defaults on the button
    if (b.isContentAreaFilled()) {
      LookAndFeel.installProperty(b, "opaque", Boolean.TRUE);
    } else {
      LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
    }

    if (b.getMargin() == null || (b.getMargin() instanceof UIResource)) {
      b.setMargin(UIManager.getInsets(pp + "margin"));
    }

    LookAndFeel.installColorsAndFont(b, pp + "background", pp + "foreground", pp + "font");
    LookAndFeel.installBorder(b, pp + "border");

    Object rollover = UIManager.get(pp + "rollover");
    if (rollover != null) {
      LookAndFeel.installProperty(b, "rolloverEnabled", rollover);
    }

    LookAndFeel.installProperty(b, "iconTextGap", new Integer(4));
  }
コード例 #8
0
 protected void installDefaults() {
   LookAndFeel.installColorsAndFont(
       optionPane, "OptionPane.background", "OptionPane.foreground", "OptionPane.font");
   LookAndFeel.installBorder(optionPane, "OptionPane.border");
   minimumSize = UIManager.getDimension("OptionPane.minimumSize");
   LookAndFeel.installProperty(optionPane, "opaque", Boolean.TRUE);
 }
コード例 #9
0
  /** Installs the appropriate <code>Border</code> onto the <code>JRootPane</code>. */
  void installBorder(JRootPane root) {
    int style = root.getWindowDecorationStyle();

    if (style == JRootPane.NONE) {
      LookAndFeel.uninstallBorder(root);
    } else {
      LookAndFeel.installBorder(root, borderKeys[style]);
    }
  }
コード例 #10
0
 protected void installDefaults() {
   LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE);
   LookAndFeel.installBorder(progressBar, "ProgressBar.border");
   LookAndFeel.installColorsAndFont(
       progressBar, "ProgressBar.background", "ProgressBar.foreground", "ProgressBar.font");
   cellLength = UIManager.getInt("ProgressBar.cellLength");
   if (cellLength == 0) cellLength = 1;
   cellSpacing = UIManager.getInt("ProgressBar.cellSpacing");
   selectionForeground = UIManager.getColor("ProgressBar.selectionForeground");
   selectionBackground = UIManager.getColor("ProgressBar.selectionBackground");
 }
コード例 #11
0
  /** This method installs the defaults as specified by the look and feel. */
  protected void installDefaults() {
    LookAndFeel.installBorder(toolBar, "ToolBar.border");
    LookAndFeel.installColorsAndFont(
        toolBar, "ToolBar.background", "ToolBar.foreground", "ToolBar.font");

    dockingBorderColor = UIManager.getColor("ToolBar.dockingForeground");
    dockingColor = UIManager.getColor("ToolBar.dockingBackground");

    floatingBorderColor = UIManager.getColor("ToolBar.floatingForeground");
    floatingColor = UIManager.getColor("ToolBar.floatingBackground");
  }
コード例 #12
0
 private void setFrameType(String frameType) {
   String key;
   boolean hasPalette = frameType.equals(PALETTE_FRAME);
   if (frameType.equals(OPTION_DIALOG)) {
     key = "InternalFrame.optionDialogBorder";
   } else if (hasPalette) {
     key = "InternalFrame.paletteBorder";
   } else {
     key = "InternalFrame.border";
   }
   LookAndFeel.installBorder(frame, key);
   titlePane.setPalette(hasPalette);
 }
コード例 #13
0
ファイル: PlasticToolBarUI.java プロジェクト: srnsw/xena
 /**
  * Installs a special border, if either a look-dependent <code>BorderStyle</code> or a
  * look-independent <code>HeaderStyle</code> has been specified. A look specific <code>BorderStyle
  * </code> shadows a <code>HeaderStyle</code>.
  *
  * <p>Specifying a <code>HeaderStyle</code> is recommend.
  */
 private void installSpecialBorder() {
   String suffix;
   BorderStyle borderStyle = BorderStyle.from(toolBar, PlasticLookAndFeel.BORDER_STYLE_KEY);
   if (borderStyle == BorderStyle.EMPTY) suffix = "emptyBorder";
   else if (borderStyle == BorderStyle.ETCHED) suffix = "etchedBorder";
   else if (borderStyle == BorderStyle.SEPARATOR) suffix = "separatorBorder";
   else {
     HeaderStyle headerStyle = HeaderStyle.from(toolBar);
     if (headerStyle == HeaderStyle.BOTH) suffix = "headerBorder";
     else if (headerStyle == HeaderStyle.SINGLE && is3D()) suffix = "etchedBorder";
     else suffix = "border";
   }
   LookAndFeel.installBorder(toolBar, PROPERTY_PREFIX + suffix);
 }
コード例 #14
0
  protected void installDefaults() {
    // Note: Omitting the following line was a bug from v1.3.01 until v1.3.04
    // Note: The following method turned out to be new in 1.5. Therefore
    // replaced with progressBar.setOpaque(true)
    // LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE);

    // removed again in 1.3.7 (because opaque progress bar
    // fills bounds with track [background] color)
    // progressBar.setOpaque(true);

    LookAndFeel.installBorder(progressBar, "ProgressBar.border");
    LookAndFeel.installColorsAndFont(
        progressBar, "ProgressBar.background", "ProgressBar.foreground", "ProgressBar.font");
  }
コード例 #15
0
ファイル: VLocator.java プロジェクト: metasfresh/metasfresh
  /**
   * Constructor
   *
   * @param columnName ColumnName
   * @param mandatory mandatory
   * @param isReadOnly read only
   * @param isUpdateable updateable
   * @param mLocator locator (lookup) model
   * @param WindowNo window no
   */
  public VLocator(
      String columnName,
      boolean mandatory,
      boolean isReadOnly,
      boolean isUpdateable,
      MLocatorLookup mLocator,
      int WindowNo) {
    super();
    super.setName(columnName);
    m_columnName = columnName;
    m_mLocator = mLocator;
    m_WindowNo = WindowNo;
    //
    LookAndFeel.installBorder(this, "TextField.border");
    this.setLayout(new BorderLayout());

    //
    // Text
    VEditorUtils.setupInnerTextComponentUI(m_text);
    m_text.setEditable(true);
    m_text.setFocusable(true);
    m_text.addActionListener(this);
    this.add(m_text, BorderLayout.CENTER);

    //
    // Button
    {
      m_button = VEditorUtils.createActionButton("Locator", m_text);
      m_button.addActionListener(this);
      VEditorDialogButtonAlign.addVEditorButtonUsingBorderLayout(getClass(), this, m_button);
    }

    //
    // Size
    VEditorUtils.setupVEditorDimensionFromInnerTextDimension(this, m_text);

    //	ReadWrite
    if (isReadOnly || !isUpdateable) setReadWrite(false);
    else setReadWrite(true);
    setMandatory(mandatory);

    setDefault_Locator_ID(); // set default locator, teo_sarca [ 1661546 ]

    //
    // Create and bind the context menu
    new EditorContextPopupMenu(this);
  } //	VLocator
コード例 #16
0
  /**
   * Tells the look and feel to reset some of the values for this component so that it doesn't use
   * JTextArea's default values.
   *
   * <p>DO NOT CALL THIS METHOD YOURSELF!
   */
  public void updateUI() {
    super.updateUI();
    // setLineWrap(true);
    setWrapStyleWord(true);
    setHighlighter(null);
    setEditable(false);
    LookAndFeel.installBorder(this, "Label.border");
    LookAndFeel.installColorsAndFont(this, "Label.background", "Label.foreground", "Label.font");
    if (resizeHandler != null) {
      resizeHandler.componentResized(null);
    }

    // update restricted size
    SizePolicy policy = (SizePolicy) getClientProperty(SizePolicy.class);
    if (policy != null) {
      GUIUtils.restrictSize(this, policy);
    }
  }
コード例 #17
0
ファイル: VNumber.java プロジェクト: kimhatrung/Adempiere
  /**
   * Create right aligned Number field. no popup, if WindowNo == 0 (for IDs)
   *
   * @param columnName column name
   * @param mandatory mandatory
   * @param isReadOnly read only
   * @param isUpdateable updateable
   * @param displayType display type
   * @param title title
   */
  public VNumber(
      String columnName,
      boolean mandatory,
      boolean isReadOnly,
      boolean isUpdateable,
      int displayType,
      String title) {
    super();
    super.setName(columnName);
    m_columnName = columnName;
    m_title = title;
    setDisplayType(displayType);
    //
    LookAndFeel.installBorder(this, "TextField.border");
    this.setLayout(new BorderLayout());

    //	***	Text	***
    m_text.setBorder(null);
    m_text.setHorizontalAlignment(JTextField.TRAILING);
    m_text.addKeyListener(this);
    m_text.addFocusListener(this);
    //	Background
    setMandatory(mandatory);
    this.add(m_text, BorderLayout.CENTER);

    //	***	Button	***
    m_button.setIcon(Env.getImageIcon("Calculator10.gif"));
    m_button.setMargin(new Insets(0, 0, 0, 0));
    m_button.setFocusable(false);
    m_button.addActionListener(this);
    this.add(m_button, BorderLayout.EAST);

    //  Size
    setColumns(SIZE, 0);
    //	ReadWrite
    if (isReadOnly || !isUpdateable) setReadWrite(false);
    else setReadWrite(true);

    m_text.addMouseListener(new VNumber_mouseAdapter(this));
  } //	VNumber
コード例 #18
0
  /**
   * Create Resource Assigment.
   *
   * <pre>
   * 		Resource DateTimeFrom Qty UOM Button
   *  </pre>
   *
   * @param mandatory mandatory
   * @param isReadOnly read only
   * @param isUpdateable updateable
   */
  public VAssignment(boolean mandatory, boolean isReadOnly, boolean isUpdateable) {
    super();
    //	super.setName(columnName);
    LookAndFeel.installBorder(this, "TextField.border");
    this.setLayout(new BorderLayout());
    //  Size
    this.setPreferredSize(m_text.getPreferredSize());
    int height = m_text.getPreferredSize().height;

    //	***	Text	***
    m_text.setEditable(false);
    m_text.setFocusable(false);
    m_text.setBorder(null);
    m_text.setHorizontalAlignment(JTextField.LEADING);
    //	Background
    setMandatory(mandatory);
    this.add(m_text, BorderLayout.CENTER);

    //	***	Button	***
    m_button.setIcon(Env.getImageIcon("Assignment10.gif"));
    m_button.setMargin(new Insets(0, 0, 0, 0));
    m_button.setPreferredSize(new Dimension(height, height));
    m_button.addActionListener(this);
    m_button.setFocusable(true);
    this.add(m_button, BorderLayout.EAST);

    //	Prefereed Size
    this.setPreferredSize(this.getPreferredSize()); // 	causes r/o to be the same length
    //	ReadWrite
    if (isReadOnly || !isUpdateable) setReadWrite(false);
    else setReadWrite(true);

    //	Popup
    m_text.addMouseListener(new VAssignment_mouseAdapter(this));
    menuEditor =
        new CMenuItem(Msg.getMsg(Env.getCtx(), "InfoResource"), Env.getImageIcon("Zoom16.gif"));
    menuEditor.addActionListener(this);
    popupMenu.add(menuEditor);
  } //	VAssignment
コード例 #19
0
 public void setPalette(boolean isPalette) {
   String key = isPalette ? "InternalFrame.paletteBorder" : "InternalFrame.border";
   LookAndFeel.installBorder(frame, key);
   titlePane.setPalette(isPalette);
 }
コード例 #20
0
 public void installDefaults() {
   super.installDefaults();
   LookAndFeel.installBorder(popupMenu, "PopupMenu.border");
 }
コード例 #21
0
 protected void installDefaults(JPanel p) {
   LookAndFeel.installColorsAndFont(p, "Panel.background", "Panel.foreground", "Panel.font");
   LookAndFeel.installBorder(p, "Panel.border");
   LookAndFeel.installProperty(p, "opaque", Boolean.TRUE);
 }