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; }
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; }
this.xhdpiButton.setFocusPainted(false); this.xhdpiButton.setVerticalTextPosition(SwingConstants.BOTTOM); this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER); this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER); this.xhdpiButton.setIcon(this.blueArrow);
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));
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));
JButton button = new JButton(...); button.setHorizontalTextPosition(JButton.CENTER); button.setVerticalTextPosition(JButton.CENTER);
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);
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() {
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() {
btnQuitTournament.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnQuitTournament.addActionListener(evt -> btnQuitTournamentActionPerformed(evt)); btnCloseWindow.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnCloseWindow.addActionListener(evt -> btnCloseWindowActionPerformed(evt));
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() {
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));
protected AbstractButton newButton() { JButton b = new JButton(); b.setVerticalTextPosition(SwingConstants.BOTTOM); b.setHorizontalTextPosition(SwingConstants.CENTER); return b; }
JButton imageTextButton; imageTextButton = new JButton( "Click me to disable the next button" , new ImageIcon(imagePath)); imageTextButton.setVerticalTextPosition(AbstractButton.BOTTOM); imageTextButton.setHorizontalTextPosition(AbstractButton.CENTER);
@ScriptFunction @Override public void setHorizontalTextPosition(int aValue) { super.setHorizontalTextPosition(aValue); }
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) );
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); } }
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; }
@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); }
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; }