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


Java JCheckBox.setFocusPainted方法代码示例

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


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

示例1: getListCellRendererComponent

import javax.swing.JCheckBox; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(
    JList<? extends JCheckBox> list, JCheckBox value, int index,
    boolean isSelected, boolean cellHasFocus) {
  JPanel panel = new JPanel(new BorderLayout());

  JCheckBox checkbox = value;
  final JCheckBox newCheck = new JCheckBox();
  final JLabel newLabel = new JLabel(checkbox.getText());
  newCheck.setSelected(checkbox.isSelected());
  // Drawing checkbox, change the appearance here
  newCheck.setBackground(isSelected ? getSelectionBackground()
      : getBackground());
  newCheck.setForeground(isSelected ? getSelectionForeground()
      : getForeground());
  newCheck.setEnabled(isEnabled());
  newCheck.setFont(getFont());
  newCheck.setFocusPainted(false);
  newCheck.setBorderPainted(true);
  newCheck.setBorder(isSelected ? UIManager
      .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
  newLabel.setOpaque(true);
  newLabel.setBackground(isSelected ? getSelectionBackground()
      : getBackground());
  newLabel.setForeground(isSelected ? getSelectionForeground()
      : getForeground());
  newLabel.setEnabled(isEnabled());
  newLabel.setFocusable(false);
  newLabel.setFont(getFont());
  newLabel.setBorder(isSelected ? UIManager
      .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
  newLabel.setIcon(checkbox.getIcon());

  panel.add(newCheck, BorderLayout.WEST);
  panel.add(newLabel, BorderLayout.CENTER);
  return panel;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:38,代码来源:JCheckBoxList.java

示例2: createCollapseControl

import javax.swing.JCheckBox; //导入方法依赖的package包/类
protected Component createCollapseControl(String title, String tooltip) {
	Box box = Box.createHorizontalBox();
	expand = new JCheckBox(title);
	expand.setBorder(new EmptyBorder(0, 4, 0, 0));
	expand.setToolTipText(tooltip);
	expand.setHorizontalTextPosition(JCheckBox.RIGHT);
	expand.setIcon(new ArrowIcon(ArrowIcon.EAST));
	setCollapsedIcon(new ArrowIcon(ArrowIcon.EAST));
	setExpandedIcon(new ArrowIcon(ArrowIcon.SOUTH));
	expand.setSelected(isExpanded());
	expand.setFocusPainted(false);
	expand.addChangeListener(new CollapseListener());
	box.add(expand);
	return box;
}
 
开发者ID:kristian,项目名称:JDigitalSimulator,代码行数:16,代码来源:CollapsiblePanel.java

示例3: createGeneralPanel

import javax.swing.JCheckBox; //导入方法依赖的package包/类
Box createGeneralPanel() {
	chkDwnldPrg = new JCheckBox(getString("SHOW_DWNLD_PRG"));
	chkDwnldPrg.setContentAreaFilled(false);
	chkDwnldPrg.setFocusPainted(false);
	chkDwnldNotify = new JCheckBox(getString("SHOW_DWNLD_PRG_NOTIFY"));
	chkDwnldPrg.setContentAreaFilled(false);
	chkDwnldPrg.setFocusPainted(false);
	chkFinishedDlg = new JCheckBox(getString("SHOW_DWNLD_DLG"));
	chkFinishedDlg.setContentAreaFilled(false);
	chkFinishedDlg.setFocusPainted(false);
	chkFinishedNotify = new JCheckBox(getString("SHOW_DWNLD_NOTIFY"));
	chkFinishedNotify.setContentAreaFilled(false);
	chkFinishedNotify.setFocusPainted(false);
	// chkAllowBrowser = new JCheckBox(getString("ALLOW_BROWSER"));
	// chkAllowBrowser.setContentAreaFilled(false);
	// chkAllowBrowser.setFocusPainted(false);
	cmbDupAction = new JComboBox(new String[] {
			StringResource.getString("DUP__OP1"),
			StringResource.getString("DUP__OP2"),
			StringResource.getString("DUP__OP3"),
			StringResource.getString("DUP__OP4") });
	cmbDupAction.setBorder(null);
	cmbDupAction.setMaximumSize(new Dimension(chkDwnldPrg
			.getPreferredSize().width,
			cmbDupAction.getPreferredSize().height));

	Box box = Box.createVerticalBox();
	box.setOpaque(false);
	box.setBorder(new EmptyBorder(10, 0, 0, 10));

	Box b0 = Box.createHorizontalBox();
	b0.add(chkDwnldPrg);
	b0.add(Box.createHorizontalGlue());
	box.add(b0);
	Box b1 = Box.createHorizontalBox();
	b1.add(chkFinishedDlg);
	b1.add(Box.createHorizontalGlue());
	box.add(b1);
	
	Box b31 = Box.createHorizontalBox();
	b31.add(chkDwnldNotify);
	b31.add(Box.createHorizontalGlue());
	box.add(b31);

	Box b3 = Box.createHorizontalBox();
	b3.add(chkFinishedNotify);
	b3.add(Box.createHorizontalGlue());
	box.add(b3);
	// Box b2 = Box.createHorizontalBox();
	// b2.add(chkAllowBrowser);
	// b2.add(Box.createHorizontalGlue());
	// box.add(b2);

	Box b4 = Box.createHorizontalBox();
	b4.add(new JLabel(getString("SHOW_DUP_ACTION")));
	b4.add(Box.createHorizontalGlue());
	b4.add(cmbDupAction);
	box.add(Box.createVerticalStrut(10));
	box.add(b4);

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

示例4: createSchedulerPanel

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

	Box b0 = Box.createHorizontalBox();
	schedule = new JCheckBox(getString("LBL_Q"));
	schedule.setContentAreaFilled(false);
	schedule.setFocusPainted(false);
	// schedule.addActionListener(this);
	b0.add(schedule);
	b0.setBorder(new EmptyBorder(0, 0, 10, 0));
	b0.add(Box.createHorizontalGlue());
	box.add(b0);

	start = new SpinnerDateModel();
	end = new SpinnerDateModel();

	startDate = new JSpinner(start);
	startDate.setEditor(new JSpinner.DateEditor(startDate,
			"dd-MMM-yy hh:mm a"));
	startDate.setMaximumSize(startDate.getPreferredSize());

	endDate = new JSpinner(end);
	endDate
			.setEditor(new JSpinner.DateEditor(endDate, "dd-MMM-yy hh:mm a"));
	endDate.setMaximumSize(endDate.getPreferredSize());

	Box b1 = Box.createHorizontalBox();
	b1.add(new JLabel(getString("LBL_START_Q")));
	b1.add(Box.createHorizontalGlue());
	b1.add(startDate);

	box.add(b1);
	box.add(Box.createRigidArea(new Dimension(10, 10)));

	Box b2 = Box.createHorizontalBox();
	b2.add(new JLabel(getString("LBL_STOP_Q")));
	b2.add(Box.createHorizontalGlue());
	b2.add(endDate);

	box.add(b2);

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


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