本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
}
示例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");
}
}
示例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;
}