2017-02-20 10 views
1

私は、ピッカーと他のコンポーネントを持つダイアログボックスを持っています。私は最後のコンポーネントが終了する高さの自動修正が必要です。下の図では、送信ボタンの後に終了します。Cn1ダイアログボックスの高さ自動修正

enter image description here

コード:

Dialog selectDialog = new Dialog(); 
selectDialog.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); 
selectDialog.getAllStyles().setMargin(0, 0, 0, 0); 

Container pickerContainer = new Container(new BorderLayout()); 

Picker p = new Picker(); 
p.setStrings(outlets); 

Label arrowLabel = new Label(pickerIcon); 
arrowLabel.setUIID("Container"); 
pickerContainer.add(BorderLayout.CENTER, p); 
pickerContainer.add(BorderLayout.EAST, arrowLabel); 

Label nameLabel = new Label("Name"); 
Label nameData = new Label("Santosh Kandel"); 
Label locationLabel = new Label("Location"); 
Label locationData = new Label("Baneswor"); 
Label timeLabel = new Label("Time"); 
Label timeData = new Label("09:47"); 
Label dateLabel = new Label("Date"); 
Label dateData = new Label("2017-2-10"); 

TableLayout dialogTable = new TableLayout(7, 2); 
Container attendenceTableContainer = new Container(dialogTable); 
attendenceTableContainer.getAllStyles().setMargin(0, 0, 50, 50); 
attendenceTableContainer.add(dialogTable.createConstraint().widthPercentage(30), nameLabel) 
    .add(dialogTable.createConstraint().widthPercentage(70), nameData) 
    .add(dialogTable.createConstraint().widthPercentage(30), locationLabel) 
    .add(dialogTable.createConstraint().widthPercentage(70), locationData) 
    .add(dialogTable.createConstraint().widthPercentage(30), timeLabel) 
    .add(dialogTable.createConstraint().widthPercentage(70), timeData) 
    .add(dialogTable.createConstraint().widthPercentage(30), dateLabel) 
    .add(dialogTable.createConstraint().widthPercentage(70), dateData); 

Button submitButton = new Button("Submit"); 

selectDialog.add(pickerContainer); 
selectDialog.add(attendenceTableContainer); 
selectDialog.add(FlowLayout.encloseCenter(submitButton)); 
selectDialog.showAtPosition(200, 200, 50, 50, false); 

私はd.showPopupDialog(コンポーネント)を試してみましたが、それは私が望んでいたダイアログを配置didnot。ここで私はいくつかのマージンと場合によっては特定の場所でもフォームの上部にそれをしたい。ありがとう

答えて

1
あなたはshowStretchedを使用するかは、ダイアログが画面の幅を取るか、最も広い部品のサイズに合わせてサイズを変更したい場合に応じてshowPacked、そしてあなたはそれがでポップアップべき位置を定義することができ

selectDialog.setAutoDispose(false); 
selectDialog.setDisposeWhenPointerOutOfBounds(true); 
selectDialog.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 300)); 
selectDialog.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 800)); 
selectDialog.showStretched(BorderLayout.NORTH, true); 
関連する問題