本文整理了Java中javax.swing.JComponent.setLocation()
方法的一些代码示例,展示了JComponent.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.setLocation()
方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:setLocation
暂无
代码示例来源:origin: ron190/jsql-injection
/**
* In this case a real component is to be painted. Setting the location
* of the component will cause it to be painted at that location.
*/
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
float x2 =
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? (0 + this.component.getWidth()) * this.component.getAlignmentX() + x
: (width - this.component.getWidth()) * this.component.getAlignmentX() + x;
float y2 = (height - this.component.getHeight()) * this.component.getAlignmentY() + y;
this.component.setLocation((int) x2 + this.addX, (int) y2 + this.addY);
}
代码示例来源:origin: RaiMan/SikuliX2
public void setActualLocation(int x, int y) {
int paintX = x;
int paintY = y;
actualBounds.setLocation(x, y);
if (hasShadow()) {
paintX -= (shadowSize - shadowOffset);
paintY -= (shadowSize - shadowOffset);
}
super.setLocation(paintX, paintY);
updateAllFollowers();
}
代码示例来源:origin: RaiMan/SikuliX2
public void setShadow(int shadowSize, int shadowOffset) {
this.shadowSize = shadowSize;
this.shadowOffset = shadowOffset;
shadowRenderer = new ShadowRenderer(this, shadowSize);
super.setSize(getActualWidth() + 2 * shadowSize, getActualHeight() + 2 * shadowSize);
Point p = getActualLocation();
p.x = p.x - shadowSize + shadowOffset;
p.y = p.y - shadowSize + shadowOffset;
super.setLocation(p.x, p.y);
}
代码示例来源:origin: danfickle/openhtmltopdf
public void setLocation(int x, int y) {
_component.setLocation(x, y);
}
代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget
@Override
public void dragFrame(JComponent f, int newX, int newY) {
f.setLocation(newX, newY);
}
});
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sets the y coordinate of this bean
*
* @param newY an <code>int</code> value
*/
public void setY(int newY) {
m_y = newY;
((JComponent) m_bean).setLocation(m_x, m_y);
((JComponent) m_bean).validate();
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Sets the y coordinate of this bean
*
* @param newY an <code>int</code> value
*/
public void setY(int newY) {
m_y = newY;
((JComponent) m_bean).setLocation(m_x, m_y);
((JComponent) m_bean).validate();
}
}
代码示例来源:origin: stackoverflow.com
DragLayout layout = new DragLayout();
JComponent field = new JPanel(layout);
JComponent player = new JLabel("I'm moving around");
field.add(player);
player.setLocation(200, 200);
frame.add(new JScrollPane(field));
frame.pack();
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
public void mouseDragged(MouseEvent e)
{
if (drag == true)
{
JComponent jc = (JComponent)e.getSource();
jc.setLocation(jc.getX()+e.getX(), jc.getY()+e.getY());
}
}
代码示例来源:origin: MegaMek/mekhq
/**
* In this case a real component is to be painted. Setting the location
* of the component will cause it to be painted at that location.
*/
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
{
float x2 = (width - component.getWidth()) * component.getAlignmentX() + x;
float y2 = (height - component.getHeight()) * component.getAlignmentY() + y;
component.setLocation((int)x2, (int)y2);
}
代码示例来源:origin: undera/jmeter-plugins
/**
* In this case a real component is to be painted. Setting the location
* of the component will cause it to be painted at that location.
*/
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
float x2 = (width - component.getWidth()) * component.getAlignmentX() + x;
float y2 = (height - component.getHeight()) * component.getAlignmentY() + y;
component.setLocation((int) x2, (int) y2);
}
代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter
/**
* In this case a real component is to be painted. Setting the location
* of the component will cause it to be painted at that location.
*/
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
float x2 = (width - component.getWidth()) * component.getAlignmentX() + x;
float y2 = (height - component.getHeight()) * component.getAlignmentY() + y;
component.setLocation((int) x2, (int) y2);
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public void setX(int _x)
{
if(embed_!=null) embed_.setLocation(new Point(_x,getY()));
super.setX(_x);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore
public void layoutContainer(Container parent) {
super.layoutContainer( parent );
Point point = myErrorComponent.getLocation();
myErrorComponent.setLocation( point.x ,
(int)(parent.getHeight() -
myErrorComponent.getPreferredSize().getHeight()) / 2);
}
}
代码示例来源:origin: freeplane/freeplane
public void configureRenderer(IViewerFactory viewerFactory, URI uri, Dimension size, JComponent renderer) {
renderer.setBorder(new MatteBorder(BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, BORDER_WIDTH, Color.BLACK));
renderer.setPreferredSize(size);
renderer.setSize(size);
Dimension viewerSize = new Dimension(size.width - 2 * BORDER_WIDTH,
size.height - 2 * BORDER_WIDTH);
JComponent viewer = createViewer(viewerFactory, uri, viewerSize);
renderer.add(viewer);
viewer.setLocation(BORDER_WIDTH, BORDER_WIDTH);
}
代码示例来源:origin: com.sikulix/sikulixapi
public void setActualLocation(int x, int y) {
int paintX = x;
int paintY = y;
actualBounds.setLocation(x, y);
if (hasShadow()) {
paintX -= (shadowSize - shadowOffset);
paintY -= (shadowSize - shadowOffset);
}
super.setLocation(paintX, paintY);
updateAllFollowers();
}
代码示例来源:origin: RPTools/maptool
private void showGlassPane(JComponent component, int x, int y, boolean modal) {
component.setSize(component.getPreferredSize());
component.setLocation(x, y);
glassPane.setLayout(null);
glassPane.add(component);
glassPane.setModel(modal);
glassPane.setVisible(true);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
private void addFeedbackComponent(Component contentComponent, JComponent messageComponent, Map<Object, ValidationResult> keyMap, int xOffset, int yOffset) {
ValidationResult result = getAssociatedResult(messageComponent, keyMap);
JComponent feedbackComponent = createFeedbackComponent(result, contentComponent);
if (feedbackComponent == null) {
return;
}
add(feedbackComponent, new Integer(FEEDBACK_LAYER));
Point overlayPosition = getFeedbackComponentOrigin(feedbackComponent, contentComponent);
overlayPosition.translate(xOffset, yOffset);
feedbackComponent.setLocation(overlayPosition);
}
代码示例来源:origin: com.sikulix/sikulixapi
public void setShadow(int shadowSize, int shadowOffset) {
this.shadowSize = shadowSize;
this.shadowOffset = shadowOffset;
shadowRenderer = new ShadowRenderer(this, shadowSize);
super.setSize(getActualWidth() + 2 * shadowSize, getActualHeight() + 2 * shadowSize);
Point p = getActualLocation();
p.x = p.x - shadowSize + shadowOffset;
p.y = p.y - shadowSize + shadowOffset;
super.setLocation(p.x, p.y);
}
代码示例来源:origin: khuxtable/seaglass
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
super.setBoundsForFrame(f, newX, newY, newWidth, newHeight);
if (taskBar != null && newY >= taskBar.getY()) {
f.setLocation(f.getX(), taskBar.getY() - f.getInsets().top);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!