本文整理了Java中javax.swing.JLabel.setSize()
方法的一些代码示例,展示了JLabel.setSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setSize()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setSize
暂无
代码示例来源:origin: gocd/gocd
+ "http://localhost:8153/go</a></html>");
aboutLabel[3].setFont(bodyFont);
aboutLabel[3].setSize(aboutLabel[3].getPreferredSize());
aboutLabel[3].addMouseListener(new LinkMouseListener());
aboutLabel[4] = new JLabel("");
代码示例来源:origin: kiegroup/optaplanner
employeeLabel.setToolTipText(employee.getToolText());
employeeLabel.setLocation(0, HEADER_ROW_HEIGHT + employeeIndex * ROW_HEIGHT);
employeeLabel.setSize(HEADER_COLUMN_WIDTH, ROW_HEIGHT);
employeeLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
add(employeeLabel);
timeLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
timeLabel.setLocation(x, 0);
timeLabel.setSize(TIME_COLUMN_WIDTH, ROW_HEIGHT);
add(timeLabel);
代码示例来源:origin: magefree/mage
private void drawOn(JPanel panel, String value) {
List<Image> images = new ArrayList<>();
value = value.toUpperCase(Locale.ENGLISH);
for (int i = 0; i < value.length(); i++) {
char symbol = value.charAt(i);
Image image = ManaSymbols.getSizedManaSymbol(String.valueOf(symbol));
if (image != null) {
images.add(image);
}
}
if (images.size() == value.length()) {
int dx = 0;
for (Image image : images) {
ImageIcon icon = new ImageIcon(image);
JLabel imageLabel = new JLabel();
imageLabel.setSize(11, 11);
imageLabel.setLocation(dx, 0);
imageLabel.setIcon(icon);
panel.add(imageLabel);
dx += 13;
}
} else {
String s = value.replace("B", "{B}").replace("R", "{R}").replace("G", "{G}").replace("W", "{W}").replace("U", "{U}").replace("X", "{X}");
panel.add(new JLabel(s));
}
}
}
代码示例来源:origin: RaiMan/SikuliX2
@Override
public void updateComponent() {
String htmltxt = "<html><div style='" + getStyleString() + "'>"
+ text + "</div></html>";
label.setText(htmltxt);
Dimension size = label.getPreferredSize();
if (size.width > maxWidth) {
// hack to limit the width of the text to width
htmltxt = "<html><div style='width:" + maxWidth + ";" + getStyleString() + "'>"
+ text + "</div></html>";
label.setText(htmltxt);
size = label.getPreferredSize();
}
label.setSize(size);
setActualSize(size);
}
代码示例来源:origin: apache/pdfbox
private void addImage(Image img)
{
// for JDK9; see explanation in PagePane
AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform();
label.setSize((int) Math.ceil(img.getWidth(null) / tx.getScaleX()),
(int) Math.ceil(img.getHeight(null) / tx.getScaleY()));
label.setIcon(new HighResolutionImageIcon(img, label.getWidth(), label.getHeight()));
label.revalidate();
}
代码示例来源:origin: stackoverflow.com
label.setSize(200, 120);
代码示例来源:origin: RaiMan/SikuliX2
@Override
public void setName(String name) {
if (label == null) {
super.setName(name);
this.label = new JLabel(name);
add(label);
}
label.setFont(new Font("sansserif", Font.BOLD, fontSize));
label.setForeground(colorText);
Dimension s = label.getPreferredSize();
label.setLocation((int) (PADDING_X/2), (int) (PADDING_Y/2));
label.setSize(s);
s.height += PADDING_Y;
s.width += PADDING_X;
setActualSize(s);
}
代码示例来源:origin: apache/pdfbox
@Override
protected void done()
{
try
{
BufferedImage image = get();
// We cannot use "label.setIcon(new ImageIcon(get()))" here
// because of blurry upscaling in JDK9. Instead, the label is now created with
// a smaller size than the image to compensate that the
// image is scaled up with some screen configurations (e.g. 125% on windows).
// See PDFBOX-3665 for more sample code and discussion.
label.setSize((int) Math.ceil(image.getWidth() / defaultTransform.getScaleX()),
(int) Math.ceil(image.getHeight() / defaultTransform.getScaleY()));
label.setIcon(new HighResolutionImageIcon(image, label.getWidth(), label.getHeight()));
label.setText(null);
}
catch (InterruptedException | ExecutionException e)
{
label.setText(e.getMessage());
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: magefree/mage
insertArrow.setSize(64, 64);
insertArrow.setLocation((cardWidth + GRID_PADDING) * col + GRID_PADDING / 2 - 32, curY);
} else {
insertArrow.setSize(64, 32);
insertArrow.setLocation((cardWidth + GRID_PADDING) * col + GRID_PADDING + cardWidth / 2 - 32, curY + stackInsertIndex * cardTopHeight - 32);
代码示例来源:origin: magefree/mage
countLabel.setText(String.valueOf(stack.size()));
countLabel.setLocation(GRID_PADDING + (cardWidth + GRID_PADDING) * colIndex, currentY - COUNT_LABEL_HEIGHT);
countLabel.setSize(cardWidth, COUNT_LABEL_HEIGHT);
countLabel.setVisible(true);
代码示例来源:origin: magefree/mage
labelRender.setSize(symbolWidth, symbolWidth);
labelRender.setVerticalAlignment(SwingConstants.CENTER);
labelRender.setHorizontalAlignment(SwingConstants.CENTER);
代码示例来源:origin: RaiMan/SikuliX2
titleBar.setOpaque(true);
titleBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
titleBar.setSize(titleBar.getPreferredSize());
titleBar.setVisible(false);
代码示例来源:origin: magefree/mage
int left = draftView.getPlayers().size() - right;
int height = left * 18;
lblTableImage.setSize(new Dimension(lblTableImage.getWidth(), height));
Image tableImage = ImageHelper.getImageFromResources(draftView.getBoosterNum() == 2 ? "/draft/table_left.png" : "/draft/table_right.png");
BufferedImage resizedTable = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(tableImage, BufferedImage.TYPE_INT_ARGB), lblTableImage.getWidth(), lblTableImage.getHeight());
代码示例来源:origin: magefree/mage
insertArrow.setSize(20, 20);
insertArrow.setVisible(false);
cardContent.add(insertArrow, new Integer(1000));
代码示例来源:origin: magefree/mage
timerLabel.setSize(80, 12);
timerLabel.setHorizontalAlignment(SwingConstants.CENTER);
代码示例来源:origin: RaiMan/SikuliX2
symbol.setFont(f);
Dimension size = symbol.getPreferredSize();
symbol.setSize(size);
symbol.setForeground(Color.white);
symbol.setLocation(region.x + region.w / 2 - size.width / 2,
代码示例来源:origin: org.ihtsdo/wb-api
@Override
public void setSize(Dimension d) {
if (lineWrapEnabled) {
if (d.height < wrapSize.height) {
d.height = wrapSize.height;
}
d.width = fixedWidth;
super.setSize(d);
} else {
super.setSize(d);
}
}
代码示例来源:origin: magefree/mage
minusCounterLabel.setSize(size, size);
plusCounterLabel.setSize(size, size);
loyaltyCounterLabel.setSize(size, size);
otherCounterLabel.setSize(size, size);
代码示例来源:origin: stackoverflow.com
//p.add(new JLabel(ico));
JLabel label = new JLabel(ico);
label.setSize( label.getPreferredSize());
label.setLocation(...);
p.add(label);
代码示例来源:origin: stackoverflow.com
JLabel labelBeingUsed = myLabel;
View view = (View) labelBeingUsed.getClientProperty(BasicHTML.propertyKey);
view.setSize(scrollPane1.getWidth(), 0.0f);
float w = view.getPreferredSpan(View.X_AXIS);
float h = view.getPreferredSpan(View.Y_AXIS);
labelBeingUsed.setSize((int) w, (int) h);
内容来源于网络,如有侵权,请联系作者删除!