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

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

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

JButton.setHorizontalAlignment介绍

暂无

代码示例

代码示例来源: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: redwarp/9-Patch-Resizer

  1. this.xhdpiButton.setVerticalTextPosition(SwingConstants.BOTTOM);
  2. this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER);
  3. this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);
  4. this.xhdpiButton.setIcon(this.blueArrow);
  5. this.xhdpiButton.setSelectedIcon(this.redArrow);

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

  1. jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  2. jButton_Record.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  3. jButton_Record.setMaximumSize(new java.awt.Dimension(95, 25));
  4. jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  5. jButton_Play.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  6. jButton_Play.setMaximumSize(new java.awt.Dimension(95, 25));

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

  1. jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  2. jButton_Record.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  3. jButton_Record.setMaximumSize(new java.awt.Dimension(95, 25));
  4. jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  5. jButton_Play.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
  6. jButton_Play.setMaximumSize(new java.awt.Dimension(95, 25));

代码示例来源:origin: fossasia/neurolab-desktop

  1. button.setHorizontalAlignment(JButton.LEFT);

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

  1. labelIsCheckingUpdate.setHorizontalAlignment(SwingConstants.LEFT);
  2. labelIsCheckingUpdate.setBorderPainted(false);
  3. labelIsCheckingUpdate.setContentAreaFilled(false);
  4. labelIsReportingBugs.setHorizontalAlignment(SwingConstants.LEFT);
  5. labelIsReportingBugs.setBorderPainted(false);
  6. labelIsReportingBugs.setContentAreaFilled(false);
  7. labelIsEvading.setHorizontalAlignment(SwingConstants.LEFT);
  8. labelIsEvading.setBorderPainted(false);
  9. labelIsEvading.setContentAreaFilled(false);
  10. labelIsFollowingRedirection.setHorizontalAlignment(SwingConstants.LEFT);
  11. labelIsFollowingRedirection.setBorderPainted(false);
  12. labelIsFollowingRedirection.setContentAreaFilled(false);
  13. labelTestConnection.setHorizontalAlignment(SwingConstants.LEFT);
  14. labelTestConnection.setBorderPainted(false);
  15. labelTestConnection.setContentAreaFilled(false);
  16. labelParseForm.setHorizontalAlignment(SwingConstants.LEFT);
  17. labelParseForm.setBorderPainted(false);
  18. labelParseForm.setContentAreaFilled(false);
  19. buttonIsUsingProxy.setHorizontalAlignment(SwingConstants.LEFT);
  20. buttonIsUsingProxy.setBorderPainted(false);
  21. buttonIsUsingProxy.setContentAreaFilled(false);
  22. buttonIsUsingProxyHttps.setHorizontalAlignment(SwingConstants.LEFT);

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

  1. jButtonFooterNext.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  2. jButtonFooterNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  3. jButtonFooterNext.setOpaque(false);

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

  1. protected JButton addAction(final JComponent arrowLinkPopup, Action action) {
  2. JButton comp = new JButton(action);
  3. comp.setHorizontalAlignment(JButton.LEFT);
  4. addPopupComponent (arrowLinkPopup, null, comp);
  5. return comp;
  6. }

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

  1. private JButton makeJButton(String label, String toolTip, Color bgColor, final Color highlight) {
  2. JButton button = new JButton(label);
  3. button.setToolTipText(toolTip);
  4. button.setBackground(bgColor);
  5. button.setHorizontalAlignment(JButton.CENTER);
  6. button.addActionListener(new ActionListener() {
  7. @Override
  8. public void actionPerformed(ActionEvent e) {
  9. Highlighter.shadeSymmetric(currentCell, highlight);
  10. }
  11. });
  12. return button;
  13. }

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

  1. public ScriptComboBoxEditor() {
  2. showEditorBtn = new JButton();
  3. script = "";
  4. setButtonText();
  5. showEditorBtn.setHorizontalAlignment(SwingConstants.LEFT);
  6. showEditorBtn.addActionListener(new ActionListener() {
  7. @Override
  8. public void actionPerformed(ActionEvent e) {
  9. editScript(false);
  10. }
  11. });
  12. actionListeners = new LinkedList<ActionListener>();
  13. minimumSize = new Dimension(600, 400);
  14. bounds = null;
  15. }

代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing

  1. private JButton getAcceptButton() {
  2. if (acceptButton == null) {
  3. acceptButton = new JButton();
  4. acceptButton.setText(OpenEHRLanguageManager.getMessage("Accept"));
  5. acceptButton.setIcon(OpenEHRImageUtil.ACCEPT_ICON);
  6. acceptButton.setEnabled(true);
  7. acceptButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  8. acceptButton.addActionListener(getAcceptChangesAction());
  9. }
  10. return acceptButton;
  11. }

代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing

  1. protected JButton getAcceptButton() {
  2. if (acceptButton == null) {
  3. acceptButton = new JButton();
  4. acceptButton.setText(OpenEHRLanguageManager.getMessage("Accept"));
  5. acceptButton.setIcon(OpenEHRImageUtil.ACCEPT_ICON);
  6. acceptButton.setEnabled(true);
  7. acceptButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  8. acceptButton.addActionListener(getAcceptChangesAction());
  9. }
  10. return acceptButton;
  11. }

代码示例来源:origin: org.gdl-lang.gdl-tools/cds-gui-swing

  1. private JButton getAcceptButton() {
  2. if (acceptButton == null) {
  3. acceptButton = new JButton();
  4. acceptButton.setText(OpenEHRLanguageManager.getMessage("Accept"));
  5. acceptButton.setIcon(OpenEHRImageUtil.ACCEPT_ICON);
  6. acceptButton.setEnabled(true);
  7. acceptButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  8. acceptButton.addActionListener(getAcceptChangesAction());
  9. }
  10. return acceptButton;
  11. }

代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing

  1. private JButton getAcceptButton() {
  2. if (acceptButton == null) {
  3. acceptButton = new JButton();
  4. acceptButton.setText(OpenEHRLanguageManager.getMessage("Accept"));
  5. acceptButton.setIcon(OpenEHRImageUtil.ACCEPT_ICON);
  6. acceptButton.setEnabled(true);
  7. acceptButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  8. acceptButton.addActionListener(getAcceptChangesAction());
  9. }
  10. return acceptButton;
  11. }

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

  1. private void addUriWithoutTitle(Box box, String uriProperty) {
  2. try {
  3. final String urlText = ResourceController.getResourceController().getProperty(uriProperty);
  4. URI uri = new URI(urlText);
  5. JButton uriButton = UITools.createHtmlLinkStyleButton(uri, urlText);
  6. uriButton.setHorizontalAlignment(SwingConstants.LEADING);
  7. box.add(uriButton);
  8. } catch (URISyntaxException e1) {
  9. }
  10. }

代码示例来源:origin: jpos/jPOS

  1. public JComponent create (UI ui, Element e) {
  2. JButton button = new JButton (e.getText());
  3. button.setHorizontalAlignment(JLabel.CENTER);
  4. button.setBorder(new EmptyBorder(3, 3, 3, 3));
  5. String font = e.getAttributeValue ("font");
  6. if (font != null)
  7. button.setFont (Font.decode (font));
  8. return button;
  9. }
  10. }

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

  1. private void addUri(Box box, String uriProperty, String message) {
  2. try {
  3. URI uri;
  4. uri = new URI( ResourceController.getResourceController().getProperty(uriProperty));
  5. JButton uriButton = UITools.createHtmlLinkStyleButton(uri, message);
  6. uriButton.setAlignmentX(Component.LEFT_ALIGNMENT);
  7. uriButton.setHorizontalAlignment(SwingConstants.LEADING);
  8. box.add(uriButton);
  9. } catch (URISyntaxException e1) {
  10. }
  11. }
  12. }

代码示例来源:origin: Exslims/MercuryTrade

  1. private JButton getOperationButton(String title, String iconPath) {
  2. JButton button = this.componentsFactory.getButton(title);
  3. button.setPreferredSize(new Dimension(210, 35));
  4. button.setForeground(AppThemeColor.TEXT_DEFAULT);
  5. button.setHorizontalAlignment(SwingConstants.LEFT);
  6. button.setBackground(AppThemeColor.ADR_BG);
  7. button.setFont(this.componentsFactory.getFont(FontStyle.BOLD, 16f));
  8. button.setIcon(this.componentsFactory.getIcon(iconPath, 22));
  9. button.setBorder(BorderFactory.createCompoundBorder(
  10. BorderFactory.createMatteBorder(1, 1, 1, 1, AppThemeColor.ADR_PANEL_BORDER),
  11. BorderFactory.createEmptyBorder(2, 10, 2, 2)));
  12. return button;
  13. }

代码示例来源:origin: lbalazscs/Pixelitor

  1. private static JButton createLinkButton() {
  2. JButton linkButton = new JButton("<HTML><FONT color=\"#000099\"><U>" + HOME_PAGE + "</U></FONT></HTML>");
  3. linkButton.setHorizontalAlignment(SwingConstants.CENTER);
  4. linkButton.setBorderPainted(false);
  5. linkButton.setFocusPainted(false);
  6. linkButton.setOpaque(false);
  7. linkButton.setBackground(box.getBackground());
  8. linkButton.setAlignmentX(Component.CENTER_ALIGNMENT);
  9. linkButton.addActionListener(new OpenInBrowserAction(null, HOME_PAGE));
  10. return linkButton;
  11. }

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

  1. private JButton addStyleButton(DefaultFormBuilder formBuilder, String label, AFreeplaneAction action) {
  2. final JButton button = new JButton(){
  3. private static final long serialVersionUID = 1L;
  4. {
  5. setUI(BasicButtonUI.createUI(this));
  6. }
  7. };
  8. button.addActionListener(action);
  9. button.setHorizontalAlignment(SwingConstants.LEFT);
  10. final String labelText = TextUtils.getText(label);
  11. UITools.addTitledBorder(button, labelText, StyleEditorPanel.FONT_SIZE);
  12. TranslatedElement.BORDER.setKey(button, label);
  13. formBuilder.append(button, formBuilder.getColumnCount());
  14. formBuilder.nextLine();
  15. return button;
  16. }

相关文章

JButton类方法