javax.swing.JButton.setVerticalTextPosition()方法的使用及代码示例

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

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

JButton.setVerticalTextPosition介绍

暂无

代码示例

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

private JButton createExampleButton(final CommonApp commonApp) {
  String iconResource = commonApp.getIconResource();
  Icon icon = iconResource == null ? new EmptyIcon() : new ImageIcon(getClass().getResource(iconResource));
  JButton button = new JButton(new AbstractAction(commonApp.getName(), icon) {
    @Override
    public void actionPerformed(ActionEvent e) {
      commonApp.init(OptaPlannerExamplesApp.this, false);
    }
  });
  button.setHorizontalAlignment(JButton.LEFT);
  button.setHorizontalTextPosition(JButton.RIGHT);
  button.setVerticalTextPosition(JButton.CENTER);
  button.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseEntered(MouseEvent e) {
      descriptionTextArea.setText(commonApp.getDescription());
    }
    @Override
    public void mouseExited(MouseEvent e) {
      descriptionTextArea.setText("");
    }
  });
  return button;
}

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

private JButton createTaskButton(Task task) {
  JButton taskButton =  SwingUtils.makeSmallButton(new JButton(new TaskAction(task)));
  taskButton.setBackground(task.isPinned() ? TangoColorFactory.ALUMINIUM_3 : TangoColorFactory.ALUMINIUM_1);
  taskButton.setHorizontalTextPosition(SwingConstants.CENTER);
  taskButton.setVerticalTextPosition(SwingConstants.TOP);
  taskButton.setSize(task.getDuration(), ROW_HEIGHT);
  return taskButton;
}

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

this.xhdpiButton.setBorderPainted(false);
this.xhdpiButton.setFocusPainted(false);
this.xhdpiButton.setVerticalTextPosition(SwingConstants.BOTTOM);
this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER);
this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);

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

JButton button = new JButton(...);
button.setHorizontalTextPosition(JButton.CENTER);
button.setVerticalTextPosition(JButton.CENTER);

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

btnConnect.setFocusable(false);
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
jToolBar1.add(btnConnect);
btnSendMessage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnSendMessage.setText("Send Message");
btnSendMessage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnSendMessage.addActionListener(evt -> btnSendMessageActionPerformed(evt));
jToolBar1.add(btnSendMessage);

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

btnPreferences.setFocusable(false);
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnPreferences.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnConnect.setFocusable(false);
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnConnect.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDeckEditor.setFocusable(false);
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCollectionViewer.setFocusable(false);
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnCollectionViewer.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSendFeedback.setFocusable(false);
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnSendFeedback.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {

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

btnExpansionSearch.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnExpansionSearch.setPreferredSize(new java.awt.Dimension(23, 23));
btnExpansionSearch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnExpansionSearch.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBooster.setFocusable(false);
btnBooster.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnBooster.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnBooster.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
btnClear.setFocusable(false);
btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnClear.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {

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

btnQuickStart.setFocusable(false);
btnQuickStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnQuickStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnQuickStart.addActionListener(evt -> btnQuickStartActionPerformed(evt));

代码示例来源:origin: ribomation/DroidAtScreen1

protected AbstractButton newButton() {
  JButton b = new JButton();
  b.setVerticalTextPosition(SwingConstants.BOTTOM);
  b.setHorizontalTextPosition(SwingConstants.CENTER);
  return b;
}

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

JButton button = new JButton("1");
button.setIcon( new ColorIcon(Color.RED, 32, 32) );
button.setHorizontalTextPosition(JButton.CENTER);
button.setVerticalTextPosition(JButton.CENTER);
button.setMargin( new Insets(0, 0, 0, 0) );

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

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

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

JButton imageTextButton;

imageTextButton = new JButton(
           "Click me to disable the next button"
                    , new ImageIcon(imagePath));
imageTextButton.setVerticalTextPosition(AbstractButton.BOTTOM);
imageTextButton.setHorizontalTextPosition(AbstractButton.CENTER);

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

ImageIcon icon = new ImageIcon("img.png");
Image scaledImg = icon.getImage().getScaledInstance(newWidth, newHeight,  java.awt.Image.SCALE_SMOOTH);  
icon = new ImageIcon(scaledImg);
JButton button = new JButton(icon);
button.setHorizontalTextPosition(JButton.CENTER);
button.setVerticalTextPosition(JButton.CENTER);

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

JButton button = new JButton( "Centered" );
button.setIcon( new ImageIcon("mong.jpg") );
button.setHorizontalTextPosition(JButton.CENTER);
button.setVerticalTextPosition(JButton.CENTER);

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

JButton openButton = new JButton(OpenAction);
openButton.setVerticalTextPosition(SwingConstants.BOTTOM);
openButton.setHorizontalTextPosition(SwingConstants.CENTER);
openButton.setText("Open");
bar.add(openButton);

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

JButton bt = new JButton("Picture", ic);
bt.setVerticalTextPosition(AbstractButton.BOTTOM);
bt.setHorizontalTextPosition(AbstractButton.CENTER);
add(bt);

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

public TestPane() {
  setLayout(new GridLayout(5, 5));
  for (int index = 0; index < 5 * 5; index++) {
    JButton btn = new JButton("Drop here");
    btn.setVerticalTextPosition(JButton.BOTTOM);
    btn.setHorizontalTextPosition(JButton.CENTER);
    btn.setTransferHandler(new ImageTransferHandler());
    add(btn);
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

public static JButton getTexturedButton(String s, ImageIcon icon) {
  JButton button = new JButton(s, icon);
  ViewUtil.makeSmall(button);
  button.setFocusable(false);
  button.setVerticalTextPosition(SwingConstants.CENTER);
  button.setHorizontalTextPosition(SwingConstants.LEFT);
  button.putClientProperty("JButton.buttonType", "textured");
  return button;
}

代码示例来源:origin: org.databene/databene-commons

private static JButton configureTransparentButton(JButton button, boolean withText) {
  if (withText) {
    button.setVerticalTextPosition(SwingConstants.BOTTOM);
    button.setHorizontalTextPosition(SwingConstants.CENTER);
  } else {
    button.setText("");
    button.setMargin(new Insets(0, 0, 0, 0));
  }
  button.setOpaque(false);
  button.setContentAreaFilled(false);
  button.setBorderPainted(false);
  return button;
}

代码示例来源:origin: org.optaplanner/optaplanner-examples

private JButton createTaskButton(Task task) {
  JButton taskButton =  SwingUtils.makeSmallButton(new JButton(new TaskAction(task)));
  taskButton.setBackground(task.isPinned() ? TangoColorFactory.ALUMINIUM_3 : TangoColorFactory.ALUMINIUM_1);
  taskButton.setHorizontalTextPosition(SwingConstants.CENTER);
  taskButton.setVerticalTextPosition(SwingConstants.TOP);
  taskButton.setSize(task.getDuration(), ROW_HEIGHT);
  return taskButton;
}

相关文章

JButton类方法