• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UIManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.codename1.ui.plaf.UIManager的典型用法代码示例。如果您正苦于以下问题:Java UIManager类的具体用法?Java UIManager怎么用?Java UIManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UIManager类属于com.codename1.ui.plaf包,在下文中一共展示了UIManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: Progress

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Binds the progress UI to the completion of this request
 *
 * @param title the title of the progress dialog
 * @param request the network request pending
 * @param showPercentage shows percentage on the progress bar
 */
public Progress(String title, ConnectionRequest request, boolean showPercentage) {
    super(title);
    this.request = request;
    SliderBridge b = new SliderBridge(request);
    b.setRenderPercentageOnTop(showPercentage);
    b.setRenderValueOnTop(true);
    setLayout(new BoxLayout(BoxLayout.Y_AXIS));
    addComponent(b);
    Command cancel = new Command(UIManager.getInstance().localize("cancel", "Cancel"));
    if(Display.getInstance().isTouchScreenDevice() || getSoftButtonCount() < 2) {
        // if this is a touch screen device or a blackberry use a centered button
        Button btn = new Button(cancel);
        Container cnt = new Container(new FlowLayout(CENTER));
        cnt.addComponent(btn);
        addComponent(cnt);
    } else {
        // otherwise use a command
        addCommand(cancel);
    }
    setDisposeWhenPointerOutOfBounds(false);
    setAutoDispose(false);
    NetworkManager.getInstance().addProgressListener(this);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:31,代码来源:Progress.java


示例2: init

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
public void init(Object context) {
    try {
        Resources theme = Resources.openLayered("/theme");
        UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
    } catch(IOException e){
        e.printStackTrace();
    }
    // Pro users - uncomment this code to get crash reports sent to you automatically
    /*Display.getInstance().addEdtErrorHandler(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            evt.consume();
            Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown"));
            Log.p("OS " + Display.getInstance().getPlatformName());
            Log.p("Error " + evt.getSource());
            Log.p("Current Form " + Display.getInstance().getCurrent().getName());
            Log.e((Throwable)evt.getSource());
            Log.sendLog();
        }
    });*/
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:21,代码来源:ChartsDemo.java


示例3: init

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
public void init(Object context) {
    try {
        Resources theme = Resources.openLayered("/theme");
        placeholder = (EncodedImage)theme.getImage("thumbnail.png");
        THUMB_URL_PREFIX = THUMB_URL_PREFIX + "w=" + placeholder.getWidth() + "&h=" + placeholder.getHeight() + "&i=";
        UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
    } catch(IOException e){
        e.printStackTrace();
    }
    // Pro users - uncomment this code to get crash reports sent to you automatically
    /*Display.getInstance().addEdtErrorHandler(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            evt.consume();
            Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown"));
            Log.p("OS " + Display.getInstance().getPlatformName());
            Log.p("Error " + evt.getSource());
            Log.p("Current Form " + Display.getInstance().getCurrent().getName());
            Log.e((Throwable)evt.getSource());
            Log.sendLog();
        }
    });*/
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:23,代码来源:PhotoShare.java


示例4: init

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
public void init(Object context) {
    try {
        theme = Resources.openLayered("/theme");
        UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
        int dpi =  Preferences.get("dpi", calculateDPI());
        cards = Resources.open("/gamedata.res",dpi);
        currentZoom = Preferences.get("zoom", defaultZoom);
    } catch(IOException e){
        e.printStackTrace();
    }
    // Pro users - uncomment this code to get crash reports sent to you automatically
    Display.getInstance().addEdtErrorHandler(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            evt.consume();
            Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown"));
            Log.p("OS " + Display.getInstance().getPlatformName());
            Log.p("Error " + evt.getSource());
            Log.p("Current Form " + Display.getInstance().getCurrent().getName());
            Log.e((Throwable)evt.getSource());
            Log.sendLog();
        }
    });
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:24,代码来源:Solitaire.java


示例5: init

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
public void init(Object context) {
    try {
        theme = Resources.openLayered("/theme");
        UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
    } catch(IOException e){
        e.printStackTrace();
    }
    // Pro users - uncomment this code to get crash reports sent to you automatically
    /*Display.getInstance().addEdtErrorHandler(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            evt.consume();
            Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown"));
            Log.p("OS " + Display.getInstance().getPlatformName());
            Log.p("Error " + evt.getSource());
            Log.p("Current Form " + Display.getInstance().getCurrent().getName());
            Log.e((Throwable)evt.getSource());
            Log.sendLog();
        }
    });*/
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:21,代码来源:LocalNotificationTest.java


示例6: editString

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public void editString(Component cmp, int maxSize, int constraint, String text, int keyCode) {
    UIManager m = UIManager.getInstance();
    CONFIRM_COMMAND = new Command(m.localize("ok", "OK"), Command.OK, 1);
    CANCEL_COMMAND = new Command(m.localize("cancel", "Cancel"), Command.CANCEL, 2);
    if(mid.getAppProperty("forceBackCommand") != null) {
        canvas.addCommand(MIDP_BACK_COMMAND);
    }
    currentTextBox = new TextBox("", "", maxSize, TextArea.ANY);
    currentTextBox.setCommandListener((CommandListener)canvas);
    currentTextBox.addCommand(CONFIRM_COMMAND);
    currentTextBox.addCommand(CANCEL_COMMAND);
    currentTextComponent = cmp;
    currentTextBox.setMaxSize(maxSize);
    currentTextBox.setString(text);
    currentTextBox.setConstraints(constraint);
    display.setCurrent(currentTextBox);
    ((C)canvas).setDone(false);
    Display.getInstance().invokeAndBlock(((C)canvas));
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:23,代码来源:GameCanvasImplementation.java


示例7: installNativeTheme

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public void installNativeTheme() {
    
    InputStream i = getResourceAsStream(getClass(), "/nokia_touch_theme.res");
    if(i == null){
        i = getResourceAsStream(getClass(), "/nokia_non_touch.res");
    }
    if(i == null){
        i = getResourceAsStream(getClass(), "/nokia_asha_theme.res");
    }
    if(i == null){
        i = getResourceAsStream(getClass(), "/nativeJ2METheme.res");
    }
    if(i != null){
        try {
            Resources r = Resources.open(i);
            UIManager.getInstance().setThemeProps(r.getTheme(r.getThemeResourceNames()[0]));
        } catch(Throwable t) {
            t.printStackTrace();
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:25,代码来源:GameCanvasImplementation.java


示例8: installNativeTheme

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Installs the native theme, this is only applicable if hasNativeTheme()
 * returned true. Notice that this method might replace the
 * DefaultLookAndFeel instance and the default transitions.
 */
public void installNativeTheme() {
    hasNativeTheme();
    if (nativeThemeAvailable) {
        try {
            InputStream is;
            if (android.os.Build.VERSION.SDK_INT < 14 && !isTablet() || Display.getInstance().getProperty("and.hololight", "false").equals("true")) {
                is = getResourceAsStream(getClass(), "/androidTheme.res");
            } else {
                is = getResourceAsStream(getClass(), "/android_holo_light.res");
            }
            Resources r = Resources.open(is);
            Hashtable h = r.getTheme(r.getThemeResourceNames()[0]);
            h.put("@commandBehavior", "Native");
            UIManager.getInstance().setThemeProps(h);
            is.close();
            Display.getInstance().setCommandBehavior(Display.COMMAND_BEHAVIOR_NATIVE);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:AndroidImplementation.java


示例9: getMenu

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
public Menu getMenu(int val) {
    if (Display.getInstance().getCommandBehavior() == Display.COMMAND_BEHAVIOR_NATIVE) {
        m = new Menu();
        if(commands != null){
            for (int iter = 0; iter < commands.size(); iter++) {
                final Command cmd = (Command) commands.elementAt(iter);
                String txt = UIManager.getInstance().localize(cmd.getCommandName(), cmd.getCommandName());
                MenuItem i = new MenuItem(txt, iter, iter) {
                    public void run() {
                        Display.getInstance().callSerially(new Runnable() {
                            public void run() {
                                impl.getCurrentForm().dispatchCommand(cmd, new ActionEvent(cmd));
                            }
                        });
                    }
                };
                m.add(i);
            }
        }
        return m;
    }
    return super.getMenu(val);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:BlackBerryCanvas.java


示例10: getFitText

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Calculates the best text to fit into the available space.
 * 
 * @param text the entire text
 * @param width the width to fit the text into
 * @param paint the paint
 * @return the text to fit into the space
 */
private String getFitText(String text, float width, Paint paint) {
    if(UIManager.getInstance().getLookAndFeel().isDefaultEndsWith3Points()) {
      String newText = text;
      int length = text.length();
      int diff = 0;
      while (paint.measureText(newText) > width && diff < length) {
        diff++;
        newText = text.substring(0, length - diff) + "...";
      }
      if (diff == length) {
        newText = "...";
      }
      return newText;
    }
    return text;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:25,代码来源:AbstractChart.java


示例11: setBackCommand

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Indicates the command that is defined as the back command out of this form.
 * A back command can be used both to map to a hardware button (e.g. on the Sony Ericsson devices)
 * and by elements such as transitions etc. to change the behavior based on 
 * direction (e.g. slide to the left to enter screen and slide to the right to exit with back).
 * 
 * @param backCommand the command to treat as the back Command
 */
public void setBackCommand(Command backCommand) {
    this.backCommand = backCommand;
    if(parent.getToolbar() != null) {
        return;
    }
    if(backCommand != null && UIManager.getInstance().isThemeConstant("hideBackCommandBool", false)) {
        removeCommand(backCommand);
    }
    
    int b = getCommandBehavior();
    if (b == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK || b == Display.COMMAND_BEHAVIOR_ICS
            || Display.getInstance().isNativeTitle()) {
        int i = commands.indexOf(backCommand);
        if (i > -1) {
            commands.removeElementAt(i);
        }
    }
    updateTitleCommandPlacement();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:MenuBar.java


示例12: createTouchCommandButton

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Creates a touch command for use as a touch menu item
 * 
 * @param c command to map into the returned button
 * @return a button that would fire the touch command appropriately
 */
protected Button createTouchCommandButton(Command c) {
    Button b = new Button(c);
    if (b.getIcon() == null) {
        // some themes look awful without any icon
        b.setIcon((Image) parent.getUIManager().getThemeImageConstant("defaultCommandImage"));
    } else {
        if (UIManager.getInstance().isThemeConstant("commandAsIconBool", false)) {
            b.setText("");
        }
    }
    b.setTactileTouch(true);
    b.setTextPosition(Label.BOTTOM);
    b.setEndsWith3Points(false);
    String uiid = (String)c.getClientProperty("cn1$CommandUIID");
    if(uiid != null) {
        b.setUIID(uiid);
    } else {
        b.setUIID("TouchCommand");
    }
    Integer gap = (Integer)c.getClientProperty("iconGap");
    if(gap != null) {
        b.setGap(gap.intValue());
    }
    return b;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:32,代码来源:MenuBar.java


示例13: createOpenButton

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Creates the Side Menu open button.
 * @return a Button instance to place on the TitleArea
 */ 
protected Button createOpenButton(){
    Button ob = new Button();
    ob.setUIID("MenuButton");
    UIManager uim = parent.getUIManager();
    Image i = (Image) uim.getThemeImageConstant("sideMenuImage");
    if (i != null) {
        ob.setIcon(i);
    } else {
        float size = 4.5f;
        try {
            size = Float.parseFloat(uim.getThemeConstant("menuImageSize", "4.5"));
        } catch(Throwable t) {
            Log.e(t);
        }
        FontImage.setMaterialIcon(ob, FontImage.MATERIAL_MENU, size);
    }
    Image p = (Image) uim.getThemeImageConstant("sideMenuPressImage");
    if (p != null) {
        ob.setPressedIcon(p);
    }
    return ob;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:SideMenuBar.java


示例14: setBackCommand

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void setBackCommand(Command backCommand) {
    super.setBackCommand(backCommand);
    if (parent instanceof Dialog) {
        return;
    }
    addOpenButton(null, false);
    installRightCommands();
    installLeftCommands();
    if (getBackCommand() != null
            && getCommandCount() > 0
            && !UIManager.getInstance().isThemeConstant("hideBackCommandBool", false)
            && !getCommands().contains(getBackCommand())) {
        getCommands().insertElementAt(getBackCommand(), 0);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:SideMenuBar.java


示例15: initLaf

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * This method initializes the Component defaults constants
 */
protected void initLaf(UIManager uim){
    if(uim == getUIManager() && isInitialized()){
        return;
    }
    selectText = uim.localize("select", "Select");
    LookAndFeel laf = uim.getLookAndFeel();
    animationSpeed = laf.getDefaultSmoothScrollingSpeed();
    rtl = laf.isRTL();
    tactileTouch = isFocusable();
    tensileDragEnabled = laf.isDefaultTensileDrag();
    snapToGrid = laf.isDefaultSnapToGrid();
    alwaysTensile = laf.isDefaultAlwaysTensile();
    tensileHighlightEnabled = laf.isDefaultTensileHighlight();
    scrollOpacityChangeSpeed = laf.getFadeScrollBarSpeed();
    isScrollVisible = laf.isScrollVisible();
    
    if(tensileHighlightEnabled) {
        tensileLength = 3;
    } else {
        tensileLength = -1;
    }        
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:26,代码来源:Component.java


示例16: initComponentImpl

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * Invoked internally to initialize and bind the component
 */
void initComponentImpl() {
    if (!initialized) {
        initialized = true;
        UIManager manager = getUIManager();
        Style stl = getStyle();
        lockStyleImages(stl);
        manager.getLookAndFeel().bind(this);
        checkAnimation();
        if(isRTL() && isScrollableX()){
            setScrollX(getScrollDimension().getWidth() - getWidth());
        }
        initComponent();
        showNativeOverlay();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:Component.java


示例17: calcPreferredSize

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected Dimension calcPreferredSize() {
    if(animation == null) {
        animation = UIManager.getInstance().getThemeImageConstant("infiniteImage");
        if(animation == null) {
            int size = Display.getInstance().convertToPixels(7, true);
            String f = getUIManager().getThemeConstant("infiniteDefaultColor", null);
            int color = 0x777777;
            if(f != null) {
                color = Integer.parseInt(f, 16);
            }
            FontImage fi = FontImage.createFixed("" + FontImage.MATERIAL_AUTORENEW, 
                    FontImage.getMaterialDesignFont(), 
                    color, size, size, 0);
            
            animation = fi.toImage();
        }
    }
    if(animation == null) {
        return new Dimension(100, 100);
    }
    Style s = getStyle();
    return new Dimension(s.getHorizontalPadding() + animation.getWidth(), 
            s.getVerticalPadding() + animation.getHeight());
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:InfiniteProgress.java


示例18: initLaf

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void initLaf(UIManager manager) {
    super.initLaf(manager);
    int tabPlace = manager.getThemeConstant("tabPlacementInt", -1);
    tabsFillRows = manager.isThemeConstant("tabsFillRowsBool", false);
    tabsGridLayout = manager.isThemeConstant("tabsGridBool", false);
    changeTabOnFocus = manager.isThemeConstant("changeTabOnFocusBool", false);
    BorderLayout bd = (BorderLayout)super.getLayout();
    if(bd != null) {
        if(manager.isThemeConstant("tabsOnTopBool", false)) {
            if(bd.getCenterBehavior() != BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW) {
                bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW);
                checkTabsCanBeSeen();
            }
        } else {
            bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
        }
    }
    changeTabContainerStyleOnFocus =  manager.isThemeConstant("changeTabContainerStyleOnFocusBool", false);
    if(tabPlace != -1){
        tabPlacement = tabPlace;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:26,代码来源:Tabs.java


示例19: initLaf

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * 
 * {@inheritDoc}
 */
protected void initLaf(UIManager uim) {
    if(uim == getUIManager() && isInitialized()){
        return;
    }
    super.initLaf(uim);
    LookAndFeel laf = uim.getLookAndFeel();
    setSmoothScrolling(laf.isDefaultSmoothScrolling());
    if(components != null){
        int count = getComponentCount();
        for (int i = 0; i < count; i++) {
            Component c = getComponentAt(i);
            c.initLaf(uim);
        }
    }

}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:21,代码来源:Container.java


示例20: paint

import com.codename1.ui.plaf.UIManager; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void paint(Graphics g) {
    
    //the native input will show the string.
    if(useNativeTextInput && Display.getInstance().isNativeEditorVisible(this)) {
        return;
    }

    UIManager manager = getUIManager();
    manager.getLookAndFeel().drawTextField(g, this);
    
    if (drawCursor && hasFocus() && isEditable()) {
        manager.getLookAndFeel().drawTextFieldCursor(g, this);
    }
    
    paintHint(g);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:TextField.java



注:本文中的com.codename1.ui.plaf.UIManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Base64Data类代码示例发布时间:2022-05-23
下一篇:
Java TCharCharMap类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap