本文整理了Java中javax.swing.JPanel.setLocation()
方法的一些代码示例,展示了JPanel.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setLocation()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setLocation
暂无
代码示例来源:origin: magefree/mage
@Override
public void doLayout() {
// Position transform and show source buttons
buttonPanel.setLocation(cardXOffset, cardYOffset);
buttonPanel.setSize(cardWidth, cardHeight);
int x = cardWidth / 20;
int y = cardHeight / 10;
if (dayNightButton != null) {
dayNightButton.setLocation(x, y);
y += 25;
y += 5;
}
if (showCopySourceButton != null) {
showCopySourceButton.setLocation(x, y);
}
}
代码示例来源:origin: stackoverflow.com
private JPanel clicked;
@Override
public void mouseClicked(MouseEvent e) {
if (clicked != null) {
clicked.setLocation(e.getX(), e.getY());
clicked = null;
} else {
// Figure out if any panel was clicked and assign
// a reference to clicked
}
}
代码示例来源:origin: magefree/mage
iconPanel.setLocation(realCardSize.x, realCardSize.y);
iconPanel.setSize(realCardSize.width, realCardSize.height);
counterPanel.setLocation(realCardSize.x, realCardSize.y);
counterPanel.setSize(realCardSize.width, realCardSize.height);
int size = cardWidth > WIDTH_LIMIT ? 40 : 20;
代码示例来源:origin: stackoverflow.com
JPanel p = new JPanel();
p.setLayout(new GridLayout(2, 1));
p.add(new JLabel("Health : 90%"));
p.add(new JLabel("Carrying weight : 4 Kg"));
this.add(p); //JFrame
p.setSize(100, 50);
p.setLocation(100, 100);
p.setVisible(true);
代码示例来源:origin: stackoverflow.com
JPanel game = new JPanel(){
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
//custom painting here
}
};
//game.setLayout(null); don't use null layout
game.setLocation(0,0);
game.setSize(500,700);
game.setBackground(Color.WHITE);
game.setBorder(BorderFactory.createLineBorder(Color.black));
代码示例来源:origin: stackoverflow.com
public void handleDrag(JPanel panel){
final JPanel p = panel;
panel.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent me) {
me.translatePoint(me.getComponent().getLocation().x, me.getComponent().getLocation().y);
p.setLocation(me.getX(), me.getY());
}
});
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-midp
@Override
public void layoutContainer(Container parent) {
super.layoutContainer(parent);
innerPanel.setLocation(0,
(int) (parent.getHeight() -
separator.getPreferredSize().getHeight()) / 2);
}
});
代码示例来源:origin: nz.ac.waikato.cms.moa/moa
private void addComponents() {
axesPanel = new GraphAxes();
curvePanel = new GraphCurve();
eventPanel = new JPanel();
curvePanel.setLocation(x_offset_left + 1, y_offset_top);
eventPanel.setLocation(x_offset_left + 1, 0);
eventPanel.setLayout(null);
add(axesPanel);
axesPanel.add(curvePanel);
axesPanel.add(eventPanel);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setTop(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustTop(this, aValue);
}
super.setLocation(getLeft(), aValue);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setTop(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustTop(this, aValue);
}
super.setLocation(getLeft(), aValue);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setTop(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustTop(this, aValue);
}
super.setLocation(getLeft(), aValue);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setTop(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustTop(this, aValue);
}
super.setLocation(getLeft(), aValue);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setTop(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustTop(this, aValue);
}
super.setLocation(getLeft(), aValue);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
private void show() {
frame.getLayeredPane().add(backgroundPanel, JLayeredPane.PALETTE_LAYER);
imagePanel.setLocation(((frame.getLayeredPane().getWidth() - imagePanel.getWidth()) / 2),
(frame.getLayeredPane().getHeight() - imagePanel.getHeight()) / 2);
frame.getLayeredPane().add(imagePanel, JLayeredPane.POPUP_LAYER);
}
内容来源于网络,如有侵权,请联系作者删除!