javax.swing.JLabel.setMinimumSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(319)

本文整理了Java中javax.swing.JLabel.setMinimumSize()方法的一些代码示例,展示了JLabel.setMinimumSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setMinimumSize()方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setMinimumSize

JLabel.setMinimumSize介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

private JPanel createMiddlePanel() {
  middlePanel = new JPanel(new CardLayout());
  JPanel usageExplanationPanel = new JPanel(new BorderLayout(5, 5));
  ImageIcon usageExplanationIcon = new ImageIcon(getClass().getResource(solutionPanel.getUsageExplanationPath()));
  JLabel usageExplanationLabel = new JLabel(usageExplanationIcon);
  // Allow splitPane divider to be moved to the right
  usageExplanationLabel.setMinimumSize(new Dimension(100, 100));
  usageExplanationPanel.add(usageExplanationLabel, BorderLayout.CENTER);
  JPanel descriptionPanel = new JPanel(new BorderLayout(2, 2));
  descriptionPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  descriptionPanel.add(new JLabel("Example description"), BorderLayout.NORTH);
  JTextArea descriptionTextArea = new JTextArea(8, 70);
  descriptionTextArea.setEditable(false);
  descriptionTextArea.setText(solutionBusiness.getAppDescription());
  descriptionPanel.add(new JScrollPane(descriptionTextArea,
      JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
  usageExplanationPanel.add(descriptionPanel, BorderLayout.SOUTH);
  middlePanel.add(usageExplanationPanel, "usageExplanationPanel");
  JComponent wrappedSolutionPanel;
  if (solutionPanel.isWrapInScrollPane()) {
    wrappedSolutionPanel = new JScrollPane(solutionPanel);
  } else {
    wrappedSolutionPanel = solutionPanel;
  }
  middlePanel.add(wrappedSolutionPanel, "solutionPanel");
  return middlePanel;
}

代码示例来源:origin: runelite/runelite

topContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
icon.setMinimumSize(new Dimension(36, 32));

代码示例来源:origin: runelite/runelite

UICombinedActionSlot(SpriteManager spriteManager)
{
  setLayout(new BorderLayout());
  setBackground(ColorScheme.DARKER_GRAY_COLOR);
  setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
  JLabel uiIcon = new JLabel();
  uiIcon.setBorder(new EmptyBorder(0, 0, 0, 5));
  spriteManager.addSpriteTo(uiIcon, 582, 0);
  uiIcon.setMinimumSize(ICON_SIZE);
  uiIcon.setMaximumSize(ICON_SIZE);
  uiIcon.setPreferredSize(ICON_SIZE);
  uiIcon.setHorizontalAlignment(JLabel.CENTER);
  add(uiIcon, BorderLayout.LINE_START);
  JPanel uiInfo = new JPanel(new GridLayout(2, 1));
  uiInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
  uiLabelTitle = new JShadowedLabel("No Action Selected");
  uiLabelTitle.setForeground(Color.WHITE);
  uiLabelActions = new JShadowedLabel("Shift-click to select multiple");
  uiLabelActions.setFont(FontManager.getRunescapeSmallFont());
  uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
  uiInfo.add(uiLabelTitle);
  uiInfo.add(uiLabelActions);
  add(uiInfo, BorderLayout.CENTER);
}

代码示例来源:origin: igniterealtime/Smack

label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(
label.setMinimumSize(new java.awt.Dimension(150, 14));
label.setMaximumSize(new java.awt.Dimension(150, 14));
connPanel.add(

代码示例来源:origin: runelite/runelite

iconLabel.setMinimumSize(new Dimension(36, 32));
itemManager.getImage(tab.getItemID()).addTo(iconLabel);
add(iconLabel, BorderLayout.WEST);

代码示例来源:origin: runelite/runelite

uiIcon.setMinimumSize(ICON_SIZE);
uiIcon.setMaximumSize(ICON_SIZE);
uiIcon.setPreferredSize(ICON_SIZE);

代码示例来源:origin: geotools/geotools

/**
   * Checks the current label width against its minimum width and, if the current width is larger,
   * adjusts the minimum to prevent the label growing and shrinking as the cursor is moved.
   */
  private void ensureMinLabelWidth() {
    Dimension minDim = label.getMinimumSize();
    Dimension curDim = label.getSize();

    if (curDim.width > minDim.width) {
      label.setMinimumSize(new Dimension(curDim.width, minDim.height));
    }
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Sets the minimum width of the coordinate display label and the format string used to print
 * values.
 */
private void setLabelSizeAndFormat() {
  int minLabelWidth = getStringWidth();
  Dimension labelSize = label.getSize();
  if (labelSize.width < minLabelWidth) {
    label.setMinimumSize(new Dimension(minLabelWidth, labelSize.height));
    revalidate();
  }
  StringBuilder sb = new StringBuilder();
  sb.append("%").append(intLen).append(".").append(decLen).append("f, ");
  sb.append("%").append(intLen).append(".").append(decLen).append("f");
  numFormat = sb.toString();
}

代码示例来源:origin: nodebox/nodebox

/**
 * Add a header label that cannot be selected.
 *
 * @param s the name of the header.
 */
public void addHeader(String s) {
  JLabel header = new JLabel(s);
  header.setForeground(Theme.TEXT_HEADER_COLOR);
  header.setFont(Theme.SMALL_BOLD_FONT);
  header.setMinimumSize(new Dimension(100, 25));
  header.setMaximumSize(new Dimension(500, 25));
  header.setPreferredSize(new Dimension(140, 25));
  header.setAlignmentX(JComponent.LEFT_ALIGNMENT);
  header.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
  add(header);
}

代码示例来源:origin: magefree/mage

private void setGUISize() {
  Font font = GUISizeHelper.gameRequestsFont;
  lblText.setFont(font);
  lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
  lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
  lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
  btn1.setFont(font);
  btn1.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn1.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn1.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn2.setFont(font);
  btn2.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn2.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn2.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn3.setFont(font);
  btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  JComponent c = ((BasicInternalFrameUI) this.getUI()).getNorthPane();
  c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
  c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
  c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
  c.setFont(font);
}

代码示例来源:origin: nodebox/nodebox

experimental.setMinimumSize(new Dimension(300, 20));
experimental.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
contentPanel.add(experimental);

代码示例来源:origin: geotools/geotools

renderLabel.setMinimumSize(
    new Dimension(
        busyIcon.getIconWidth() + insets.left + insets.right,

代码示例来源:origin: magefree/mage

lblText.setText("message to the user");
lblText.setMaximumSize(new java.awt.Dimension(1000, 500));
lblText.setMinimumSize(new java.awt.Dimension(400, 60));
lblText.setPreferredSize(new java.awt.Dimension(400, 60));

代码示例来源:origin: magefree/mage

lblForestIcon.setMinimumSize(new java.awt.Dimension(22, 20));
lblForestIcon.setPreferredSize(new java.awt.Dimension(22, 20));
lblIslandIcon.setMinimumSize(new java.awt.Dimension(22, 20));
lblIslandIcon.setPreferredSize(new java.awt.Dimension(22, 20));
lblMountainIcon.setMinimumSize(new java.awt.Dimension(22, 20));
lblMountainIcon.setPreferredSize(new java.awt.Dimension(22, 20));
lblPlainsIcon.setMinimumSize(new java.awt.Dimension(22, 20));
lblPlainsIcon.setPreferredSize(new java.awt.Dimension(22, 20));
lblSwampIcon.setMinimumSize(new java.awt.Dimension(22, 20));
lblSwampIcon.setPreferredSize(new java.awt.Dimension(22, 20));

代码示例来源:origin: nodebox/nodebox

public PortRow(NodeBoxDocument document, String portName, JComponent control) {
  this.document = document;
  this.portName = portName;
  addMouseListener(this);
  setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
  Dimension labelSize = new Dimension(PortView.LABEL_WIDTH, 16);
  Port port = getPort();
  label = new ShadowLabel(port.getDisplayLabel());
  if (! port.getDescription().isEmpty())
    label.setToolTipText(port.getName() + ": " + port.getDescription());
  else
    label.setToolTipText(port.getName());
  label.setBorder(null);
  label.setPreferredSize(labelSize);
  label.setMinimumSize(labelSize);
  this.control = control;
  control.setBorder(BorderFactory.createEmptyBorder(TOP_PADDING, 0, BOTTOM_PADDING, 0));
  popupMenu = new JPopupMenu();
  popupMenu.add(new RevertToDefaultAction());
  add(this.label);
  add(Box.createHorizontalStrut(10));
  add(this.control);
  add(Box.createHorizontalGlue());
  // Compensate for the popup button.
  add(Box.createHorizontalStrut(30));
  setBorder(Theme.PARAMETER_ROW_BORDER);
}

代码示例来源:origin: ron190/jsql-injection

this.labelPlaceholderResult.setMinimumSize(new Dimension(100, 0));

代码示例来源:origin: magefree/mage

txtPhase.setMinimumSize(new java.awt.Dimension(0, 16));
txtStep.setMinimumSize(new java.awt.Dimension(0, 16));
txtTurn.setMinimumSize(new java.awt.Dimension(0, 16));
txtActivePlayer.setMinimumSize(new java.awt.Dimension(0, 16));
txtPriority.setMinimumSize(new java.awt.Dimension(0, 16));

代码示例来源:origin: winder/Universal-G-Code-Sender

remainingRowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
remainingRowsLabel.setMaximumSize(null);
remainingRowsLabel.setMinimumSize(new java.awt.Dimension(106, 14));
remainingRowsLabel.setPreferredSize(new java.awt.Dimension(106, 14));
sentRowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
sentRowsLabel.setMaximumSize(null);
sentRowsLabel.setMinimumSize(new java.awt.Dimension(106, 14));
sentRowsLabel.setPreferredSize(new java.awt.Dimension(106, 14));
rowsLabel.setText("Rows In File:");
rowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
rowsLabel.setMinimumSize(new java.awt.Dimension(106, 14));
rowsLabel.setPreferredSize(new java.awt.Dimension(106, 14));

代码示例来源:origin: stackoverflow.com

URL url = new URL("http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Morus_bassanus_adu.jpg/50px-Morus_bassanus_adu.jpg");
       BufferedImage image = ImageIO.read(url);        
       JLabel label = new JLabel(new ImageIcon(image));
       label.setMinimumSize(new Dimension(200,200));
       this.add(label);

代码示例来源:origin: stackoverflow.com

final JLabel label = ...
...
label.setText("prototype text to define size");
final Dimension size = label.getPreferredSize();
label.setMinimumSize(size);
label.setPreferredSize(size);
...
label.setText(...);

相关文章

JLabel类方法