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

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

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

JButton.setHorizontalTextPosition介绍

暂无

代码示例

代码示例来源: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.setFocusPainted(false);
this.xhdpiButton.setVerticalTextPosition(SwingConstants.BOTTOM);
this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER);
this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);
this.xhdpiButton.setIcon(this.blueArrow);

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

jButton_Record.setText("Record");
jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Record.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Record.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Record.setMinimumSize(new java.awt.Dimension(95, 25));
jButton_Play.setText("Play");
jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Play.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Play.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Play.setMinimumSize(new java.awt.Dimension(95, 25));

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

jButton_Record.setText("Record");
jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Record.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Record.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Record.setMinimumSize(new java.awt.Dimension(95, 25));
jButton_Play.setText("Play");
jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Play.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Play.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Play.setMinimumSize(new java.awt.Dimension(95, 25));

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

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

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

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

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

btnPreferences.setToolTipText("By changing the settings in the preferences window you can adjust the look and behaviour of xmage.");
btnPreferences.setFocusable(false);
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnPreferences.addActionListener(new java.awt.event.ActionListener() {
btnConnect.setToolTipText("Connect to or disconnect from a XMage server.");
btnConnect.setFocusable(false);
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnConnect.addActionListener(new java.awt.event.ActionListener() {
btnDeckEditor.setToolTipText("Start the deck editor to create or modify decks.");
btnDeckEditor.setFocusable(false);
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
btnCollectionViewer.setToolTipText("Card viewer to show the cards of sets. ");
btnCollectionViewer.setFocusable(false);
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnCollectionViewer.addActionListener(new java.awt.event.ActionListener() {
btnSendFeedback.setToolTipText("Send some feedback to the developers.");
btnSendFeedback.setFocusable(false);
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnSendFeedback.addActionListener(new java.awt.event.ActionListener() {

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

btnCancel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnCancel.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnCancel.addActionListener(new java.awt.event.ActionListener() {
btnFindLocal.setActionCommand("connectLocalhost");
btnFindLocal.setAlignmentY(0.0F);
btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindLocal.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindLocal.setName("connectLocalhostBtn"); // NOI18N
btnFindBeta.setToolTipText("Connect to BETA server (use any username without registration)");
btnFindBeta.setAlignmentY(0.0F);
btnFindBeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindBeta.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindBeta.setPreferredSize(new java.awt.Dimension(23, 23));
btnFindOther.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindOther.setName("findServerBtn"); // NOI18N
btnFindOther.addActionListener(new java.awt.event.ActionListener() {

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

btnQuitTournament.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnQuitTournament.addActionListener(evt -> btnQuitTournamentActionPerformed(evt));
btnCloseWindow.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnCloseWindow.addActionListener(evt -> btnCloseWindowActionPerformed(evt));

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

btnExpansionSearch.setAlignmentX(1.0F);
btnExpansionSearch.setFocusable(false);
btnExpansionSearch.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnExpansionSearch.setPreferredSize(new java.awt.Dimension(23, 23));
btnExpansionSearch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnBooster.setToolTipText("(CURRENTLY NOT WORKING) Generates a booster of the selected set and adds the cards to the card selector.");
btnBooster.setFocusable(false);
btnBooster.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnBooster.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnBooster.addActionListener(new java.awt.event.ActionListener() {
btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnClear.addActionListener(new java.awt.event.ActionListener() {

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

btnQuickStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnQuickStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
btnQuickStart.addActionListener(evt -> btnQuickStartActionPerformed(evt));
jButtonFooterNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButtonFooterNext.setOpaque(false);
jButtonFooterNext.addActionListener(evt -> jButtonFooterNextActionPerformed(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 imageTextButton;

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

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

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

代码示例来源: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: 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: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = CONSTRUCTOR_JSDOC, params = {"text", "icon", "iconTextGap", "actionPerformed"})
public Button(String aText, Icon aIcon, int aIconTextGap, JSObject aActionPerformedHandler) {
  super(aText, aIcon);
  super.setIconTextGap(aIconTextGap);
  super.setHorizontalTextPosition(HorizontalPosition.RIGHT);
  setOnActionPerformed(aActionPerformedHandler);
}

代码示例来源: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类方法