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


Java Component类代码示例

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


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

示例1: readObject

import java.awt.Component; //导入依赖的package包/类
/**
 * Deserializes this {@code DragGestureRecognizer}. This method first
 * performs default deserialization for all non-{@code transient}
 * fields. This object's {@code DragGestureListener} is then
 * deserialized as well by using the next object in the stream.
 *
 * @since 1.4
 */
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException
{
    ObjectInputStream.GetField f = s.readFields();

    DragSource newDragSource = (DragSource)f.get("dragSource", null);
    if (newDragSource == null) {
        throw new InvalidObjectException("null DragSource");
    }
    dragSource = newDragSource;

    component = (Component)f.get("component", null);
    sourceActions = f.get("sourceActions", 0) & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
    events = (ArrayList<InputEvent>)f.get("events", new ArrayList<>(1));

    dragGestureListener = (DragGestureListener)s.readObject();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:DragGestureRecognizer.java

示例2: clickOnComp

import java.awt.Component; //导入依赖的package包/类
/**
 * Moves mouse pointer in the center of a given {@code comp} component
 * and performs a left mouse button click using the {@code robot} parameter
 * with the {@code delay} delay between press and release.
 */
public static void clickOnComp(final Component comp, final Robot robot, int delay) {
    pointOnComp(comp, robot);
    robot.delay(delay);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.delay(delay);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Util.java

示例3: checkStoredGlassPane

import java.awt.Component; //导入依赖的package包/类
private void checkStoredGlassPane() {
    // remember current glass pane to set back at end of dragging over this compoment
    if (!DropGlassPane.isOriginalPaneStored() || dropPane == null) {
        if (DropGlassPane.isOriginalPaneStored()) {
            // Original panel is stored, but dropPane == null, see #236349.
            DropGlassPane.putBackOriginal();
        }
        Component comp = table.getRootPane().getGlassPane();
        DropGlassPane.setOriginalPane(table, comp, comp.isVisible());

        // set glass pane for paint selection line
        dropPane = DropGlassPane.getDefault(table);
        table.getRootPane().setGlassPane(dropPane);
        dropPane.revalidate();
        dropPane.setVisible(true);
        log("dropPane was set"); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:OutlineViewDropSupport.java

示例4: createFirstTab

import java.awt.Component; //导入依赖的package包/类
@Override
protected Component createFirstTab(JTabbedPane pane) {
    sectorRowsEditor = new SectorRowsEditor(dataPlugin, framework,
            framework.getAccessRules());
    sectorNameEditor = new SectorNameEditor(dataPlugin, framework,
            framework.getAccessRules()) {
        @Override
        protected void createReplacementPanel(JPanel ignoreMe) {
        }

        @Override
        public Stream getStream() {
            return sectorRowsEditor.getStream();
        }
    };
    sectorNameEditor.box.setVisible(false);
    sectorRowsEditor.setSectorNameEditor(sectorNameEditor);
    pane.addTab(ResourceLoader.getString("name"), sectorRowsEditor);
    return sectorNameEditor;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:21,代码来源:DFDSRoleOptionsDialog.java

示例5: handleDocumentEvent

import java.awt.Component; //导入依赖的package包/类
private void handleDocumentEvent(DocumentEvent e, Shape a,
									ViewFactory f) {
	int n = calculateLineCount();
	if (this.nlines != n) {
		this.nlines = n;
		WrappedSyntaxView.this.preferenceChanged(this, false, true);
		// have to repaint any views after the receiver.
		RSyntaxTextArea textArea = (RSyntaxTextArea)getContainer();
		textArea.repaint();
		// Must also revalidate container so gutter components, such
		// as line numbers, get updated for this line's new height
		Gutter gutter = RSyntaxUtilities.getGutter(textArea);
		if (gutter!=null) {
			gutter.revalidate();
			gutter.repaint();
		}
	}
	else if (a != null) {
		Component c = getContainer();
		Rectangle alloc = (Rectangle) a;
		c.repaint(alloc.x, alloc.y, alloc.width, alloc.height);
	}
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:24,代码来源:WrappedSyntaxView.java

示例6: converChoosers

import java.awt.Component; //导入依赖的package包/类
static DescriptablePathChooser converChoosers(final ComponentChooser[] choosers) {
    return (new DescriptablePathChooser() {
        @Override
        public boolean checkPathComponent(int depth, Object component) {
            return choosers[depth].checkComponent((Component) component);
        }

        @Override
        public int getDepth() {
            return choosers.length;
        }

        @Override
        public String getDescription() {
            return createDescription(choosers);
        }

        @Override
        public String toString() {
            return "JMenuOperator.converChoosers.DescriptablePathChooser{description = " + getDescription() + '}';
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:JMenuOperator.java

示例7: propertyChange

import java.awt.Component; //导入依赖的package包/类
/** Requests refresh of our lookup everytime component is chagned.
 */
public void propertyChange(java.beans.PropertyChangeEvent evt) {
    if (TopComponent.Registry.PROP_ACTIVATED.equals (evt.getPropertyName())) {
        org.openide.util.Utilities.actionsGlobalContext ().lookup (javax.swing.ActionMap.class);
    }
    if ("permanentFocusOwner".equals(evt.getPropertyName())) {
        Component[] arr = { (Component)evt.getNewValue() };
        if (arr[0] instanceof AbstractButton) {
            Action a = ((AbstractButton)arr[0]).getAction();
            if (a instanceof ContextAwareAction) {
                // ignore focus change into a button with our action
                return;
            }
        }
        blickActionMap(null, arr);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:GlobalActionContextImpl.java

示例8: createRenderers

import java.awt.Component; //导入依赖的package包/类
protected void createRenderers() {
	final TableCellRenderer boolRend = getDefaultRenderer(Boolean.class);
	setDefaultRenderer(Boolean.class, new DisabledCellRenderer() {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		@Override
		public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
			Component cbox = boolRend.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
			cbox.setEnabled(true);
			if (value == null) {
				Component disabled = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
				cbox.setBackground(disabled.getBackground());
				cbox.setEnabled(false);
			}
			return cbox;
		}
	});
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:22,代码来源:ConnectionsPanel.java

示例9: getListCellRendererComponent

import java.awt.Component; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {
	

	int selectedIndex = ((Integer) value).intValue();

	if (isSelected) {
		setBackground(list.getSelectionBackground());
		setForeground(list.getSelectionForeground());
	} else {
		setBackground(list.getBackground());
		setForeground(list.getForeground());
	}

	ImageIcon icon = iconArray[selectedIndex];
	setIcon(icon);
	
	return this;
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:21,代码来源:LanguageCmbBox.java

示例10: paintRaisedBevel

import java.awt.Component; //导入依赖的package包/类
protected void paintRaisedBevel(Component c, Graphics g, int x, int y, int width, int height) {
    Color oldColor = g.getColor();
    int h = height;
    int w = width;

    g.translate(x, y);

    g.setColor(getHighlightOuterColor(c));
    g.drawLine(0, 0, 0, h - 2);
    g.drawLine(1, 0, w - 2, 0);

    g.setColor(getShadowOuterColor(c));
    g.drawLine(0, h - 1, w - 1, h - 1);
    g.drawLine(w - 1, 0, w - 1, h - 2);

    g.translate(-x, -y);
    g.setColor(oldColor);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ThinBevelBorder.java

示例11: getTableCellEditorComponent

import java.awt.Component; //导入依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
	String[] tupel;
	if (value instanceof String) {
		tupel = ParameterTypeTupel.transformString2Tupel((String) value);
	} else {
		tupel = (String[]) value;
	}
	if (panel == null) {
		constructPanel(tupel);
	}
	for (int i = 0; i < editors.length; i++) {
		editors[i].getTableCellEditorComponent(null, tupel[i], false, 0, 0);
	}
	return panel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:ParameterTupelCellEditor.java

示例12: paintBorder

import java.awt.Component; //导入依赖的package包/类
/** This method is called by Swing to actually draw the borders. */
public void paintBorder(Component component, Graphics graphics, int x, int y, int width, int height) {
	if (width < 1 || height < 1)
		return;
	Color old = graphics.getColor();
	if (top != null) {
		graphics.setColor(top);
		graphics.drawLine(x, y, x + width - 1, y);
	}
	if (bottom != null) {
		graphics.setColor(bottom);
		graphics.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
	}
	if (left != null) {
		graphics.setColor(left);
		graphics.drawLine(x, y, x, y + height - 1);
	}
	if (right != null) {
		graphics.setColor(right);
		graphics.drawLine(x + width - 1, y, x + width - 1, y + height - 1);
	}
	graphics.setColor(old);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:24,代码来源:OurBorder.java

示例13: getComponent

import java.awt.Component; //导入依赖的package包/类
@Override
public Component getComponent() {
    if (gui == null) {
        gui = new TemplateChooserPanelGUI(includeTemplatesWithProjects);
        gui.addChangeListener(this);
        gui.setDefaultActionListener(new ActionListener() {

            @Override
            public void actionPerformed( ActionEvent e ) {
                if( null != wizard ) {
                    wizard.doNextClick();
                }
            }
        });
    }
    return gui;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:TemplateChooserPanel.java

示例14: getListCellRendererComponent

import java.awt.Component; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus) {
    super.getListCellRendererComponent(list,
                                       value,
                                       index,
                                       isSelected,
                                       cellHasFocus);
    if (isSelected){
        setBackground(UIManager.getColor("List.selectionBackground")); //NOI18N
        setForeground(UIManager.getColor("List.selectionForeground")); //NOI18N
    } else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
    }
    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:FilesModifiedConfirmation.java

示例15: getTreeCellRendererComponent

import java.awt.Component; //导入依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
                                              boolean sel,
                                              boolean expanded,
                                              boolean leaf, int row,
                                              boolean hasFocus) {
    if (!useTreeColors && (sel || hasFocus)) {
        SynthLookAndFeel.setSelectedUI((SynthLabelUI)SynthLookAndFeel.
                     getUIOfType(getUI(), SynthLabelUI.class),
                           sel, hasFocus, tree.isEnabled(), false);
    }
    else {
        SynthLookAndFeel.resetSelectedUI();
    }
    return super.getTreeCellRendererComponent(tree, value, sel,
                                              expanded, leaf, row, hasFocus);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SynthTreeUI.java


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