com.codename1.ui.plaf.UIManager Java Examples

The following examples show how to use com.codename1.ui.plaf.UIManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoadingTextAnimationSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #2
Source File: ShapeClipTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #3
Source File: GoogleMapsAddMarkerSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #4
Source File: WebSocketsSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
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();
        }
    });*/
    
    
    
}
 
Example #5
Source File: SpanLabelTestAllStyles2891.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #6
Source File: HelloWorldCSS.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #7
Source File: LeftPaddingCSSTest3091.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #8
Source File: SocketSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #9
Source File: BrowserComponentPostMessageSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
    Display.getInstance().setProperty("android.webContentsDebuggingEnabled", "true");
}
 
Example #10
Source File: MySample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #11
Source File: TestNatives.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #12
Source File: DragFinishedListenerTest3056.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #13
Source File: UnicodeFontsSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #14
Source File: AbstractChart.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #15
Source File: RTLLayoutAndPadding.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");
    UIManager.getInstance().getLookAndFeel().setRTL(true);

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #16
Source File: SafeAreasSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #17
Source File: Switch.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
private void initTheme() {
    thumbOffImage = null;
    thumbOnImage = null;
    thumbDisabledImage = null;
    trackOnImage = null;
    trackOffImage = null;
    trackDisabledImage = null;
    setThumbOnImage(UIManager.getInstance().
            getThemeImageConstant(getUIID().toLowerCase() + "ThumbOnImage"));
    setThumbOffImage(UIManager.getInstance().
            getThemeImageConstant(getUIID().toLowerCase() + "ThumbOffImage"));
    setThumbDisabledImage(UIManager.getInstance().
            getThemeImageConstant(getUIID().toLowerCase() + "ThumbDisabledImage"));
    setTrackOnImage(UIManager.getInstance().
            getThemeImageConstant(getUIID().toLowerCase() + "OnTrackImage"));
    setTrackOffImage(UIManager.getInstance().
            getThemeImageConstant(getUIID().toLowerCase() + "OffTrackImage"));
    setTrackDisabledImage(UIManager.getInstance().
            getThemeImageConstant(getUIID().toLowerCase() + "DisabledTrackImage"));
}
 
Example #18
Source File: InfiniteProgressWithMessage.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #19
Source File: ToolbarRTLTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");
    UIManager.getInstance().getLookAndFeel().setRTL(true);

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #20
Source File: DraggableTabsSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #21
Source File: AutocompleteSample2788.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #22
Source File: TestTextComponentPassword2976.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #23
Source File: JavascriptCapturePhotoSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #24
Source File: TextSelectionSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #25
Source File: InterFormContainerSample.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if (err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });
}
 
Example #26
Source File: SendMessageSample2756.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #27
Source File: AutocompleteAsyncTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #28
Source File: SpanLabelTest2897.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}
 
Example #29
Source File: Button.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor a button with text, image and uiid
 * 
 * @param text label appearing on the button
 * @param icon image appearing on the button
 * @param id UIID unique identifier for button
 */
public Button(String text, Image icon, String id) {
    super(text);
    setUIID(id);
    setFocusable(true);
    setIcon(icon);
    this.pressedIcon = icon;
    this.rolloverIcon = icon;
    releaseRadius = UIManager.getInstance().getThemeConstant("releaseRadiusInt", 0);
    setRippleEffect(buttonRippleEffectDefault);        
    if(isCapsText() && text != null) {
        putClientProperty("cn1$origText", text);
        super.setText(UIManager.getInstance().localize(text, text).toUpperCase());
    } 
    setCursor(HAND_CURSOR);
}
 
Example #30
Source File: JavascriptScrollingTest.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void init(Object context) {
    // use two network threads instead of one
    updateNetworkThreadCount(2);

    theme = UIManager.initFirstTheme("/theme");

    // Enable Toolbar on all Forms by default
    Toolbar.setGlobalToolbar(true);

    // Pro only feature
    Log.bindCrashProtection(true);

    addNetworkErrorListener(err -> {
        // prevent the event from propagating
        err.consume();
        if(err.getError() != null) {
            Log.e(err.getError());
        }
        Log.sendLogAsync();
        Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
    });        
}