Example usage for javax.swing JComponent toString

List of usage examples for javax.swing JComponent toString

Introduction

In this page you can find the example usage for javax.swing JComponent toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of this component and its values.

Usage

From source file:org.feistymeow.dragdrop.DragonTransferHandler.java

@Override
protected void exportDone(JComponent source, Transferable data, int action) {
    logger.debug("exportDone: base got event for component " + source.toString());
}

From source file:org.springframework.richclient.layout.GridBagLayoutBuilder.java

private String getDebugString(Component component, GridBagConstraints gbc) {
    final StringBuffer buffer = new StringBuffer();

    if (component instanceof JComponent) {
        final JComponent jcomp = (JComponent) component;
        final String name = jcomp.getName();
        if (name != null && !"".equals(jcomp.getName())) {
            buffer.append(name);//from   w  w w  . ja v  a 2 s . c o m
        } else {
            if (jcomp instanceof JLabel) {
                buffer.append(((JLabel) jcomp).getText());
            } else {
                buffer.append(jcomp.toString());
            }
        }
    } else {
        buffer.append(component.toString());
    }

    buffer.append(", ");
    buffer.append("GridBagConstraint[");
    buffer.append("anchor=").append(gbc.anchor).append(",");
    buffer.append("fill=").append(gbc.fill).append(",");
    buffer.append("gridheight=").append(gbc.gridheight).append(",");
    buffer.append("gridwidth=").append(gbc.gridwidth).append(",");
    buffer.append("gridx=").append(gbc.gridx).append(",");
    buffer.append("gridy=").append(gbc.gridy).append(",");
    buffer.append("weightx=").append(gbc.weightx).append(",");
    buffer.append("weighty=").append(gbc.weighty).append("]");
    return buffer.toString();
}

From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java

public String getValue(String key) {

    JComponent c = getComponent(key);
    if (c instanceof JLabel) {
        // the text of the label may be truncated, use the tooltip instead
        return ((JLabel) c).getToolTipText();
    } else {/*from w  w  w . j  a v a2 s. com*/
        LOG.warn("WARNING: accessing string value of non-string label");
        return c.toString();
    }
}