本文整理匯總了Java中java.awt.Label.setBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setBounds方法的具體用法?Java Label.setBounds怎麽用?Java Label.setBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Label
的用法示例。
在下文中一共展示了Label.setBounds方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Database
import java.awt.Label; //導入方法依賴的package包/類
Database()
{
setSize(500,580);
setVisible(true);
setLayout(null);
setTitle("Students Record");
setResizable(false);
Font fn=new Font("Georgia",Font.BOLD,12);
setFont(fn);
setForeground(Color.black);
setBackground(Color.gray);
setLocation(600,130);
statusl=new Label("Status:");
statusl.setBounds(40,450,50,30);
orderIDl=new Label("Order ID:");
orderIDl.setBounds(190,450,70,30);
statust=new TextField();
statust.setBounds(90,450,90,30);
orderIDt=new TextField();
orderIDt.setBounds(260,450,90,30);
b1=new Button("ADD record");
b1.setBounds(40,500,100,50);
b2=new Button("DELETE record");
b2.setBounds(150,500,100,50);
b3=new Button("DISPLAY record");
b3.setBounds(260,500,100,50);
b4=new Button("UPDATE record");
b4.setBounds(370,500,100,50);
ta=new TextArea();
ta.setBounds(50,80,400,350);
ta.setBackground(Color.LIGHT_GRAY);
ta.setFocusable(false);
logout=new Button("Logout");
logout.setBounds(380,450,90,30);
logout.setForeground(Color.black);
logout.setBackground(Color.orange);
titlel=new Label("Sr.No Order ID Status");
titlel.setBounds(100,50,400,30);
titlel.setForeground(Color.ORANGE);
add(statusl);
add(orderIDl);
add(statust);
add(orderIDt);
add(b1);
add(b2);
add(b3);
add(b4);
add(logout);
add(ta);
add(titlel);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
logout.addActionListener(this);
}
示例2: Update
import java.awt.Label; //導入方法依賴的package包/類
Update(String status,String orderID) {
setSize(320,120);
setVisible(true);
setResizable(false);
setTitle("Update Record");
setLayout(null);
Font fm=new Font("Georgia",Font.BOLD,13);
setFont(fm);
setLocation(640,400);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we)
{
Database.b4.setEnabled(true);
dispose();
}
});
this.status=status;
this.orderID=orderID;
tu1=new TextField();
tu1.setBounds(120,40,100,30);
tu2=new TextField();
tu2.setBounds(120,70,100,30);
lu1=new Label("Status:");
lu1.setBounds(25,40,80,20);
lu2=new Label("Order ID:");
lu2.setBounds(25,70,80,20);
up=new Button("UPDATE");
up.setBounds(230,40,70,60);
up.setForeground(Color.MAGENTA);
add(lu1);
add(lu2);
add(tu1);
add(tu2);
add(up);
up.addActionListener(this);
}
示例3: Login
import java.awt.Label; //導入方法依賴的package包/類
Login()
{
setSize(400,190);
setTitle("Login");
setVisible(true);
setResizable(false);
setLayout(null);
setLocation(400,270);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we)
{
if(!fg)
dispose();
}
});
//add(fg);
f=new Font("Georgia",Font.BOLD,14);
setFont(f);
tt1=new TextField();
tt1.setBounds(110,40,150,30);
tt2=new TextField();
tt2.setBounds(110,80,150,30);
tt2.setEchoChar('*');
ll1=new Label("Username:");
ll1.setBounds(25,40,80,20);
ll2=new Label("Password:");
ll2.setBounds(25,80,80,20);
ll3=new Label("");
ll3.setBounds(30,110,250,20);
ll3.setForeground(Color.red);
bb1=new Button("Login");
bb1.setBounds(280,125,100,50);
bb1.setForeground(Color.BLUE);
cb=new Checkbox("Remember Me",false);
cb.setBounds(40,130,150,20);
cb.setEnabled(true);
bb1.addActionListener(this);
add(tt1);
add(cb);
add(tt2);
add(ll3);
add(ll2);
add(ll1);
add(bb1);
}
示例4: MainFrame
import java.awt.Label; //導入方法依賴的package包/類
public MainFrame() {
this.setTitle(FRAME_TITLE);
this.setResizable(false);
this.setLayout(null);
Dimension windowSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds((windowSize.width - WIDTH) / 2, (windowSize.height - HEIGHT) / 2, WIDTH, HEIGHT);
Label problemIDLabel = new Label(PROBLEM_ID_LABEL);
problemIDLabel.setBounds(20, 50, 95, 20);
problemIDLabel.setFont(new Font(null, Font.PLAIN, 18));
this.add(problemIDLabel);
problemIDTextField = new TextField();
problemIDTextField.setBounds(130, 50, 145, 20);
this.add(problemIDTextField);
Label bojIDLabel = new Label(BOJ_ID_LABEL);
bojIDLabel.setBounds(20, 100, 95, 20);
bojIDLabel.setFont(new Font(null, Font.PLAIN, 18));
this.add(bojIDLabel);
bojIDTextField = new TextField(User.BOJ_ID);
bojIDTextField.setBounds(130, 100, 145, 20);
this.add(bojIDTextField);
Label bojPasswordLabel = new Label(BOJ_PW_LABEL);
bojPasswordLabel.setBounds(20, 150, 95, 20);
bojPasswordLabel.setFont(new Font(null, Font.PLAIN, 18));
this.add(bojPasswordLabel);
bojPasswordTextField = new TextField(User.BOJ_PASSWORD);
bojPasswordTextField.setEchoChar('*');
bojPasswordTextField.setBounds(130, 150, 145, 20);
this.add(bojPasswordTextField);
submitButton = new Button(SUBMIT_BUTTON);
submitButton.setBounds(75, 200, 150, 40);
submitButton.addActionListener(new SubmitButtonActionListener(this));
this.add(submitButton);
this.addWindowListener(new MainWindowListener());
this.setVisible(true);
}