javax.swing.JToggleButton.setPreferredSize()方法的使用及代码示例

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

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

JToggleButton.setPreferredSize介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

toggleButton.setPreferredSize(new Dimension(128, 128));

代码示例来源:origin: 4thline/cling

muteButton.setHorizontalTextPosition(JToggleButton.CENTER);
muteButton.setFocusable(false);
muteButton.setPreferredSize(new Dimension(60, 50));

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

jToggleListView.setMaximumSize(new java.awt.Dimension(37, 25));
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 25));
jToggleListView.setPreferredSize(new java.awt.Dimension(44, 22));
jToggleListView.addActionListener(evt -> jToggleListViewActionPerformed(evt));
jToggleCardView.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
jToggleCardView.setMargin(new java.awt.Insets(2, 6, 2, 6));
jToggleCardView.setPreferredSize(new java.awt.Dimension(40, 22));
jToggleCardView.addActionListener(evt -> jToggleCardViewActionPerformed(evt));

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

jToggleListView.setMaximumSize(new java.awt.Dimension(37, 22));
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 22));
jToggleListView.setPreferredSize(new java.awt.Dimension(37, 22));
jToggleListView.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
jToggleCardView.setMinimumSize(new java.awt.Dimension(37, 22));
jToggleCardView.setName(""); // NOI18N
jToggleCardView.setPreferredSize(new java.awt.Dimension(37, 22));
jToggleCardView.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jToggleCardView.addActionListener(new java.awt.event.ActionListener() {

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

private void registerMenu(String translationKey, ActionListener listener) {
  JToggleButton bt = new JToggleButton(Labels.getString(translationKey));
  bt.putClientProperty(ELFStyle.KEY, ELFStyle.BUTTON_MENU);
  buttonGroup.add(bt);
  bt.addActionListener(listener);
  buttonPanel.add(bt);
  bt.setPreferredSize(new Dimension(230, 60));
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * Adds the various buttons to the toolbar, setting their properties
 * appropriately.
 */
private void addButton(JToggleButton button, String name) {
  button.setIcon(
      new ImageIcon(ImageUtils.getImage(this, name + "3.gif")));
  button.setMaximumSize(new Dimension(80, 40));
  button.setPreferredSize(new Dimension(80, 40));
  buttonsPanel.add(button);
  buttonsPanel.add(Box.createVerticalStrut(5));
  group.add(button);
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * Adds the various buttons to the toolbar, setting their properties
 * appropriately.
 */
private void addButton(JToggleButton button, String name) {
  button.setIcon(
      new ImageIcon(ImageUtils.getImage(this, name + "3.gif")));
  button.setMaximumSize(new Dimension(80, 40));
  button.setPreferredSize(new Dimension(80, 40));
  buttonsPanel.add(button);
  buttonsPanel.add(Box.createVerticalStrut(5));
  group.add(button);
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * Adds the various buttons to the toolbar, setting their properties
 * appropriately.
 */
private void addButton(JToggleButton button, String name) {
  button.setIcon(
      new ImageIcon(ImageUtils.getImage(this, name + "3.gif")));
  button.setMaximumSize(new Dimension(80, 40));
  button.setPreferredSize(new Dimension(80, 40));
  buttonsPanel.add(button);
  buttonsPanel.add(Box.createVerticalStrut(5));
  group.add(button);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

private JToggleButton createToggle (Map<String,Boolean> fStates, int index) {
  boolean isSelected = filtersDesc.isSelected(index);
  Icon icon = filtersDesc.getSelectedIcon(index);
  // ensure small size, just for the icon
  JToggleButton result = new JToggleButton(icon, isSelected);
  Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 4);
  result.setPreferredSize(size);
  result.setMargin(new Insets(2,3,2,3));
  result.setToolTipText(filtersDesc.getTooltip(index));
  
  fStates.put(filtersDesc.getName(index), Boolean.valueOf(isSelected));
  
  return result;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf

private JToggleButton createToggle (Map<String,Boolean> fStates, int index) {
  boolean isSelected = filtersDesc.isSelected(index);
  Icon icon = filtersDesc.getSelectedIcon(index);
  // ensure small size, just for the icon
  JToggleButton result = new JToggleButton(icon, isSelected);
  Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 4);
  result.setPreferredSize(size);
  result.setMargin(new Insets(2,3,2,3));
  result.setToolTipText(filtersDesc.getTooltip(index));
  
  fStates.put(filtersDesc.getName(index), Boolean.valueOf(isSelected));
  
  return result;
}

代码示例来源:origin: org.icepdf.os/icepdf-viewer

protected JToggleButton makeToolbarToggleButton(
    String title, String toolTip, java.awt.Font font) {
  JToggleButton tmp = new JToggleButton(showButtonText ? title : "");
  tmp.setFont(font);
  tmp.setToolTipText(toolTip);
  tmp.setPreferredSize(new Dimension(30, 30));
  tmp.setText(title);
  tmp.setFocusPainted(true);
  return tmp;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

private static JToggleButton createToggleButton (final String id, String iconPath, String tooltip) {
  Icon icon = ImageUtilities.loadImageIcon(iconPath, false);
  boolean isSelected = isButtonSelected(id);
  final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
  // ensure small size, just for the icon
  Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
  toggleButton.setPreferredSize(size);
  toggleButton.setMargin(new Insets(1, 1, 1, 1));
  toggleButton.setToolTipText(tooltip);
  toggleButton.setFocusable(false);
  toggleButton.setEnabled(!NativeDebuggerManager.isStandalone()); //Disable for tool
  return toggleButton;
}

代码示例来源:origin: locationtech/jts

private static JToggleButton createToggleButton(String toolTipText, 
  ImageIcon icon, 
  java.awt.event.ActionListener actionListener)
{
 JToggleButton btn = new JToggleButton();
 btn.setMargin(new Insets(0, 0, 0, 0));
 btn.setPreferredSize(new Dimension(30, 30));
 btn.setIcon(icon);
 btn.setMinimumSize(new Dimension(30, 30));
 btn.setVerticalTextPosition(SwingConstants.BOTTOM);
 btn.setSelected(false);
 btn.setToolTipText(toolTipText);
 btn.setHorizontalTextPosition(SwingConstants.CENTER);
 btn.setFont(new java.awt.Font("SansSerif", 0, 10));
 btn.setMaximumSize(new Dimension(30, 30));
 btn.addActionListener(actionListener);
 return btn;
}

代码示例来源:origin: RPTools/maptool

public JToggleButton getScrollLockButton() {
  if (scrollLockButton == null) {
    scrollLockButton = new JToggleButton();
    scrollLockButton.setIcon(new ImageIcon(AppStyle.chatScrollImage));
    scrollLockButton.setSelectedIcon(new ImageIcon(AppStyle.chatScrollLockImage));
    scrollLockButton.setToolTipText("Scroll lock");
    scrollLockButton.setUI(new BasicToggleButtonUI());
    scrollLockButton.setBorderPainted(false);
    scrollLockButton.setFocusPainted(false);
    scrollLockButton.setPreferredSize(new Dimension(16, 16));
  }
  return scrollLockButton;
}

代码示例来源:origin: gurkenlabs/litiengine

this.btnPause = new JToggleButton();
this.btnPause.setSelected(true);
this.btnPause.setPreferredSize(new Dimension(40, 23));
this.btnPause.setIcon(Icons.PAUSE);
GroupLayout groupLayout = new GroupLayout(this);

代码示例来源:origin: org.icepdf.os/icepdf-viewer

protected JToggleButton makeToolbarToggleButton(
    String title, String toolTip, String imageName,
    int imageWidth, int imageHeight, java.awt.Font font) {
  JToggleButton tmp = new JToggleButton(showButtonText ? title : "");
  tmp.setFont(font);
  tmp.setToolTipText(toolTip);
  tmp.setRolloverEnabled(false);
  tmp.setPreferredSize(new Dimension(imageWidth, imageHeight));
  try {
    tmp.setIcon(new ImageIcon(Images.get(imageName + "_d.png")));
    tmp.setPressedIcon(new ImageIcon(Images.get(imageName + "_d.png")));
    tmp.setSelectedIcon(new ImageIcon(Images.get(imageName + "_n.png")));
    tmp.setDisabledIcon(new ImageIcon(Images.get(imageName + "_n.png")));
  } catch (NullPointerException e) {
    logger.warning("Failed to load toobar toggle button images: " + imageName + ".png");
  }
  tmp.setBorderPainted(false);
  tmp.setBorder(BorderFactory.createEmptyBorder());
  tmp.setContentAreaFilled(false);
  tmp.setFocusPainted(false);
  return tmp;
}

代码示例来源:origin: RPTools/maptool

chatNotifyButton.setBorderPainted(false);
chatNotifyButton.setFocusPainted(false);
chatNotifyButton.setPreferredSize(new Dimension(16, 16));
chatNotifyButton.addItemListener(new ItemListener() {
  private ChatTypingListener ours = null;

代码示例来源:origin: org.icepdf.os/icepdf-viewer

tmp.setFont(font);
tmp.setToolTipText(toolTip);
tmp.setPreferredSize(new Dimension(32, 32));
tmp.setRolloverEnabled(true);

代码示例来源:origin: vasl-developers/vasl

l_btn.setMaximumSize(new Dimension(32, 32));
l_btn.setMinimumSize(new Dimension(10, 10));
l_btn.setPreferredSize(new Dimension(32, 32));
l_btn.setFocusable(false);
l_btn.setRolloverEnabled(false);

代码示例来源:origin: org.icepdf.os/icepdf-viewer

tmp.setFont(font);
tmp.setToolTipText(toolTip);
tmp.setPreferredSize(new Dimension(24, 24));
try {
  tmp.setIcon(new ImageIcon(Images.get(imageName + "_a" + imageSize + ".png")));

相关文章

JToggleButton类方法