本文整理了Java中javax.swing.JLabel.getWidth()
方法的一些代码示例,展示了JLabel.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.getWidth()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:getWidth
暂无
代码示例来源: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.getWidth(), label.getHeight(),
BufferedImage.TYPE_INT_ARGB);
代码示例来源: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
String labelText = "{W}"; //labelRender.getText(); // need same font size for all -- use max symbol ever, not current text
int stringWidth = labelRender.getFontMetrics(labelFont).stringWidth(labelText);
int componentWidth = labelRender.getWidth();
代码示例来源: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());
lblTableImage.setIcon(new ImageIcon(resizedTable));
代码示例来源:origin: org.swinglabs.swingx/swingx-core
@Override
public int getWidth() {
int retValue = super.getWidth();
if (painting) {
retValue = pWidth;
}
return retValue;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
@Override
public int getWidth() {
int retValue = super.getWidth();
if (painting) {
retValue = pWidth;
}
return retValue;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
@Override
public int getWidth() {
int retValue = super.getWidth();
if (painting) {
retValue = pWidth;
}
return retValue;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
@Override
public int getWidth() {
int retValue = super.getWidth();
if (painting) {
retValue = pWidth;
}
return retValue;
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
@Override
public int getWidth() {
int retValue = super.getWidth();
if (painting) {
retValue = pWidth;
}
return retValue;
}
代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client
public boolean isMouseXOverLabel(Point p) {
Point l = totalCount.getLocation();
if (p.x >= l.x && p.x <= (l.x + totalCount.getWidth())) {
return true;
}
return false;
}
}
代码示例来源:origin: stackoverflow.com
public class MyPanel extends JPanel {
JLabel label=...;
@Override
public Dimension getPreferredSize() {
return new Dimension(label.getWidth(),label.getHeight());
}
}
代码示例来源:origin: net.sf.taverna.t2.lang/partition
public static void main(String[] args) {
JLabel l = new JLabel("Foo");
System.out.println(l.getPreferredSize());
System.out.println(l.getWidth());
new UITest();
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = WIDTH_JSDOC)
@Override
public int getWidth() {
return super.getWidth();
}
代码示例来源:origin: stackoverflow.com
JLabel srcLabel = new JLabel();
JLabel dest = new JLabel();
BufferedImage img = new BufferedImage(srcLabel.getWidth(), srcLabel.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = img.createGraphics();
srcLabel.printAll(g2d);
g2d.dispose();
dest.setIcon(new ImageIcon(img));
代码示例来源:origin: com.jidesoft/jide-oss
private void setStatus(String message, Icon icon) {
_statusLabel.setIcon(icon);
_statusLabel.setText(message);
_statusLabel.setToolTipText(message);
if (!_statusLabel.isShowing() || _statusLabel.getWidth() < 25) {
showMessage(message);
}
}
代码示例来源:origin: RPTools/maptool
public int getHeight() {
if ((painting) && (isRotated()))
return super.getWidth();
return super.getHeight();
}
代码示例来源:origin: freeplane/freeplane
private void paintPageIndex() {
pageNumber.setText(getPageIndexText());
pageNumber.paintImmediately(0, 0, pageNumber.getWidth(), pageNumber.getHeight());
}
}
代码示例来源:origin: stackoverflow.com
public boolean intersects(JLabel testa, JLabel testb){
Rectangle rectB = testb.getBounds();
Rectangle result = SwingUtilities.computeIntersection(testa.getX(), testa.getY(), testa.getWidth(), testa.getHeight(), rectB);
return (result.getWidth() > 0 && result.getHeight() > 0);
}
代码示例来源:origin: google/sagetv
public void paint(java.awt.Graphics g)
{
super.paint(g);
java.awt.Color og = g.getColor();
g.setColor(inSuspension ? java.awt.Color.red :
(suspendExecution ? java.awt.Color.yellow : java.awt.Color.green));
g.fillOval(conl.getWidth() - conl.getHeight() - 3, 3, conl.getHeight() - 6, conl.getHeight() - 6);
g.setColor(og);
}
};
内容来源于网络,如有侵权,请联系作者删除!