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.setBorderPainted(false); this.xhdpiButton.setFocusPainted(false); this.xhdpiButton.setVerticalTextPosition(SwingConstants.BOTTOM); this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER); this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);
JButton button = new JButton(...); button.setHorizontalTextPosition(JButton.CENTER); button.setVerticalTextPosition(JButton.CENTER);
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);
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) {
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) {
btnQuickStart.setFocusable(false); btnQuickStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnQuickStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnQuickStart.addActionListener(evt -> btnQuickStartActionPerformed(evt));
protected AbstractButton newButton() { JButton b = new JButton(); b.setVerticalTextPosition(SwingConstants.BOTTOM); b.setHorizontalTextPosition(SwingConstants.CENTER); return b; }
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) );
@ScriptFunction @Override public void setVerticalTextPosition(int aValue) { super.setVerticalTextPosition(aValue); }
JButton imageTextButton; imageTextButton = new JButton( "Click me to disable the next button" , new ImageIcon(imagePath)); imageTextButton.setVerticalTextPosition(AbstractButton.BOTTOM); imageTextButton.setHorizontalTextPosition(AbstractButton.CENTER);
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);
JButton button = new JButton( "Centered" ); button.setIcon( new ImageIcon("mong.jpg") ); button.setHorizontalTextPosition(JButton.CENTER); button.setVerticalTextPosition(JButton.CENTER);
JButton openButton = new JButton(OpenAction); openButton.setVerticalTextPosition(SwingConstants.BOTTOM); openButton.setHorizontalTextPosition(SwingConstants.CENTER); openButton.setText("Open"); bar.add(openButton);
JButton bt = new JButton("Picture", ic); bt.setVerticalTextPosition(AbstractButton.BOTTOM); bt.setHorizontalTextPosition(AbstractButton.CENTER); add(bt);
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; }
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; }
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; }