Java Code Examples for javax.swing.JButton.setName()

The following are Jave code examples for showing how to use setName() of the javax.swing.JButton class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: Buttons.java   Source Code and License Vote up 6 votes
@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]);
}
 
Example 2
Project: xdman   File: XDMComboBoxUI.java   Source Code and License Vote up 5 votes
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;
}
 
Example 3
Project: xdman   File: ConfigDialog.java   Source Code and License Vote up 5 votes
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;
}
 
Example 4
Project: xdman   File: YoutubeGrabberDlg.java   Source Code and License Vote up 4 votes
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);
}
 
Example 5
Project: xdman   File: XDMSpinnerUI.java   Source Code and License Vote up 4 votes
protected Component createNextButton() {
	JButton c = new BasicArrowButton(SwingConstants.NORTH);
	c.setName("Spinner.nextButton");
	installNextButtonListeners(c);
	return c;
}
 
Example 6
Project: xdman   File: ConfigDialog.java   Source Code and License Vote up 4 votes
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;
}
 
Example 7
Project: xdman   File: ConfigDialog.java   Source Code and License Vote up 4 votes
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;
}
 
Example 8
Project: xdman   File: ConfigDialog.java   Source Code and License Vote up 4 votes
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);
}