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


Java JLayer类代码示例

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


JLayer类属于javax.swing包,在下文中一共展示了JLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CardCellRenderer

import javax.swing.JLayer; //导入依赖的package包/类
/**
 * Creates a {@link CardCellRenderer} that is used by lists containing {@link Card}s.
 */
public CardCellRenderer() {
	setVerticalTextPosition(SwingConstants.BOTTOM);
	setHorizontalTextPosition(SwingConstants.CENTER);
	setHorizontalAlignment(CENTER);
	setOpaque(false);
	layer = new JLayer<>(this, new CardLayerUI());
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:CardCellRenderer.java

示例5: installUI

import javax.swing.JLayer; //导入依赖的package包/类
@Override
public void installUI(JComponent c) {
  super.installUI(c);

  JLayer jlayer = (JLayer)c;
  jlayer.setLayerEventMask(
    AWTEvent.MOUSE_EVENT_MASK |
    AWTEvent.MOUSE_MOTION_EVENT_MASK
  );


}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:13,代码来源:SpotlightLayerUI.java

示例6: processMouseMotionEvent

import javax.swing.JLayer; //导入依赖的package包/类
@Override
protected void processMouseMotionEvent(MouseEvent e, JLayer l) {
  Point p = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), l);
  mX = p.x;
  mY = p.y;
  l.repaint();
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:8,代码来源:SpotlightLayerUI.java

示例7: installUI

import javax.swing.JLayer; //导入依赖的package包/类
@Override
public void installUI(JComponent jc) {
	super.installUI(jc);
	if (jc instanceof JLayer<?>) {
		((JLayer<?>) jc).setLayerEventMask(AWTEvent.MOUSE_EVENT_MASK 
				| AWTEvent.MOUSE_MOTION_EVENT_MASK);
	}
}
 
开发者ID:rsanchez-wsu,项目名称:sp16-ceg3120,代码行数:9,代码来源:CloseableTabbedPaneLayer.java

示例8: uninstallUI

import javax.swing.JLayer; //导入依赖的package包/类
@Override
public void uninstallUI(JComponent comp) {
	if (comp instanceof JLayer<?>) {
		((JLayer<?>) comp).setLayerEventMask(0);
		super.uninstallUI(comp);
	}
}
 
开发者ID:rsanchez-wsu,项目名称:sp16-ceg3120,代码行数:8,代码来源:CloseableTabbedPaneLayer.java

示例9: 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

示例10: createTabPane

import javax.swing.JLayer; //导入依赖的package包/类
/**
 * Creates the tab pane that holds all the tabs for the application.
 */
private void createTabPane() {
	tabPane = new MainTabPane();
	
	add(new JLayer<JTabbedPane>(tabPane, new CloseableTabbedPaneLayer()));
	//add(tabPane);
}
 
开发者ID:rsanchez-wsu,项目名称:sp16-ceg3120,代码行数:10,代码来源:MainGui.java

示例11: 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

示例12: installUI

import javax.swing.JLayer; //导入依赖的package包/类
public void installUI(JComponent c) {  
//    	System.out.println("install UI");
        super.installUI(c);  
        JLayer jlayer = (JLayer) c;  
        // 启动鼠标事件和鼠标移动事件  
//            jlayer.setLayerEventMask(AWTEvent.MOUSE_EVENT_MASK  
//                    | AWTEvent.MOUSE_MOTION_EVENT_MASK);  
    }
 
开发者ID:jyhong836,项目名称:BaiduYunAssistant,代码行数:9,代码来源:LoadingLayer.java

示例13: ProductSceneViewTopComponent

import javax.swing.JLayer; //导入依赖的package包/类
public ProductSceneViewTopComponent(ProductSceneView view, UndoRedo undoRedo) {
        super(view.getRaster());
        this.view = view;
        this.undoRedo = undoRedo != null ? undoRedo : UndoRedo.NONE;
        this.nodeRenameHandler = new NodeRenameHandler();
        this.selection = Selection.EMPTY;
        setToolTipText(view.getRaster().getDescription());
        setIcon(ImageUtilities.loadImage("org/esa/snap/rcp/icons/RsBandAsSwath.gif"));
        updateDisplayName();
        setName(getDisplayName());
/*
        // checkme - this is ugly and not wanted (nf), the node will either passed in or we'll have
        // a central node factory, e.g. via an ExtensionObject
        Node node = null;
        try {
            if (raster instanceof Mask) {
                node = new MNode((Mask) raster, undoRedo);
            } else if (raster instanceof Band) {
                node = new BNode((Band) raster, undoRedo);
            } else if (raster instanceof TiePointGrid) {
                node = new TPGNode((TiePointGrid) raster, undoRedo);
            }
        } catch (IntrospectionException e) {
            Exceptions.printStackTrace(e);
        }
        if (node != null) {
            setActivatedNodes(new Node[]{node});
        }
*/
        setLayout(new BorderLayout());
        add(new JLayer<>(this.view, new ProductSceneViewLayerUI()), BorderLayout.CENTER);
    }
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:33,代码来源:ProductSceneViewTopComponent.java

示例14: HostFrame

import javax.swing.JLayer; //导入依赖的package包/类
public HostFrame(LumpiApplication<? extends LumpiApplicationContext, ? extends BindableWindow> application) {
    this.appRef = new WeakReference<>(application);
    this.pca = new PropertyChangeAwareAdapter(this);
    this.windowListener = new WindowListener();
    this.displayHost = initDisplayHost();
    this.layer = new JLayer<>();
    init();
}
 
开发者ID:moosbusch,项目名称:Lumpi,代码行数:9,代码来源:HostFrame.java

示例15: processMouseEvent

import javax.swing.JLayer; //导入依赖的package包/类
@Override
protected void processMouseEvent( MouseEvent e, JLayer<? extends JPanel> panel ) {
    super.processMouseEvent( e, panel );
    if( e.getButton() == MouseEvent.BUTTON1 )
        e.consume();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:HtmlPreviewElement.java


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