Java me LWUIT中的UI对齐?
我正在使用LWUIT创建J2ME应用程序。我使用GridLayout添加控件,但它们没有对齐 代码: 提前感谢。不要像这样使用2012年2月14日,第1轮。获取显示的宽度并在日期标签上设置preferredW。要获得屏幕宽度,请使用以下命令: int width=Display.getInstance.getDisplayWidthJava me LWUIT中的UI对齐?,java-me,lwuit,lwuit-label,lwuit-layouts,lwuit-tabs,Java Me,Lwuit,Lwuit Label,Lwuit Layouts,Lwuit Tabs,我正在使用LWUIT创建J2ME应用程序。我使用GridLayout添加控件,但它们没有对齐 代码: 提前感谢。不要像这样使用2012年2月14日,第1轮。获取显示的宽度并在日期标签上设置preferredW。要获得屏幕宽度,请使用以下命令: int width=Display.getInstance.getDisplayWidth 也不要使用选项卡窗格。使用将按钮添加到addTab并设置按钮的宽度。因为在使用TabbedPane时,每个选项卡都具有相同的宽度和高度。这是个问题。我没有投下一票?
也不要使用选项卡窗格。使用将按钮添加到addTab并设置按钮的宽度。因为在使用TabbedPane时,每个选项卡都具有相同的宽度和高度。这是个问题。我没有投下一票?如何将宽度应用于标签和图像。我使用了int-width=Display.getInstance.getDisplayWidth;dateLabel.setWidthwidth;使用setPreferredW。。。对于标签。将图像设置为按钮,并根据需要设置preferredW。
flowLayout = new FlowLayout();
roundsPage.setLayout(flowLayout);
try {
image = image.createImage("/11.png"); // All image 40 x 40
starImage = Image.createImage("/j1.png");
smileImage = Image.createImage("/j2.png");
imgClock = Image.createImage("/clock.jpg");
imageTeam = Image.createImage("/name.png");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
dateLabel=new Label("14-02-2012, Round1 ");
dateLabel.getStyle().setBgColor(0x8b8989);
dateLabel.getStyle().setFgColor(0xffffff);
roundsPage.addComponent(dateLabel);
//int screenWidth = Display.getInstance().getDisplayWidth();
Container tabContainer1 = new Container(new BoxLayout(BoxLayout.Y_AXIS));
tabContainer1.addComponent(new Button("Click"));
tabContainer1.addComponent(new Button("Click"));
tabContainer1.addComponent(new Button("Click"));
tabContainer1.addComponent(new Button("Click"));
Container tabContainer2 = new Container(new BoxLayout(BoxLayout.X_AXIS));
team1=new Label(starImage);
team1.setText("Villarreal");
team1.setTextPosition(Component.BOTTOM);
//team1.setWidth(10);
//team1.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN ,Font.SIZE_SMALL));
tabContainer2.addComponent(team1);
tabContainer2.setWidth(100);
clockLabel=new Label(imgClock);
clockLabel.setText("18:00");
clockLabel.setTextPosition(Component.RIGHT);
tabContainer2.addComponent(clockLabel);
teamLabel=new Label(imageTeam);
teamLabel.setText("El Madrigal");
teamLabel.setTextPosition(Component.RIGHT);
tabContainer2.addComponent(teamLabel);
team2=new Label(smileImage);
team2.setText("Betis");
team2.setTextPosition(Component.BOTTOM);
team2.setFocusable(true);
tabContainer2.addComponent(team2);
Container tabContainer3 = new Container(new BoxLayout(BoxLayout.Y_AXIS));
tabContainer3.addComponent(new Button("Click"));
tabContainer3.addComponent(new Button("Click"));
tabContainer3.addComponent(new Button("Click"));
tabContainer3.addComponent(new Button("Click"));
TabbedPane tabbbed = new TabbedPane();
tabbbed.addTab(null, image, tabContainer1 );
tabbbed.addTab(null, image, tabContainer2);
tabbbed.addTab(null, image, tabContainer3);
roundsPage.addComponent(tabbbed);