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


Java JLayer.getView方法代码示例

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


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

示例1: paint

import javax.swing.JLayer; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
	super.paint(g, c);

	JLayer jlayer = (JLayer) c;
	JFormattedTextField ftf = (JFormattedTextField) jlayer.getView();
	if (!ftf.isEditValid()) {
		Graphics2D g2 = (Graphics2D) g.create();

		// Paint the red X.
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		int w = c.getWidth();
		int h = c.getHeight();
		int s = 8;
		int pad = 4;
		int x = w - pad - s;
		int y = (h - s) / 2;
		g2.setPaint(Color.red);
		g2.fillRect(x, y, s + 1, s + 1);
		g2.setPaint(Color.white);
		g2.drawLine(x, y, x + s, y + s);
		g2.drawLine(x, y + s, x + s, y);

		g2.dispose();
	}
}
 
开发者ID:Mgamerz,项目名称:me3modmanager,代码行数:27,代码来源:StarterKitWindow.java

示例2: paint

import javax.swing.JLayer; //导入方法依赖的package包/类
@Override
public void paint(Graphics gr, JComponent jc) {
	super.paint(gr, jc);
	if (jc instanceof JLayer<?>) {
		JLayer<?> jlayer = (JLayer<?>) jc;
		JTabbedPane tabPane =  (JTabbedPane) jlayer.getView();
		for (int i = 0; i < tabPane.getTabCount(); i++) {
			Rectangle rect = tabPane.getBoundsAt(i);
			Dimension dim = button.getPreferredSize();
			int x0 = rect.x + rect.width - dim.width - 2;
			int y0 = rect.y + (rect.height - dim.height) / 2;
			Rectangle r2 = new Rectangle(x0, y0, dim.width, dim.height);
			button.setForeground(r2.contains(pt) ? Color.RED : Color.BLACK);
			SwingUtilities.paintComponent(gr, button, p0, r2);
		}
	}
}
 
开发者ID:rsanchez-wsu,项目名称:sp16-ceg3120,代码行数:18,代码来源:CloseableTabbedPaneLayer.java

示例3: processMouseEvent

import javax.swing.JLayer; //导入方法依赖的package包/类
@Override
protected void processMouseEvent(MouseEvent event, JLayer<? extends JTabbedPane> jl) {
	if (event.getID() == MouseEvent.MOUSE_CLICKED) {
		pt.setLocation(event.getPoint());
		JTabbedPane tabbedPane = (JTabbedPane) jl.getView();
		int index = tabbedPane.indexAtLocation(pt.x, pt.y);
		if (index >= 0) {
			Rectangle rect = tabbedPane.getBoundsAt(index);
			Dimension d0 = button.getPreferredSize();
			int x0 = rect.x + rect.width - d0.width - 2;
			int y0 = rect.y + (rect.height - d0.height) / 2;
			Rectangle r0 = new Rectangle(x0, y0, d0.width, d0.height);
			if (r0.contains(pt)) {
				tabbedPane.removeTabAt(index);
			}
		}
		jl.getView().repaint();
	}
}
 
开发者ID:rsanchez-wsu,项目名称:sp16-ceg3120,代码行数:20,代码来源:CloseableTabbedPaneLayer.java

示例4: processMouseMotionEvent

import javax.swing.JLayer; //导入方法依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent e0, JLayer<? extends JTabbedPane> jl) {
	pt.setLocation(e0.getPoint());
	JTabbedPane tabbedPane = (JTabbedPane) jl.getView();
	int index = tabbedPane.indexAtLocation(pt.x, pt.y);
	if (index >= 0) {
		tabbedPane.repaint(tabbedPane.getBoundsAt(index));
	} else {
		tabbedPane.repaint();
	}
}
 
开发者ID:rsanchez-wsu,项目名称:sp16-ceg3120,代码行数:12,代码来源:CloseableTabbedPaneLayer.java

示例5: paint

import javax.swing.JLayer; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c)
{
	super.paint(g, c);

	JLayer<?> jlayer = (JLayer<?>) c;

	JFormattedTextField jFormattedTextField = (JFormattedTextField) jlayer
			.getView();
	if (jFormattedTextField.getFormatterFactory() != null
			&& !jFormattedTextField.isEditValid())
	{
		Graphics2D g2 = (Graphics2D) g.create();

		// Paint a red X
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		int w = c.getWidth();
		int h = c.getHeight();
		// int pad = 4;
		int s = 10;
		int pad = 10;
		int x = w - pad - s;
		int y = (h - s) / 2;
		ImageIcon icon = IconBuilder
				.build(frame.getMessenger().getConfig(),
						IconBuilder.INVALID_FIELD);
		g2.drawImage(icon.getImage(), x, y, null);
		g2.dispose();
	}
}
 
开发者ID:jramoyo,项目名称:quickfix-messenger,代码行数:32,代码来源:FieldValidationLayerUI.java


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