當前位置: 首頁>>代碼示例>>Java>>正文


Java JLabel.putClientProperty方法代碼示例

本文整理匯總了Java中javax.swing.JLabel.putClientProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java JLabel.putClientProperty方法的具體用法?Java JLabel.putClientProperty怎麽用?Java JLabel.putClientProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.putClientProperty方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAntialiasedColors

import javax.swing.JLabel; //導入方法依賴的package包/類
private static HashSet getAntialiasedColors(Object aaHint, int lcdContrast) {

        JLabel label = new JLabel("ABCD");
        label.setSize(label.getPreferredSize());
        label.putClientProperty(KEY_TEXT_ANTIALIASING, aaHint);
        label.putClientProperty(KEY_TEXT_LCD_CONTRAST, lcdContrast);

        int w = label.getWidth();
        int h = label.getHeight();

        BufferedImage buffImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = buffImage.createGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, w, h);
        label.paint(g);
        g.dispose();

        HashSet<Color> colors = new HashSet<>();

        for (int i = 0; i < w; i++) {
            for (int j = 0; j < h; j++) {
                Color color = new Color(buffImage.getRGB(i, j));
                colors.add(color);
            }
        }

        return colors;
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:bug6302464.java

示例2: createSimpleHeader

import javax.swing.JLabel; //導入方法依賴的package包/類
static JPanel createSimpleHeader(String caption) {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0D;
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.anchor = 17;
    JLabel lbHeadLine = new JLabel(caption);
    lbHeadLine.putClientProperty("com.rapidminer.ui.label.type", "header");
    panel.add(lbHeadLine, gbc);
    ++gbc.gridx;
    gbc.weightx = 0.0D;
    JLabel lbLogoIcon = new JLabel(HEADER_ICON);
    panel.add(lbLogoIcon, gbc);
    return panel;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:19,代碼來源:OnboardingDialog.java

示例3: switchCard

import javax.swing.JLabel; //導入方法依賴的package包/類
/**
 * If a card has the choosen attribute(so it is among the choosen ones) it
 * removes it from the list of the choosen cards and it adds it to the
 * selectable one. If the card hasn't that attribute it removes it from the
 * selectable ones and ot adds it to the choosen one; if the choosen cards
 * form a tris it is a valid one, it sets true the visibility of the button
 * <code>playTris</code>.
 *
 * @param label
 */
public void switchCard(JLabel label) {
    boolean chosen = (boolean) label.getClientProperty("chosen");
    if (chosen) {
        chosenCards.remove(label);
        cards.add(label);
        cardsPane.setLayer(label, -(getNrCards() - 1));

    } else {

        chosenCards.add(label);
        cards.remove(label);
        cardsPane.setLayer(label, -(getNrChosenCards() - 1));
    }
    if (checkOnTris(chosenCards)) {
        int bonus = game.getBonusForTris(getTrisAsString(chosenCards));
        playTris.setText("Gioca il tris. (" + bonus + ")");
        playTris.setVisible(true);
    } else {
        playTris.setVisible(false);
    }

    label.putClientProperty("chosen", !chosen);

}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-B,代碼行數:35,代碼來源:CardPanel.java

示例4: setText

import javax.swing.JLabel; //導入方法依賴的package包/類
public void setText(String cellName, String text, Coloring extraColoring, int importance) {
    JLabel cell = getCellByName(cellName);
    if (cell != null) {
        cell.setText(text);
        if (visible) {
            JTextComponent jtc = editorUI.getComponent();
            Coloring c = jtc != null ? getColoring(
                org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(jtc),
                FontColorNames.STATUS_BAR_COLORING
            ) : null;

            if (c != null && extraColoring != null) {
                c = extraColoring.apply(c);
            } else if (c == null) {
                c = extraColoring;
            }
            if (CELL_POSITION.equals(cellName)){
                cell.setToolTipText(caretPositionLocaleString);
            } else if (CELL_TYPING_MODE.equals(cellName)) {
                cell.setToolTipText(insText.equals(text)? insertModeLocaleString : overwriteModeLocaleString);
            } else {
                cell.setToolTipText(text == null || text.length() == 0 ? null : text);
            }

            if (c != null && cell instanceof Cell) {
                applyColoring((Cell) cell, c);
            }
        } else { // Status bar not visible => use global status bar if possible
            JLabel globalCell = cellName2GlobalCell.get(cellName);
            if (globalCell != null) {
                if (CELL_MAIN.equals(cellName)) {
                    globalCell.putClientProperty("importance", importance);
                }
                globalCell.setText(text);
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:StatusBar.java

示例5: setStyleProperties

import javax.swing.JLabel; //導入方法依賴的package包/類
public void setStyleProperties(JLabel renderer, TableCellStyle style) {
    if (style != null) {
        renderer.putClientProperty(PROPERTY_FORMAT, style.format); // NOI18N
        renderer.putClientProperty(PROPERTY_HIGHLIGHT_PATTERN, style.highlightPattern); // NOI18N
        ((JComponent) renderer).setToolTipText(style.tooltip);
        setRowColors(style, renderer);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:QueryTableCellRenderer.java

示例6: testFontRenderingContext

import javax.swing.JLabel; //導入方法依賴的package包/類
private static void testFontRenderingContext(Object aaHint) {

        JLabel label = new JLabel("Test");
        label.putClientProperty(KEY_TEXT_ANTIALIASING, aaHint);
        FontRenderContext frc = label.getFontMetrics(
                label.getFont()).getFontRenderContext();

        if (!aaHint.equals(frc.getAntiAliasingHint())) {
            throw new RuntimeException("Wrong aa hint in FontRenderContext");
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:bug6302464.java

示例7: getCustomEditor

import javax.swing.JLabel; //導入方法依賴的package包/類
public Component getCustomEditor() {
    JLabel result = new JLabel("Everything is exactly as it should be.  Relax.");
    result.putClientProperty("title","Don't panic");
    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:EditableDisplayerTest.java


注:本文中的javax.swing.JLabel.putClientProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。