import
java.awt.FlowLayout;
import
javax.swing.JFrame; →
滙入所需要的
import
javax.swing.JLabel;
public
class
tuna
extends
JFrame{
private
JLabel item1;
public
tuna(){
super("The
title Bar");
→標題
setLayout(new
FlowLayout());
item1
= new
JLabel("This
is a sentences");
→文字在顯示框
item1.setToolTipText("This
is gonna show up on hover");
add(item1);
}
}
import
javax.swing.JFrame;
class
apples{
public
static
void
main(String[] args){
tuna
bucky = new
tuna();
bucky.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
→
按X関閉
bucky.setSize(275,180);
→此顯示框的大小
bucky.setVisible(true);
→顯示此顯示框
}
}
這是運行時的結果:

沒有留言:
張貼留言