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

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

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

JLabel.setIconTextGap介绍

暂无

代码示例

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

private JPanel makeSkillPanel(HiscoreSkill skill)
{
  JLabel label = new JLabel();
  label.setFont(FontManager.getRunescapeSmallFont());
  label.setText("--");
  String skillName = (skill == null ? "combat" : skill.getName().toLowerCase());
  String directory = "/skill_icons";
  if (skillName.equals("combat") || skillName.equals("overall"))
  {
    // Cannot use SpriteManager as HiscorePlugin loads before a Client is available
    directory += "/";
  }
  else
  {
    directory += "_small/";
  }
  String skillIcon = directory + skillName + ".png";
  log.debug("Loading skill icon from {}", skillIcon);
  label.setIcon(new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), skillIcon)));
  boolean totalLabel = skill == HiscoreSkill.OVERALL || skill == null; //overall or combat
  label.setIconTextGap(totalLabel ? 10 : 4);
  JPanel skillPanel = new JPanel();
  skillPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
  skillPanel.setBorder(new EmptyBorder(2, 0, 2, 0));
  skillLabels.add(label);
  skillPanel.add(skillLabels.get(skillLabels.size() - 1));
  return skillPanel;
}

代码示例来源:origin: redwarp/9-Patch-Resizer

public AboutDialog(JFrame parent) {
  this.setResizable(false);
  this.setSize(new Dimension(400, 250));
  this.getContentPane().setLayout(new BorderLayout(0, 0));
  JLabel lblResizer = new JLabel(Localization.get("app_name") + " "
      + Configuration.getVersion());
  lblResizer.setBorder(new EmptyBorder(10, 10, 10, 10));
  lblResizer.setVerticalTextPosition(SwingConstants.BOTTOM);
  lblResizer.setIconTextGap(10);
  lblResizer.setFont(lblResizer.getFont().deriveFont(
      lblResizer.getFont().getStyle() | Font.BOLD, 16f));
  lblResizer.setIcon(new ImageIcon(AboutDialog.class
      .getResource("/img/icon_64.png")));
  this.getContentPane().add(lblResizer, BorderLayout.NORTH);
  JTextArea txtrResizerIsA = new JTextArea();
  txtrResizerIsA.setEditable(false);
  txtrResizerIsA.setWrapStyleWord(true);
  txtrResizerIsA.setBorder(new EmptyBorder(0, 10, 10, 10));
  txtrResizerIsA.setFont(UIManager.getFont("Label.font"));
  txtrResizerIsA.setLineWrap(true);
  txtrResizerIsA.setText(Localization.get("about_text"));
  txtrResizerIsA.setBackground(new Color(0, 0, 0, 0));
  this.getContentPane().add(txtrResizerIsA, BorderLayout.CENTER);
  this.setLocationRelativeTo(parent);
}

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

private void setTabTitle(int tabIndex, String title, String iconResourceName) {
  // tab caption with left sided icon
  // https://stackoverflow.com/questions/1782224/jtabbedpane-icon-on-left-side-of-tabs
  JLabel lbl = new JLabel(title);
  Icon icon = new ImageIcon(getClass().getResource(iconResourceName));
  lbl.setIcon(icon);
  lbl.setIconTextGap(5);
  lbl.setHorizontalTextPosition(SwingConstants.RIGHT);
  tabsList.setTabComponentAt(tabIndex, lbl);
}

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

);
this.labelTranslation.setIcon(language.getFlag());
this.labelTranslation.setIconTextGap(8);

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

table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {

  @Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (comp instanceof JLabel) {
      JLabel label = (JLabel)comp;
      label.setIconTextGap(0);
    }
    return comp;
  }

});

代码示例来源:origin: JetBrains/jediterm

@Override
public void setIconTextGap(int iconTextGap) {
 super.setIconTextGap(iconTextGap);
 if (myEditorPane != null) {
  updateLayout();
 }
}

代码示例来源:origin: xyz.cofe/gui.swing

@Override
public synchronized void setIconTextGap(int iconTextGap) {
  super.setIconTextGap(iconTextGap);
  Component cmpt = rendererComponent!=null ? rendererComponent.get() : null;
  if( cmpt instanceof JLabel ){
    ((JLabel)cmpt).setIconTextGap(iconTextGap);
  }
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public void setIconTextGap(int _itg)
{
 if((delegate_==this)||(delegate_==null))
  super.setIconTextGap(_itg);
 else
  delegate_.setIconTextGap(_itg);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setIconTextGap(int aValue) {
  super.setIconTextGap(aValue);
}

代码示例来源:origin: hmvictor/radar-netbeans

@Override
public Component getTableCellRendererComponent(JTable jtable, Object o, boolean bln, boolean bln1, int i, int i1) {
  JLabel component = (JLabel) super.getTableCellRendererComponent(jtable, o, bln, bln1, i, i1);
  component.setText(null);
  component.setIcon(((Classifier)o).getIcon());
  component.setIconTextGap(0);
  component.setBorder(null);
  return component; 
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

public void installUI(JComponent c) {
  plainPainter.setText(((Title)c).name);
  plainPainter.setIcon(collapsedIcon);
  plainPainter.setFont(plainFont);
  plainPainter.setIconTextGap(5);
  boldPainter.setText(((Title)c).name);
  boldPainter.setIcon(expandedIcon);
  boldPainter.setFont(boldFont);
  boldPainter.setIconTextGap(5);
  plainPainter.setSize(plainPainter.getPreferredSize());
  Dimension titlePreferredSize = boldPainter.getPreferredSize();
  boldPainter.setSize(titlePreferredSize);
  preferredSize = new Dimension(TITLE_X_OFFSET + titlePreferredSize.width,
                 titlePreferredSize.height + TITLE_Y_OFFSET * 2);
}

代码示例来源:origin: org.gephi/ui-components

@Override
public void installUI(JComponent c) {
  plainPainter.setText(((Title) c).name);
  plainPainter.setIcon(collapsedIcon);
  plainPainter.setFont(plainFont);
  plainPainter.setIconTextGap(5);
  boldPainter.setText(((Title) c).name);
  boldPainter.setIcon(expandedIcon);
  boldPainter.setFont(boldFont);
  boldPainter.setIconTextGap(5);
  plainPainter.setSize(plainPainter.getPreferredSize());
  Dimension titlePreferredSize = boldPainter.getPreferredSize();
  boldPainter.setSize(titlePreferredSize);
  preferredSize = new Dimension(TITLE_X_OFFSET + titlePreferredSize.width,
      titlePreferredSize.height + TITLE_Y_OFFSET * 2);
}

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

ImageIcon bg;

public Jadmin() {

  setSize(800,500);

  setDefaultCloseOperation(EXIT_ON_CLOSE);

  setUndecorated(true);

  setLocationRelativeTo(null);

  JLabel jl=new JLabel();

  bg = new ImageIcon("IMAGE_PATH");
  jl.setIcon(bg);
  jl.setIconTextGap(-IMAGE_WIDTH);
  jl.setOpaque(true);
  jl.setLayout(null);

  add(jl);

  jl.setText("hadsffffffffffffffffffi");

  setVisible(true);
enter code here
  }

代码示例来源:origin: martin-lizner/trezor-ssh-agent

private void addLabelArea() {
  labelPanel.setLayout(new GridLayout(3, 1));
  Border labelsPadding = BorderFactory.createEmptyBorder(0, 0, 15, 0);
  labelPanel.setBorder(labelsPadding);
  deviceLabel = new JLabel(AgentConstants.APP_PUBLIC_NAME.toUpperCase());
  Icon icon = new ImageIcon(TrayProcess.createImage(AgentConstants.ICON24_PATH, AgentConstants.ICON_DESCRIPTION));
  deviceLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
  deviceLabel.setIcon(icon);
  deviceLabel.setIconTextGap(10);
  deviceLabel.setFont(new Font(null, Font.BOLD, 15));
  passcodeLabel = new JLabel(LocalizedLogger.getLocalizedMessage("DIALOG_ENTER_PIN"));
  passcodeField = new JPasswordField(3);
  passcodeField.setEditable(false);
  passcodeField.setBackground(Color.white);
  labelPanel.add(deviceLabel, BorderLayout.NORTH);
  labelPanel.add(passcodeLabel, BorderLayout.CENTER);
  labelPanel.add(passcodeField, BorderLayout.SOUTH);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

public ServiceCellRenderer() {
  super();
  indicator.setHorizontalTextPosition(JLabel.LEFT);
  indicator.setIconTextGap(0);
  indicator.setText(" ");
  indicator.setOpaque(false);
  rowDescriptor.setOpaque(false);
  add(indicator, BorderLayout.WEST);
  add(rowDescriptor, BorderLayout.CENTER);
}

代码示例来源:origin: martin-lizner/trezor-ssh-agent

private void addInputArea() {
  labelPanel.setLayout(new GridLayout(3, 1));
  Border labelsPadding = BorderFactory.createEmptyBorder(0, 0, 15, 0);
  labelPanel.setBorder(labelsPadding);
  deviceLabel = new JLabel(AgentConstants.APP_PUBLIC_NAME.toUpperCase());
  Icon icon = new ImageIcon(TrayProcess.createImage(AgentConstants.ICON24_PATH, AgentConstants.ICON_DESCRIPTION));
  deviceLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
  deviceLabel.setIcon(icon);
  deviceLabel.setIconTextGap(10);
  deviceLabel.setFont(new Font(null, Font.BOLD, 15));
  passcodeLabel = new JLabel(LocalizedLogger.getLocalizedMessage("DIALOG_ENTER_PASSPHRASE"));
  passcodeField = new JPasswordField();
  passcodeField.requestFocusInWindow();
  passcodeField.setBackground(Color.white);
  labelPanel.add(deviceLabel, BorderLayout.NORTH);
  labelPanel.add(passcodeLabel, BorderLayout.CENTER);
  labelPanel.add(passcodeField, BorderLayout.SOUTH);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = CONSTRUCTOR_JSDOC, params = {"text", "icon", "iconTextGap"})
public Label(String aText, Icon aIcon, int aIconTextGap) {
  super(aText, aIcon, JLabel.LEFT);
  super.setIconTextGap(aIconTextGap);
  super.setHorizontalTextPosition(HorizontalPosition.RIGHT);
}

代码示例来源:origin: Killerardvark/CryodexSource

@Override
  public void addTab(String arg0, Icon arg1, Component arg2) {
    super.addTab(arg0, arg1, arg2);
    addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        MenuBar.getInstance().resetMenuBar();
      }
    });

    JLabel lbl = new JLabel(arg0);
    lbl.setIcon(arg1);

    lbl.setIconTextGap(5);
    lbl.setHorizontalTextPosition(SwingConstants.RIGHT);

    setTabComponentAt(getTabCount() - 1, lbl);
  }
}

代码示例来源:origin: org.terracotta.modules/tim-ehcache-2.x-ui

private CheckBoxRenderer() {
 super(new FlowLayout(FlowLayout.CENTER, 0, 0));
 add(checkBox = new JCheckBox());
 add(label = new JLabel());
 label.setIconTextGap(1);
 checkBox.setOpaque(false);
 checkBox.setMargin(new Insets(0, 0, 0, 0));
 setOpaque(false);
 setEnabled(true);
 setBorder(null);
}

代码示例来源:origin: jsettlers/settlers-remake

/**
 * Constructor
 * 
 * @param toolSidebar
 *            Sidebar with the tools
 * @param scrollTo
 *            Interface to scroll to position
 */
public Sidebar(ToolSidebar toolSidebar, IScrollToAble scrollTo) {
  this.toolSidebar = toolSidebar;
  this.errorSidebar = new ErrorSidebar(scrollTo);
  addTab(EditorLabels.getLabel("sidebar.tools"), toolSidebar);
  addTab("<errors>", errorSidebar);
  lbErrorHeader.setIconTextGap(5);
  lbErrorHeader.setHorizontalTextPosition(SwingConstants.RIGHT);
  setTabComponentAt(1, lbErrorHeader);
}

相关文章

JLabel类方法