Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone



Clound SSD Virtual Server

Java AWT and Label (Label) - Example

Java AWT and Label (Label) - Example สำหรับ Label (java.awt.Label) จัดอยู่ในหมวดของ AWT Component ใช้แสดงข้อความในหน้าจอ Frame โดยมี Property ที่หลัก ๆ อยู่ 2 ตัวคือ getText() และ setText() สำหรับ get ค่าและ set ค่า

Java Label (Label)

Java AWT and Label (Label) - Example


Syntax
Label label = new Label();
label.setAlignment(java.awt.Label.CENTER);

label.getText() // get ค่า
label.setText(String) // set ค่า

Controls Icon Tools

Java Label (Label)

Example ตัวอย่างการใช้ Label ของ AWT แบบง่าย ๆ

MyForm.java
package com.java.myapp;

import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Label;
import java.awt.event.WindowEvent;

public class MyForm extends Frame {

	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				MyForm form = new MyForm();
				form.setVisible(true);
			}
		});
	}

	public MyForm() {

		// Create Form Frame
		super("ThaiCreate.Com Java GUI Tutorial");
		setSize(434, 216);
		setLocation(500, 280);
		setLayout(null);
		
		// Label
		Label label = new Label();
		label.setAlignment(java.awt.Label.CENTER);
		label.setText("ThaiCreate.Com");
		label.setBounds(150, 100, 150, 20);
        add(label);
        
		// Close
		 addWindowListener(new java.awt.event.WindowAdapter() {
	            public void windowClosing(WindowEvent evt) {
	            	System.exit(0);
	            }
	        });
	}
	
}

Output

Java Label (Label)

แสดง Label ของ AWT ที่อยู่บน Frame






   
Share

Property & Method (Others Related)

Java GUI AWT (Abstract Window Toolkit)
Java AWT and Frame (java.awt.Frame) - Example
Java AWT and Button (Button) - Example
Java AWT and Text Field (TextField) - Example
Java AWT and Text Area (TextArea) - Example
Java AWT and Checkbox (Checkbox) - Example
Java AWT and Choice (Choice) - Example
Java AWT and List (List) - Example
Java AWT and Scrollbar (Scrollbar) - Example
Java AWT and Scroll Pane (ScrollPane) - Example
Java AWT and Panel (Panel) - Example
Java AWT and Canvas (Canvas) - Example
Java AWT and Menu/Menu Bar (Menu/MenuBar) - Example
Java AWT and Popup Menu (PopupMenu) - Example

ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2013-09-06 08:56:38 / 2013-09-06 11:44:03
  Download : No files
 Sponsored Links / Related

 
Java GUI AWT (Abstract Window Toolkit)
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่