Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ListLayout.java
Package: src.zip [view]
Upload User: luxiaowei
Upload Date: 2022-06-06
Package Size: 58k
Code Size: 1k
Category:
J2ME
Development Platform:
Java
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.framework;
- import javax.microedition.lcdui.Graphics;
- /**
- *
- * @author swaroop_kumar
- */
- public class ListLayout implements Layout{
- int startX,startY,padding,horAllignment;
- public ListLayout(int startX, int startY, int padding, int horAllignment) {
- this.startX = startX;
- this.startY = startY;
- this.padding = padding;
- this.horAllignment = horAllignment;
- }
- public void applyLayout(ScrollableContainer container) {
- int _y = startY;
- int containerWidth = container.getWidth() ;
- if(container.isScrollBarPresent())
- {
- containerWidth -= ScrollableContainer.SCROLL_BAR_WIDTH;
- }
- for (int i = 0; i < container.childrens.size(); i++) {
- UIControl control = (UIControl)container.childrens.elementAt(i);
- int x = startX;
- if(horAllignment == Graphics.HCENTER)
- {
- if(control.getWidth() > containerWidth)
- {
- control.setWidth(containerWidth);
- }
- x = (containerWidth - control.getWidth()) >> 1;
- }else if(horAllignment == Graphics.RIGHT)
- {
- x = container.getWidth() - control.getWidth() - startX;
- }
- control.setPoistion(x, _y);
- _y += control.getHeight() + padding;
- }
- }
- }