List of usage examples for javax.swing JButton setIconTextGap
@BeanProperty(visualUpdate = true, description = "If both the icon and text properties are set, this property defines the space between them.") public void setIconTextGap(int iconTextGap)
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton button = new JButton(); // Get gap size; default is 4 int gapSize = button.getIconTextGap(); // Set gap size button.setIconTextGap(8); }
From source file:Main.java
public static void main(final String args[]) { JButton button = new JButton(); // Get gap size; default is 4 int gapSize = button.getIconTextGap(); // Set gap size button.setIconTextGap(8); JOptionPane.showMessageDialog(null, button); }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton creatOutputButton() { JButton b = new JButton("Click or drag to set output file", PDF_1234); b.setHorizontalTextPosition(SwingConstants.LEFT); b.setIconTextGap(25); b.setTransferHandler(new OutputButtonTransferHandler()); b.addActionListener(new ActionListener() { @Override//w w w .j av a2s .com public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); if (chooser.showOpenDialog(RepaginateFrame.this) != JFileChooser.APPROVE_OPTION) return; repaginator.setOutputFiles(Arrays.asList(chooser.getSelectedFiles())); output.setText("<html><center>" + StringUtils.join(repaginator.getOutputFiles(), "<br>")); } }); return b; }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton createInputButton() { JButton b = new JButton("Click or drag to set input files", PDF_1342); b.setHorizontalTextPosition(SwingConstants.RIGHT); b.setIconTextGap(25); b.setTransferHandler(new InputButtonTransferHandler()); b.addActionListener(new ActionListener() { @Override//from www . j ava 2s . c o m public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); if (chooser.showOpenDialog(RepaginateFrame.this) != JFileChooser.APPROVE_OPTION) return; setInput(Arrays.asList(chooser.getSelectedFiles())); if (JOptionPane.showConfirmDialog(RepaginateFrame.this, "Use input paths as output paths?", "Use Input As Output?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { setOutput(new ArrayList<File>(repaginator.getInputFiles())); } } }); return b; }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton createRepaginateButton() { JButton b = new JButton("<html><center>Click to<br>repaginate", REPAGINATE_ICON); b.setHorizontalTextPosition(SwingConstants.LEFT); b.setIconTextGap(25); b.addActionListener(new ActionListener() { @Override//from w w w.j a v a2 s . co m public void actionPerformed(ActionEvent e) { try { int[] documentsPages = repaginator.repaginate(); JOptionPane.showMessageDialog(RepaginateFrame.this, "Repaginated " + documentsPages[0] + " documents with " + documentsPages[1] + " pages.", "Repagination Complete", JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(RepaginateFrame.this, ex.toString(), "Error During Repagination", JOptionPane.ERROR_MESSAGE); } } }); return b; }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton createUnrepaginateButton() { JButton b = new JButton("<html><center>Click to<br>un-repaginate", UNREPAGINATE_ICON); b.setHorizontalTextPosition(SwingConstants.RIGHT); b.setIconTextGap(25); b.addActionListener(new ActionListener() { @Override//from w w w . j a va 2s.c o m public void actionPerformed(ActionEvent e) { try { int[] documentsPages = repaginator.unrepaginate(); JOptionPane.showMessageDialog( RepaginateFrame.this, "Unrepaginated " + documentsPages[0] + " documents with " + documentsPages[1] + " pages.", "Unrepagination Complete", JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(RepaginateFrame.this, ex.toString(), "Error During Unrepagination", JOptionPane.ERROR_MESSAGE); } } }); return b; }
From source file:de.ailis.xadrian.frames.MainFrame.java
/** * Creates the content.//from w w w. j ava2 s . c om */ private void createContent() { this.tabs = new JTabbedPane(); this.tabs.setPreferredSize(new Dimension(640, 480)); this.tabs.addChangeListener(this); this.tabs.setTransferHandler(this.transferHandler); final JPanel welcomePanel = this.welcomePanel = new JPanel(); welcomePanel.setTransferHandler(this.transferHandler); welcomePanel.setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); welcomePanel.setPreferredSize(new Dimension(640, 480)); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); c.anchor = GridBagConstraints.CENTER; welcomePanel.add(buttonPanel, c); final JButton newButton = new JButton(this.newAction); newButton.setHorizontalAlignment(SwingConstants.LEFT); newButton.setIconTextGap(10); newButton.setText("<html><body><strong>" + newButton.getText() + "</strong><br />" + newButton.getToolTipText() + "</body></html>"); newButton.setToolTipText(null); newButton.setMargin(new Insets(5, 10, 5, 10)); c.gridy = 0; c.fill = GridBagConstraints.BOTH; c.insets.set(5, 5, 5, 5); buttonPanel.add(newButton, c); final JButton openButton = new JButton(this.openAction); openButton.setHorizontalAlignment(SwingConstants.LEFT); openButton.setIconTextGap(10); openButton.setText("<html><body><strong>" + openButton.getText() + "</strong><br />" + openButton.getToolTipText() + "</body></html>"); openButton.setToolTipText(null); openButton.setMargin(new Insets(5, 10, 5, 10)); c.gridy++; buttonPanel.add(openButton, c); final JPanel separator = new JPanel(); separator.setPreferredSize(new Dimension(20, 20)); c.gridy++; buttonPanel.add(separator, c); final JButton donateButton = new JButton(this.donateAction); donateButton.setHorizontalAlignment(SwingConstants.LEFT); donateButton.setIconTextGap(10); donateButton.setText("<html><body><strong>" + donateButton.getText() + "</strong><br />" + donateButton.getToolTipText() + "</body></html>"); donateButton.setToolTipText(null); donateButton.setMargin(new Insets(5, 10, 5, 10)); c.gridy++; buttonPanel.add(donateButton, c); final SocialPane socialPane = new SocialPane(); c.insets.top = 50; c.gridy++; buttonPanel.add(socialPane, c); installStatusHandler(buttonPanel); add(welcomePanel, BorderLayout.CENTER); }