java gui 移动_JavaGUI如图:当鼠标按left按钮,右边的字会移动到左边按 爱问知识人...
import t。*;
import javax。swing。*;
import t。Rectangle;
import t。event。ActionListener;
import t。event。ActionEvent;
/**
* Title:
*
* Description:
*
* Copyright: Copyright (c) 2006
*
* Company:
*
* @author zwh
* @version 1。
0
*/
public class Frame1
extends JFrame {
public Frame1() {
try {
jbInit();
}
catch (Exception exception) {
intStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane()。
setLayout(null);
tToolTipText("");
tText("文字位置");
tBounds(new Rectangle(111, 0, 284, 275));
tBounds(new Rectangle(12, 145, 82, 27));
tText("右邊");
dActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton3_actionPerformed(e);
}
});
tBounds(new Rectangle(11, 110, 83, 25));
tText("中間");
dActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton2_actionPerformed(e);
}
});
tBounds(new Rectangle(11, 67, 83, 28));
tText("左邊");
dActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
tContentPane()。
add(jButton1, null);
tContentPane()。add(jButton2, null);
tContentPane()。add(jButton3, null);
tContentPane()。
add(jLabel1, null);
}
JLabel jLabel1 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
public void jButton1_actionPerformed(ActionEvent e) {
tHorizontalAlignment(SwingConstants。
LEFT);
}
public void jButton2_actionPerformed(ActionEvent e) {
tHorizontalAlignment(SwingConstants。CENTER);
}
public void jButton3_actionPerformed(ActionEvent e) {
tHorizontalAlignment(SwingConstants。
RIGHT);
}
public static void main(String[] args) {
Frame1 f = new Frame1();
tSize(600,400);
ow();
}
}。
全部
總結(jié)
以上是生活随笔為你收集整理的java gui 移动_JavaGUI如图:当鼠标按left按钮,右边的字会移动到左边按 爱问知识人...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 亚马逊市值蒸发近9千亿 遭到反垄断处罚被
- 下一篇: 苹果设计师操刀!成立22年的蒙牛更换新L