use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class SideMenuBar method validateCommandPlacement.
private void validateCommandPlacement(String placement) {
if (placement == COMMAND_PLACEMENT_VALUE_TOP) {
((BorderLayout) getTitleAreaContainer().getLayout()).setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
if (!(getTitleComponent() instanceof Button)) {
Button b = new Button(parent.getTitle());
b.setUIID("Title");
parent.setTitleComponent(b);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
openMenu(COMMAND_PLACEMENT_VALUE_TOP);
}
});
}
return;
}
if (placement == COMMAND_PLACEMENT_VALUE_RIGHT) {
if (rightSideButton != null && rightSideButton.getParent() != null) {
return;
}
rightSideButton = new Button();
rightSideButton.setUIID("MenuButtonRight");
UIManager uim = parent.getUIManager();
Image i = (Image) uim.getThemeImageConstant("rightSideMenuImage");
if (i != null) {
rightSideButton.setIcon(i);
} else {
FontImage.setMaterialIcon(rightSideButton, FontImage.MATERIAL_MENU);
}
Image p = (Image) uim.getThemeImageConstant("rightSideMenuPressImage");
if (p != null) {
rightSideButton.setPressedIcon(p);
}
rightSideButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
openMenu(COMMAND_PLACEMENT_VALUE_RIGHT);
}
});
Container ta = getTitleAreaContainer();
ta.addComponent(BorderLayout.EAST, rightSideButton);
ta.revalidate();
return;
}
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class SideMenuBar method createOpenButton.
/**
* 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;
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class Component method initLaf.
/**
* 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;
}
}
use of com.codename1.ui.plaf.UIManager in project CodenameOne by codenameone.
the class GameCanvasImplementation method editString.
/**
* @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));
}
Aggregations