私はCN1(CN1の標準フォームテンプレートに基づく)を使って自分のアプリケーションを手書きしました。主に予定のアプリのためのカレンダーを使用して(私はピッカーを使用しない理由がある)。Codenameone - Calendar createDay()ナビゲーション
ここに私のメインのFormクラスは、私はそれに応じて
public class mainCalendar extends Calendar { @Override
protected Button createDay(){ Button day = new Button();
Image im = FontImage.createMaterial(FontImage.MATERIAL_MODE_EDIT, UIManager.getInstance().getComponentStyle("Command"));
day.setIcon(im);
return day;
}
@Override
protected void updateButtonDayDate(Button dayButton, int currentMonth, int day) {
//Customize day values
dayButton.setText("" +day);
}}
メインフォームが1 & 2(sidemenu)を形成するために取得するために管理してオーバーライドCalendarクラスをしました
public class celebriesta {
private Form current;
private Resources theme;
private Form home;
public void init(Object context) {
theme = UIManager.initFirstTheme("/theme");
// Enable Toolbar on all Forms by default
Toolbar.setGlobalToolbar(true);
// Pro only feature
Log.bindCrashProtection(true);
}
public void start() {
if (current != null) {
current.show();
return;
}
home = new Form("Home", BoxLayout.y());
mainCalendar Calendar = new mainCalendar();
home.addComponent(Calendar);
Calendar.setUIID("Calendar");
//Create Form1 and Form2 and set a Back Command to navigate back to the home Form
Form form1 = new Form("Form1");
setBackCommand(form1);
Form form2 = new Form("Form2");
setBackCommand(form2);
Form form3 = new Form("Form3");
setBackCommand(form3);
//Add navigation commands to the home Form
NavigationCommand cmd1 = new NavigationCommand("Form1");
cmd1.setNextForm(form1);
home.getToolbar().addCommandToSideMenu(cmd1);
NavigationCommand cmd2 = new NavigationCommand("Form2");
cmd2.setNextForm(form2);
home.getToolbar().addCommandToSideMenu(cmd2);
NavigationCommand cmd3 = new NavigationCommand("Form3");
cmd3.setNextForm(form3);
Calendar.createDay().pressed();
Calendar.createDay().released();
Calendar.createDay().setCommand(cmd3);
//Add Edit commands to the home Form context Menu
Image im = FontImage.createMaterial(FontImage.MATERIAL_MODE_EDIT, UIManager.getInstance().getComponentStyle("Command"));
Command edit = new Command("", im) {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("Editing");
}
};
home.getToolbar().addCommandToRightBar(edit);
home.show();
}
protected void setBackCommand(Form f) {
Command back = new Command("") {
@Override
public void actionPerformed(ActionEvent evt) {
home.showBack();
}
};
Image img = FontImage.createMaterial(FontImage.MATERIAL_ARROW_BACK, UIManager.getInstance().getComponentStyle("TitleCommand"));
back.setIcon(img);
f.getToolbar().addCommandToLeftBar(back);
f.getToolbar().setTitleCentered(true);
f.setBackCommand(back);
}
public void stop() {
current = getCurrentForm();
}
public void destroy() {
}}
です。私はフォーム3が存在するが、なぜそれがcreateDay()から「到達」することができなかったのか分からないことを知っています。そして、私はそれがおよび/またはヘルプを助言する必要がある主なフォーム
Calendar.createDay().pressed();
Calendar.createDay().released();
Calendar.createDay().setCommand(cmd3);
でこのコードの周りのどこか間違って何か疑い。
あなたの質問は何ですか? – Soviut