设计器菜单扩展
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.5 KiB

package com.tptj.demo.hg.menu.handler;
import com.fr.base.io.AttrMark;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.*;
import java.awt.*;
/**
* @author 秃破天际
* @version 10.0
* Created by 秃破天际 on 2021-05-20
**/
public class DemoPane extends BasicPane {
private UITextField w_txt;
private AttrMark container;
public DemoPane( AttrMark container ){
this.container = container;
w_txt = new UITextField();
setLayout(FRGUIPaneFactory.createM_BorderLayout());
JPanel pane = TableLayoutHelper.createTableLayoutPane(
new Component[][]{
{new UILabel("txt:"), w_txt}
},
new double[]{TableLayout.PREFERRED},
new double[]{ TableLayout.PREFERRED,TableLayout.FILL}
);
add( pane, BorderLayout.NORTH );
}
@Override
protected String title4PopupWindow() {
return "Demo Action";
}
public void populate(){
DemoAttrMark attr = container.getAttrMark(DemoAttrMark.XML_TAG);
if( null != attr ){
w_txt.setText( attr.getTxt() );
}
}
public void update(){
DemoAttrMark attr = new DemoAttrMark();
attr.setTxt( w_txt.getText() );
container.addAttrMark( attr );
}
}