java中conname_Java Component.getName方法代碼示例

本文整理匯總了Java中com.codename1.ui.Component.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java Component.getName方法的具體用法?Java Component.getName怎麽用?Java Component.getName使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.codename1.ui.Component的用法示例。

在下文中一共展示了Component.getName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: onFilterButtonAction

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

public void onFilterButtonAction(Component c, ActionEvent event)

{

String filterName = c.getName();

if (filterName.equals("btnSearchFilterAll")) {

isActiveFilterArray[0] = !isActiveFilterArray[0];

isActiveFilterArray[1] = false;

isActiveFilterArray[2] = false;

isActiveFilterArray[3] = false;

} else if (filterName.equals("btnSearchFilterSong")) {

isActiveFilterArray[0] = false;

isActiveFilterArray[1] = !isActiveFilterArray[1];

} else if (filterName.equals("btnSearchFilterSpeech")) {

isActiveFilterArray[0] = false;

isActiveFilterArray[2] = !isActiveFilterArray[2];

} else if (filterName.equals("btnSearchFilterEbook")) {

isActiveFilterArray[0] = false;

isActiveFilterArray[3] = !isActiveFilterArray[3];

}

updateFilters();

}

開發者ID:martijn00,項目名稱:MusicPlayerCodenameOne,代碼行數:23,

示例2: findComponentsOfInterest

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

private void findComponentsOfInterest(Component cmp, ArrayList dest) {

if(cmp instanceof Container) {

Container c = (Container)cmp;

int count = c.getComponentCount();

for(int iter = 0 ; iter < count ; iter++) {

findComponentsOfInterest(c.getComponentAt(iter), dest);

}

return;

}

// performance optimization for fixed images in lists

if(cmp.getName() != null) {

if(cmp instanceof Label) {

Label l = (Label)cmp;

if(l.getName().toLowerCase().endsWith("fixed") && l.getIcon() != null) {

l.getIcon().lock();

}

dest.add(cmp);

return;

}

if(cmp instanceof TextArea) {

dest.add(cmp);

return;

}

}

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:26,

示例3: findByName

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

private static Component findByName(Container root, String componentName) {

int count = root.getComponentCount();

for(int iter = 0 ; iter < count ; iter++) {

Component c = root.getComponentAt(iter);

String n = c.getName();

if(n != null && n.equals(componentName)) {

return c;

}

if(c instanceof Container) {

c = findByName((Container)c, componentName);

if(c != null) {

return c;

}

}

}

return null;

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:18,

示例4: getFormState

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

/**

* Returns the state of the current form which we are about to leave as part

* of the navigation logic. When a back command will return to this form the

* state would be restored using setFormState.

* The default implementation of this method restores focus and list selection.

* You can add arbitrary keys to the form state, keys starting with a $ sign

* are reserved for the UIBuilder base class use.

*

* @param f the form whose state should be preserved

* @return arbitrary state object

*/

protected Hashtable getFormState(Form f) {

Component c = f.getFocused();

Hashtable h = new Hashtable();

// can happen if we navigate away from a form that was shown without the GUI builder

if(f.getName() != null) {

h.put(FORM_STATE_KEY_NAME, f.getName());

}

if(c != null) {

if(c instanceof List) {

h.put(FORM_STATE_KEY_SELECTION, new Integer(((List)c).getSelectedIndex()));

}

if(c.getName() != null) {

h.put(FORM_STATE_KEY_FOCUS, c.getName());

}

if(f.getTitle() != null) {

h.put(FORM_STATE_KEY_TITLE, f.getTitle());

}

}

storeComponentState(f, h);

return h;

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:33,

示例5: storeComponentStateImpl

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

private void storeComponentStateImpl(Component c, Hashtable destination) {

if(c.getName() == null || destination.containsKey(c.getName()) || c.getClientProperty("CN1IgnoreStore") != null) {

return;

}

if(c instanceof Tabs) {

destination.put(c.getName(), new Integer(((Tabs)c).getSelectedIndex()));

}

if(c instanceof Container) {

Container cnt = (Container)c;

int count = cnt.getComponentCount();

for(int iter = 0 ; iter < count ; iter++) {

storeComponentStateImpl(cnt.getComponentAt(iter), destination);

}

return;

}

if(c instanceof List) {

destination.put(c.getName(), new Integer(((List)c).getSelectedIndex()));

return;

}

Object o = c.getComponentState();

if(o != null) {

destination.put(c.getName(), o);

}

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:25,

示例6: getContainerState

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

/**

* This method is the container navigation equivalent of getFormState() see

* that method for details.

* @param cnt the container

* @return the state

*/

protected Hashtable getContainerState(Container cnt) {

Component c = null;

Form parentForm = cnt.getComponentForm();

if(parentForm != null) {

c = parentForm.getFocused();

}

Hashtable h = new Hashtable();

h.put(FORM_STATE_KEY_NAME, cnt.getName());

h.put(FORM_STATE_KEY_CONTAINER, "");

if(c != null && isParentOf(cnt, c)) {

if(c instanceof List) {

h.put(FORM_STATE_KEY_SELECTION, new Integer(((List)c).getSelectedIndex()));

}

if(c.getName() != null) {

h.put(FORM_STATE_KEY_FOCUS, c.getName());

}

return h;

}

storeComponentState(cnt, h);

return h;

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:28,

示例7: findByName

​點讚 3

import com.codename1.ui.Component; //導入方法依賴的package包/類

/**

* Finds a component with the given name, works even with UI's that weren't created with the GUI builder

* @param componentName the name of the component to find

* @return the component with the given name within the tree

*/

private static Component findByName(Container root, String componentName) {

if(verbose) {

log("findByName(" + root + ", " + componentName + ")");

}

int count = root.getComponentCount();

for(int iter = 0 ; iter < count ; iter++) {

Component c = root.getComponentAt(iter);

String n = c.getName();

if(n != null && n.equals(componentName)) {

return c;

}

if(c instanceof Container) {

c = findByName((Container)c, componentName);

if(c != null) {

return c;

}

}

}

return null;

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:26,

示例8: Stats

​點讚 2

import com.codename1.ui.Component; //導入方法依賴的package包/類

public Stats(Component c) {

name = c.getName();

type = c.getClass().getName();

uiid = c.getUIID();

if(c instanceof Label) {

Image l = ((Label)c).getIcon();

if(l != null) {

imageName = l.getImageName();

}

}

if(c.getParent() != null) {

parentName = c.getParent().getName();

}

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:15,

示例9: bind

​點讚 2

import com.codename1.ui.Component; //導入方法依賴的package包/類

private void bind(final PropertyBusinessObject obj, final Container cnt, ArrayList allBindings) {

for(Component cmp : cnt) {

if(cmp instanceof Container && ((Container)cmp).getLeadComponent() == null) {

bind(obj, ((Container)cmp), allBindings);

continue;

}

String n = cmp.getName();

if(n != null) {

PropertyBase b = obj.getPropertyIndex().get(n);

if(b != null) {

allBindings.add(bind(b, cmp));

}

}

}

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:16,

示例10: updateComponentValues

​點讚 2

import com.codename1.ui.Component; //導入方法依賴的package包/類

void updateComponentValues(Container root, Hashtable h) {

int c = root.getComponentCount();

for(int iter = 0 ; iter < c ; iter++) {

Component current = root.getComponentAt(iter);

// the comparison assumes that other container subclases are really just

// custom components e.g. tree, table and HTMLComponent as well as third party

// subclasses

if(current.getClass() == com.codename1.ui.Container.class ||

current.getClass() == com.codename1.ui.Tabs.class) {

updateComponentValues((Container)current, h);

continue;

}

String n = current.getName();

if(n != null) {

String val = (String)h.get(n);

if(val != null) {

if(current instanceof Button) {

final String url = (String)val;

((Button)current).addActionListener(new Listener(url));

continue;

}

if(current instanceof Label) {

((Label)current).setText(val);

continue;

}

if(current instanceof TextArea) {

((TextArea)current).setText(val);

continue;

}

if(current instanceof WebBrowser) {

((WebBrowser)current).setPage(val, null);

continue;

}

}

}

}

}

開發者ID:codenameone,項目名稱:CodenameOne,代碼行數:39,

注:本文中的com.codename1.ui.Component.getName方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值