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

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

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

JButton.setVerticalTextPosition介绍

暂无

代码示例

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

  1. private JButton createExampleButton(final CommonApp commonApp) {
  2. String iconResource = commonApp.getIconResource();
  3. Icon icon = iconResource == null ? new EmptyIcon() : new ImageIcon(getClass().getResource(iconResource));
  4. JButton button = new JButton(new AbstractAction(commonApp.getName(), icon) {
  5. @Override
  6. public void actionPerformed(ActionEvent e) {
  7. commonApp.init(OptaPlannerExamplesApp.this, false);
  8. }
  9. });
  10. button.setHorizontalAlignment(JButton.LEFT);
  11. button.setHorizontalTextPosition(JButton.RIGHT);
  12. button.setVerticalTextPosition(JButton.CENTER);
  13. button.addMouseListener(new MouseAdapter() {
  14. @Override
  15. public void mouseEntered(MouseEvent e) {
  16. descriptionTextArea.setText(commonApp.getDescription());
  17. }
  18. @Override
  19. public void mouseExited(MouseEvent e) {
  20. descriptionTextArea.setText("");
  21. }
  22. });
  23. return button;
  24. }

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

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

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

  1. this.xhdpiButton.setBorderPainted(false);
  2. this.xhdpiButton.setFocusPainted(false);
  3. this.xhdpiButton.setVerticalTextPosition(SwingConstants.BOTTOM);
  4. this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER);
  5. this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);

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

  1. JButton button = new JButton(...);
  2. button.setHorizontalTextPosition(JButton.CENTER);
  3. button.setVerticalTextPosition(JButton.CENTER);

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

  1. btnConnect.setFocusable(false);
  2. btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  3. btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  4. btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
  5. jToolBar1.add(btnConnect);
  6. btnSendMessage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  7. btnSendMessage.setText("Send Message");
  8. btnSendMessage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  9. btnSendMessage.addActionListener(evt -> btnSendMessageActionPerformed(evt));
  10. jToolBar1.add(btnSendMessage);

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

  1. btnPreferences.setFocusable(false);
  2. btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  3. btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  4. btnPreferences.addActionListener(new java.awt.event.ActionListener() {
  5. public void actionPerformed(java.awt.event.ActionEvent evt) {
  6. btnConnect.setFocusable(false);
  7. btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  8. btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  9. btnConnect.addActionListener(new java.awt.event.ActionListener() {
  10. public void actionPerformed(java.awt.event.ActionEvent evt) {
  11. btnDeckEditor.setFocusable(false);
  12. btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  13. btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  14. btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
  15. public void actionPerformed(java.awt.event.ActionEvent evt) {
  16. btnCollectionViewer.setFocusable(false);
  17. btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  18. btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  19. btnCollectionViewer.addActionListener(new java.awt.event.ActionListener() {
  20. public void actionPerformed(java.awt.event.ActionEvent evt) {
  21. btnSendFeedback.setFocusable(false);
  22. btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  23. btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  24. btnSendFeedback.addActionListener(new java.awt.event.ActionListener() {
  25. public void actionPerformed(java.awt.event.ActionEvent evt) {

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

  1. btnExpansionSearch.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  2. btnExpansionSearch.setPreferredSize(new java.awt.Dimension(23, 23));
  3. btnExpansionSearch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  4. btnExpansionSearch.addActionListener(new java.awt.event.ActionListener() {
  5. public void actionPerformed(java.awt.event.ActionEvent evt) {
  6. btnBooster.setFocusable(false);
  7. btnBooster.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  8. btnBooster.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  9. btnBooster.addActionListener(new java.awt.event.ActionListener() {
  10. public void actionPerformed(java.awt.event.ActionEvent evt) {
  11. btnClear.setFocusable(false);
  12. btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  13. btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  14. btnClear.addActionListener(new java.awt.event.ActionListener() {
  15. public void actionPerformed(java.awt.event.ActionEvent evt) {

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

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

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

  1. protected AbstractButton newButton() {
  2. JButton b = new JButton();
  3. b.setVerticalTextPosition(SwingConstants.BOTTOM);
  4. b.setHorizontalTextPosition(SwingConstants.CENTER);
  5. return b;
  6. }

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

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

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

  1. @ScriptFunction
  2. @Override
  3. public void setVerticalTextPosition(int aValue) {
  4. super.setVerticalTextPosition(aValue);
  5. }

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

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

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

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

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

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

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

  1. JButton openButton = new JButton(OpenAction);
  2. openButton.setVerticalTextPosition(SwingConstants.BOTTOM);
  3. openButton.setHorizontalTextPosition(SwingConstants.CENTER);
  4. openButton.setText("Open");
  5. bar.add(openButton);

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

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

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

  1. public TestPane() {
  2. setLayout(new GridLayout(5, 5));
  3. for (int index = 0; index < 5 * 5; index++) {
  4. JButton btn = new JButton("Drop here");
  5. btn.setVerticalTextPosition(JButton.BOTTOM);
  6. btn.setHorizontalTextPosition(JButton.CENTER);
  7. btn.setTransferHandler(new ImageTransferHandler());
  8. add(btn);
  9. }
  10. }

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

  1. public static JButton getTexturedButton(String s, ImageIcon icon) {
  2. JButton button = new JButton(s, icon);
  3. ViewUtil.makeSmall(button);
  4. button.setFocusable(false);
  5. button.setVerticalTextPosition(SwingConstants.CENTER);
  6. button.setHorizontalTextPosition(SwingConstants.LEFT);
  7. button.putClientProperty("JButton.buttonType", "textured");
  8. return button;
  9. }

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

  1. private static JButton configureTransparentButton(JButton button, boolean withText) {
  2. if (withText) {
  3. button.setVerticalTextPosition(SwingConstants.BOTTOM);
  4. button.setHorizontalTextPosition(SwingConstants.CENTER);
  5. } else {
  6. button.setText("");
  7. button.setMargin(new Insets(0, 0, 0, 0));
  8. }
  9. button.setOpaque(false);
  10. button.setContentAreaFilled(false);
  11. button.setBorderPainted(false);
  12. return button;
  13. }

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

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

相关文章

JButton类方法