当前位置: 首页>>代码示例>>Java>>正文


Java JButton.setName方法代码示例

本文整理汇总了Java中javax.swing.JButton.setName方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setName方法的具体用法?Java JButton.setName怎么用?Java JButton.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.setName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buttons

import javax.swing.JButton; //导入方法依赖的package包/类
@NbBundle.Messages({
    "CTL_OK=OK",
    "CTL_Cancel=Cancel",
})
public static JButton[] buttons() {
    final Buttons btns = new Buttons();
    final Object[] all = btns.list();
    for (int i = 0; i < all.length; i += 3) {
        JButton b = new JButton();
        b.setName(all[i].toString());
        b.setText(all[i + 1].toString());
        if (Boolean.TRUE.equals(all[i + 2])) {
            b.setEnabled(false);
        }
        btns.arr.add(b);
    }
    if (btns.arr.isEmpty()) {
        JButton ok = new JButton(Bundle.CTL_OK());
        ok.setName("OK");
        btns.arr.add(ok);
        btns.arr.add(new JButton(Bundle.CTL_Cancel()));
    }
    return btns.arr.toArray(new JButton[0]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:Buttons.java

示例2: createNextButton

import javax.swing.JButton; //导入方法依赖的package包/类
protected Component createNextButton() {
	JButton c = new BasicArrowButton(SwingConstants.NORTH);
	c.setName("Spinner.nextButton");
	installNextButtonListeners(c);
	return c;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:7,代码来源:XDMSpinnerUI.java

示例3: createArrowButton

import javax.swing.JButton; //导入方法依赖的package包/类
protected JButton createArrowButton() {
	JButton button = new XDMButton();
	button.setIcon(XDMIconMap.getIcon("DOWN_ARROW"));
	button.setBorderPainted(false);
	button.setFocusPainted(false);
	button.setName("ComboBox.arrowButton");
	return button;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:9,代码来源:XDMComboBoxUI.java

示例4: createTypesPanel

import javax.swing.JButton; //导入方法依赖的package包/类
Box createTypesPanel() {
	Box box = Box.createVerticalBox();
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	Box b0 = Box.createHorizontalBox();
	b0.add(new JLabel(getString("LBL_FILE_TYPES")));
	b0.setBorder(new EmptyBorder(0, 0, 10, 0));
	b0.add(Box.createHorizontalGlue());
	box.add(b0);

	txtArea = new JTextArea();
	txtArea.setWrapStyleWord(true);
	txtArea.setLineWrap(true);

	JScrollPane jsp = new JScrollPane(txtArea);
	jsp.setPreferredSize(new Dimension(10, 10));

	box.add(jsp);

	Box b = Box.createHorizontalBox();
	b.add(Box.createHorizontalGlue());

	defaults = new JButton(getString("LBL_DEFAULTS"));
	defaults.addActionListener(this);
	defaults.setName("LBL_DEFAULTS");

	b.add(defaults);
	b.setBorder(new EmptyBorder(5, 0, 5, 0));
	box.add(b);

	return box;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:34,代码来源:ConfigDialog.java

示例5: createP1

import javax.swing.JButton; //导入方法依赖的package包/类
void createP1() {
	Box p11 = Box.createVerticalBox();
	p11.setBackground(Color.white);
	p11.setOpaque(true);
	p1 = new JPanel(new BorderLayout());
	Box b1 = Box.createHorizontalBox();
	b1.setBackground(Color.white);
	b1.setOpaque(true);
	b1.setBorder(new EmptyBorder(25, 15, 10, 15));
	JLabel lbl = new JLabel();
	lbl.setText(StringResource.getString("YT_LBL1"));
	lbl.setOpaque(false);
	JLabel icon = new JLabel(XDMIconMap.getIcon("YT_ICON"));
	icon.setMaximumSize(new Dimension(75, 75));
	b1.add(icon);
	b1.add(Box.createRigidArea(new Dimension(10, 10)));
	b1.add(lbl);
	ytaddr = new JTextField();
	ytaddr.setMaximumSize(new Dimension(ytaddr.getMaximumSize().width,
			ytaddr.getPreferredSize().height));
	p11.add(b1);
	Box b2 = Box.createHorizontalBox();
	b2.add(ytaddr);
	b2.setBackground(Color.white);
	b2.setOpaque(true);
	b2.setBorder(new EmptyBorder(10, 15, 15, 15));
	p11.add(b2);
	p11.add(Box.createVerticalStrut(20));

	p1.add(p11);

	Box b3 = Box.createHorizontalBox();
	get_video = new JButton(StringResource.getString("YT_LBL4"));
	btnDim = get_video.getPreferredSize();
	get_video.setName("YT_LBL4");
	get_video.addActionListener(this);
	cancel = new JButton(StringResource.getString("CANCEL"));
	cancel.setName("CANCEL");
	cancel.addActionListener(this);
	cancel.setPreferredSize(btnDim);
	b3.add(Box.createHorizontalGlue());
	b3.add(get_video);
	b3.add(Box.createRigidArea(new Dimension(10, 10)));
	b3.add(cancel);
	b3.setBorder(new EmptyBorder(10, 15, 10, 15));
	b3.setOpaque(true);
	b3.setBackground(StaticResource.titleColor);

	p1.add(b3, BorderLayout.SOUTH);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:51,代码来源:YoutubeGrabberDlg.java

示例6: createCredentialPanel

import javax.swing.JButton; //导入方法依赖的package包/类
JPanel createCredentialPanel() {
	JPanel box = new JPanel(new BorderLayout(5, 5));
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	model = new CredentialTableModel();
	Authenticator.getInstance().addObserver(model);
	table = new JTable(model);

	if (System.getProperty("xdm.defaulttheme") != null) {
		table.getTableHeader().setDefaultRenderer(
				new XDMTableHeaderRenderer());
	}
	table.setFillsViewportHeight(true);

	JScrollPane jsp = new JScrollPane(table);
	// jsp.setOpaque(false);
	// jsp.getViewport().setOpaque(false);

	jsp.setPreferredSize(new Dimension(10, 10));
	// box.add(table);
	box.add(jsp);

	Box b = Box.createHorizontalBox();
	b.add(Box.createHorizontalGlue());

	addAuth = new JButton(getString("LBL_ADD_AUTH"));
	addAuth.setName("LBL_ADD_AUTH");
	addAuth.addActionListener(this);
	removeAuth = new JButton(getString("LBL_DEL_AUTH"));
	removeAuth.setName("LBL_DEL_AUTH");
	removeAuth.addActionListener(this);
	editAuth = new JButton(getString("LBL_EDT_AUTH"));
	editAuth.setName("LBL_EDT_AUTH");
	editAuth.addActionListener(this);

	addAuth.setPreferredSize(removeAuth.getPreferredSize());
	editAuth.setPreferredSize(removeAuth.getPreferredSize());

	b.add(addAuth);
	b.add(Box.createHorizontalStrut(10));
	b.add(removeAuth);
	b.add(Box.createHorizontalStrut(10));
	b.add(editAuth);
	box.add(b, BorderLayout.SOUTH);
	return box;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:48,代码来源:ConfigDialog.java

示例7: createSaveToPanel

import javax.swing.JButton; //导入方法依赖的package包/类
Box createSaveToPanel() {
	Box box = Box.createVerticalBox();
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	Box b = Box.createHorizontalBox();
	b.add(new JLabel(getString("TMP_DIR")));
	b.add(Box.createHorizontalGlue());
	box.add(b);

	Box box1 = Box.createHorizontalBox();
	box1.setBorder(new EmptyBorder(5, 0, 5, 0));

	txtTmpDir = new JTextField(15);
	txtTmpDir.setMaximumSize(new Dimension(
			txtTmpDir.getMaximumSize().width,
			txtTmpDir.getPreferredSize().height));
	txtTmpDir.setEditable(false);
	txtTmpDir.setBackground(Color.white);

	box1.add(txtTmpDir);

	box1.add(Box.createRigidArea(new Dimension(10, 10)));

	br1 = new JButton("...");
	br1.addActionListener(this);
	br1.setName("BR_TMP_DIR");
	box1.add(br1);

	box.add(box1);

	Box b2 = Box.createHorizontalBox();
	b2.add(new JLabel(getString("DST_DIR")));
	b2.add(Box.createHorizontalGlue());
	box.add(b2);

	Box box2 = Box.createHorizontalBox();
	box2.setBorder(new EmptyBorder(5, 0, 5, 0));

	txtDstDir = new JTextField(15);
	txtDstDir.setMaximumSize(new Dimension(
			txtDstDir.getMaximumSize().width,
			txtDstDir.getPreferredSize().height));
	txtDstDir.setEditable(false);

	box2.add(txtDstDir);

	box2.add(Box.createRigidArea(new Dimension(10, 10)));

	br2 = new JButton("...");
	br2.addActionListener(this);
	br2.setName("BR_DST_DIR");
	box2.add(br2);

	txtDstDir.setBackground(Color.white);

	box.add(box2);

	box.add(Box.createVerticalGlue());

	return box;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:63,代码来源:ConfigDialog.java

示例8: createRightPanel

import javax.swing.JButton; //导入方法依赖的package包/类
void createRightPanel() {
	rightPanel = new JPanel(new BorderLayout());
	rightPanel.setBackground(Color.white);

	TitlePanel tp = new TitlePanel(new BorderLayout(), this);
	tp.setBackground(Color.WHITE);

	title = new JLabel();
	title.setBorder(new EmptyBorder(20, 20, 20, 20));
	title.setFont(title.getFont().deriveFont(Font.BOLD,
			title.getFont().getSize() * 1.2f));
	tp.add(title, BorderLayout.CENTER);

	rightPanel.add(tp, BorderLayout.NORTH);

	pane = new JPanel(new BorderLayout());
	pane.setBackground(Color.white);

	jsp = new JScrollPane(pane);
	jsp.setBackground(Color.white);
	jsp.setBorder(new EmptyBorder(10, 10, 10, 0));

	rightPanel.add(jsp);

	save = new JButton(getString("SAVE"));
	save.setName("SAVE");
	save.addActionListener(this);
	cancel = new JButton(getString("CANCEL"));
	cancel.setName("CANCEL");
	cancel.addActionListener(this);
	save.setPreferredSize(cancel.getPreferredSize());
	Box downBox = Box.createHorizontalBox();
	downBox.add(Box.createHorizontalGlue());
	downBox.add(save);
	downBox.add(Box.createRigidArea(new Dimension(5, 5)));
	downBox.add(cancel);
	downBox.setBorder(new EmptyBorder(10, 10, 10, 10));
	rightPanel.add(downBox, BorderLayout.SOUTH);

	centerPanel.add(rightPanel);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:42,代码来源:ConfigDialog.java


注:本文中的javax.swing.JButton.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。