本文整理了Java中javax.swing.JButton.setMargin()
方法的一些代码示例,展示了JButton.setMargin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setMargin()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setMargin
暂无
代码示例来源:origin: kiegroup/optaplanner
public static JButton makeSmallButton(JButton button) {
button.setMargin(new Insets(0, 0, 0, 0));
button.putClientProperty("Nimbus.Overrides", smallButtonUIDefaults);
return button;
}
代码示例来源:origin: libgdx/libgdx
titlePanel.add(upButton);
upButton.setText("Up");
upButton.setMargin(new Insets(0, 0, 0, 0));
Font font = upButton.getFont();
upButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
titlePanel.add(downButton);
downButton.setText("Down");
downButton.setMargin(new Insets(0, 0, 0, 0));
Font font = downButton.getFont();
downButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
titlePanel.add(deleteButton);
deleteButton.setText("X");
deleteButton.setMargin(new Insets(0, 0, 0, 0));
Font font = deleteButton.getFont();
deleteButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
代码示例来源:origin: libgdx/libgdx
titlePanel.add(upButton);
upButton.setText("Up");
upButton.setMargin(new Insets(0, 0, 0, 0));
Font font = upButton.getFont();
upButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
titlePanel.add(downButton);
downButton.setText("Down");
downButton.setMargin(new Insets(0, 0, 0, 0));
Font font = downButton.getFont();
downButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
titlePanel.add(deleteButton);
deleteButton.setText("X");
deleteButton.setMargin(new Insets(0, 0, 0, 0));
Font font = deleteButton.getFont();
deleteButton.setFont(new Font(font.getName(), font.getStyle(), font.getSize() - 2));
代码示例来源:origin: libgdx/libgdx
leftSidePanel.setLayout(new GridBagLayout());
getContentPane().add(leftSidePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
fontPanel.setLayout(new GridBagLayout());
fontPanel.setBorder(BorderFactory.createTitledBorder("Font"));
fontPanel.add(browseButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
browseButton.setMargin(new Insets(0, 0, 0, 0));
代码示例来源:origin: libgdx/libgdx
leftSidePanel.setLayout(new GridBagLayout());
getContentPane().add(leftSidePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
fontPanel.setLayout(new GridBagLayout());
fontPanel.setBorder(BorderFactory.createTitledBorder("Font"));
fontPanel.add(browseButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
browseButton.setMargin(new Insets(0, 0, 0, 0));
代码示例来源:origin: bonnyfone/vectalign
btnMorphAnimation.setBorderPainted(false);
btnMorphAnimation.setBorder(null);
btnMorphAnimation.setMargin(new Insets(0, 0, 0, 0));
btnMorphAnimation.setContentAreaFilled(false);
代码示例来源:origin: magefree/mage
public static JButton getButton () {
JButton button = new JButton();
button.setMargin(new Insets(2, 4, 2, 4));
return button;
}
代码示例来源:origin: stackoverflow.com
JButton button = new JButton();
button.setBorderPainted(false);
button.setBorder(null);
//button.setFocusable(false);
button.setMargin(new Insets(0, 0, 0, 0));
button.setContentAreaFilled(false);
button.setIcon(myIcon1);
button.setRolloverIcon(myIcon2);
button.setPressedIcon(myIcon3);
button.setDisabledIcon(myIcon4);
代码示例来源:origin: nodebox/nodebox
public DataControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
clearDataButton = new JButton("Clear");
clearDataButton.setMargin(new Insets(1, 0, 0, 0));
clearDataButton.putClientProperty("JButton.buttonType", "textured");
clearDataButton.putClientProperty("JComponent.sizeVariant", "small");
clearDataButton.setFont(Theme.SMALL_BOLD_FONT);
clearDataButton.setForeground(Theme.TEXT_NORMAL_COLOR);
clearDataButton.addActionListener(this);
add(clearDataButton);
/*showDataButton = new JButton("Show Data...");
showDataButton.setMargin(new Insets(1, 0, 0, 0));
showDataButton.putClientProperty("JButton.buttonType", "textured");
showDataButton.putClientProperty("JComponent.sizeVariant", "small");
showDataButton.setFont(Theme.SMALL_BOLD_FONT);
showDataButton.setForeground(Theme.TEXT_NORMAL_COLOR);
showDataButton.addActionListener(this);
add(showDataButton);*/
add(Box.createHorizontalGlue());
}
代码示例来源:origin: magefree/mage
btnConnect.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnConnect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancel.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnRegister.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnRegister.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnForgotPassword.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnForgotPassword.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnFindMain.setActionCommand("connectXmageDe");
btnFindMain.setAlignmentY(0.0F);
btnFindMain.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindMain.setMaximumSize(new java.awt.Dimension(42, 23));
btnFindMain.setMinimumSize(new java.awt.Dimension(42, 23));
btnFindLocal.setAlignmentY(0.0F);
btnFindLocal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnFindLocal.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindLocal.setName("connectLocalhostBtn"); // NOI18N
btnFindLocal.setPreferredSize(new java.awt.Dimension(23, 23));
btnFindBeta.setAlignmentY(0.0F);
代码示例来源:origin: magefree/mage
jToggleListView.setFocusable(false);
jToggleListView.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jToggleListView.setMargin(new java.awt.Insets(2, 2, 2, 2));
jToggleListView.setMaximumSize(new java.awt.Dimension(37, 22));
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 22));
jToggleCardView.setFocusable(false);
jToggleCardView.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jToggleCardView.setMargin(new java.awt.Insets(2, 2, 2, 2));
jToggleCardView.setMaximumSize(new java.awt.Dimension(37, 22));
jToggleCardView.setMinimumSize(new java.awt.Dimension(37, 22));
jButtonAddToMain.setMargin(null);
jButtonAddToMain.setMaximumSize(new java.awt.Dimension(35, 23));
jButtonAddToMain.setMinimumSize(new java.awt.Dimension(35, 23));
jButtonRemoveFromMain.setMargin(null);
jButtonRemoveFromMain.setMaximumSize(new java.awt.Dimension(42, 23));
jButtonRemoveFromMain.setMinimumSize(new java.awt.Dimension(42, 23));
jButtonAddToSideboard.setMargin(new java.awt.Insets(2, 0, 2, 0));
jButtonAddToSideboard.setMaximumSize(new java.awt.Dimension(100, 30));
jButtonAddToSideboard.setMinimumSize(new java.awt.Dimension(10, 30));
jButtonRemoveFromSideboard.setMargin(new java.awt.Insets(2, 0, 2, 0));
jButtonRemoveFromSideboard.setMaximumSize(new java.awt.Dimension(10, 30));
jButtonRemoveFromSideboard.setMinimumSize(new java.awt.Dimension(100, 30));
代码示例来源:origin: magefree/mage
btnNewTable.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnNewTable.addActionListener(evt -> btnNewTableActionPerformed(evt));
btnNewTournament.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnNewTournament.addActionListener(evt -> btnNewTournamentActionPerformed(evt));
代码示例来源:origin: Renanse/Ardor3D
protected JButton makeListButton(final String text) {
final JButton button = new JButton(text);
button.setMargin(new Insets(2, 2, 2, 2));
return button;
}
代码示例来源:origin: info.aduna.commons/aduna-commons-swing
private JButton createButton(String text) {
JButton button = new JButton(text);
button.setMargin(new Insets(2, 18, 3, 18));
button.addActionListener(this);
return button;
}
代码示例来源:origin: MarginallyClever/Makelangelo-software
public JButton createTightJButton(String label) {
JButton b = new JButton(label);
b.setMargin(new Insets(0,0,0,0));
b.setPreferredSize(new Dimension(60,20));
b.addActionListener(this);
return b;
}
代码示例来源:origin: stackoverflow.com
lines = new char[][]{...};
for (int outter = 0; outter < lines.length; outter++) {
JPanel panel = new JPanel(new GridBagLayout());
for (int inner = 0; inner < lines[outter].length) {
char ch = lines[outter][inner];
JButton btn = new JButton(Character.toString(ch));
btn.setMargin(new Insets(10, 10, 10, 10));
panel.add(btn);
}
add(panel, gbc);
gbc.gridy++;
}
代码示例来源:origin: MarginallyClever/Makelangelo-software
public JButton createNarrowJButton(String label) {
JButton b = new JButton(label);
b.setMargin(new Insets(0,0,0,0));
b.setPreferredSize(new Dimension(40,20));
b.addActionListener(this);
return b;
}
代码示例来源:origin: locationtech/jts
public static JButton createButton(ImageIcon icon, String tip, ActionListener action ) {
JButton btn = new JButton();
btn.setToolTipText(tip);
btn.setIcon(icon);
btn.setMargin(new Insets(0, 0, 0, 0));
if (action != null) btn.addActionListener(action);
btn.setFocusable(false);
btn.setFocusPainted(false);
return btn;
}
代码示例来源:origin: org.scijava/scijava-ui-swing
public static JButton createButton16(final ImageIcon icon,
final String toolTip)
{
final JButton newButton = new JButton();
newButton.setMargin(new Insets(0, 0, 0, 0));
newButton.setMinimumSize(new Dimension(16, 16));
if (toolTip != null) {
newButton.setToolTipText(toolTip);
}
newButton.setIcon(icon);
return newButton;
}
代码示例来源:origin: net.imagej/ij-ui-swing
public static JButton createButton16(ImageIcon icon, String toolTip) {
JButton newButton = new JButton();
newButton.setMargin(new Insets(0, 0, 0, 0));
newButton.setMinimumSize(new Dimension(16, 16));
if (toolTip != null) {
newButton.setToolTipText(toolTip);
}
newButton.setIcon(icon);
return newButton;
}
内容来源于网络,如有侵权,请联系作者删除!