com.vaadin.ui.Button.setWidth()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中com.vaadin.ui.Button.setWidth()方法的一些代码示例,展示了Button.setWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setWidth()方法的具体详情如下:
包路径:com.vaadin.ui.Button
类名称:Button
方法名:setWidth

Button.setWidth介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

  1. OnCreate(Bundle bundle) {
  2. //set content layout, etc up here
  3. //now adjust button sizes
  4. Button B = (Button) findViewById(R.id.somebutton);
  5. int someDimension = 50; //50pixels
  6. B.setWidth(someDimension);
  7. B.setHeight(someDimension);
  8. }

代码示例来源:origin: stackoverflow.com

  1. inviteButton.setWidth(30);
  2. inviteButton.setHeight(30);

代码示例来源:origin: stackoverflow.com

  1. int height = metrics.heightPixels;
  2. int width = metrics.widthPixels;
  3. Button Button1 = (Button) findViewById(R.id.button1);
  4. Button Button2 = (Button) findViewById(R.id.button2);
  5. Button1.setWidth(width / 2);
  6. Button2.setWidth(width / 2);

代码示例来源:origin: stackoverflow.com

  1. public void fillview(android.support.v7.widget.GridLayout gl)
  2. {
  3. Button buttontemp;
  4. //Stretch buttons
  5. int idealChildWidth = (int) ((gl.getWidth()-20*gl.getColumnCount())/gl.getColumnCount());
  6. for( int i=0; i< gl.getChildCount();i++)
  7. {
  8. buttontemp = (Button) gl.getChildAt(i);
  9. buttontemp.setWidth(idealChildWidth);
  10. }
  11. }

代码示例来源:origin: stackoverflow.com

  1. // TODO Auto-generated method stub
  2. super.onCreate(savedInstanceState);
  3. setContentView(R.layout.emailpopup);
  4. Button btn = (Button) findViewById(R.id.btnmarwa);
  5. btn.setWidth(width/2);

代码示例来源:origin: stackoverflow.com

  1. public void fillview(android.support.v7.widget.GridLayout gl)
  2. {
  3. Button buttontemp;
  4. //Stretch buttons
  5. int idealChildWidth = (int) ((gl.getWidth()-20*gl.getColumnCount())/gl.getColumnCount());
  6. for( int i=0; i< gl.getChildCount();i++)
  7. {
  8. buttontemp = (Button) gl.getChildAt(i);
  9. buttontemp.setWidth(idealChildWidth);
  10. }
  11. }

代码示例来源:origin: stackoverflow.com

  1. OnCreate(Context ctx){
  2. int w = getWidth();
  3. int h = getHeight();
  4. Button B1 = findViewById(R.id.button1);
  5. B1.setWidth(w/3);
  6. --repeat for button2,3 textview--
  7. }

代码示例来源:origin: KrailOrg/krail

  1. /**
  2. * See {@link ButtonOption#apply(MessageBox, Button)}
  3. */
  4. @Override
  5. public void apply(MessageBox messageBox, Button button) {
  6. button.setWidth(width);
  7. }

代码示例来源:origin: stackoverflow.com

  1. public void fillview(android.support.v7.widget.GridLayout gl)
  2. {
  3. Button buttontemp;
  4. //Stretch buttons
  5. int idealChildWidth = (int) ((gl.getWidth()-20*gl.getColumnCount())/gl.getColumnCount());
  6. for( int i=0; i< gl.getChildCount();i++)
  7. {
  8. buttontemp = (Button) gl.getChildAt(i);
  9. buttontemp.setWidth(idealChildWidth);
  10. }
  11. }

代码示例来源:origin: stackoverflow.com

  1. final Button button = (Button) findViewById(R.id.Button01);
  2. int pixels = 30;
  3. button.setOnClickListener(new OnClickListener() {
  4. @Override
  5. public void onClick(View v) {
  6. button.setWidth(pixels);
  7. }
  8. });

代码示例来源:origin: com.vaadin/vaadin-server

  1. resize.setWidth("100%");
  2. resize.setHeight("10px");
  3. resize.setPrimaryStyleName("resize-button");
  4. ok.setWidth("70px");
  5. ok.addClickListener(this::okButtonClick);
  6. cancel.setWidth("70px");
  7. cancel.addClickListener(this::cancelButtonClick);

代码示例来源:origin: stackoverflow.com

  1. DisplayMetrics metrics = new DisplayMetrics();
  2. getWindowManager().getDefaultDisplay().getMetrics(metrics);
  3. btnWidth = metrics.heightPixels/3 - 50;//gap
  4. btnHeight = btnWidth;
  5. Button b1 = (Button) findViewById(R.id.b1);
  6. b1.setHeight(btnWidth);
  7. b1.setWidth(btnWidth);

代码示例来源:origin: stackoverflow.com

  1. private void setButtonSize(AlertDialog dialog) {
  2. Button button = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
  3. int height = getResources().getDimensionPixelSize(R.dimen.alertdialog_button_height);
  4. int width = getResources().getDimensionPixelSize(R.dimen.alertdialog_button_width);
  5. button.setHeight(height);
  6. button.setWidth(width);
  7. }

代码示例来源:origin: stackoverflow.com

  1. Button bt=(Button)findViewById(R.id.button);
  2. bt.setWidth(width);//screen width(fill_parent)
  3. bt.setHeight(height/6);//1/6 of the screen height

代码示例来源:origin: stackoverflow.com

  1. final Button button1 = (Button) findViewById(R.id.button1);
  2. final Button button2 = (Button) findViewById(R.id.button2);
  3. button1.post(new Runnable() {
  4. @Override
  5. public void run() {
  6. int width = button1.getWidth();
  7. button2.setWidth(width);
  8. }
  9. });

代码示例来源:origin: com.github.markash/components

  1. public static Button build(final String caption, final String styleName, final ClickListener listener) {
  2. Button button = new Button(caption);
  3. if (StringUtils.isNotBlank(styleName)) {
  4. button.setStyleName(styleName);
  5. }
  6. button.setWidth(100.0f, Unit.PERCENTAGE);
  7. if (listener != null) {
  8. button.addClickListener(listener);
  9. }
  10. return button;
  11. }

代码示例来源:origin: com.github.markash/components

  1. public static Button build(final String caption, final VaadinIcons icon, final ClickListener listener) {
  2. Button button = new Button(caption);
  3. button.setIcon(icon);
  4. button.setWidth(100.0f, Unit.PERCENTAGE);
  5. if (listener != null) {
  6. button.addClickListener(listener);
  7. }
  8. return button;
  9. }

代码示例来源:origin: org.aperteworkflow/gui-commons

  1. public static Button link(String caption, Resource icon, Button.ClickListener listener) {
  2. Button b = button(caption, null, "link", listener);
  3. b.setIcon(icon);
  4. b.setWidth(b.getWidth() + 10, Sizeable.UNITS_PIXELS);
  5. return b;
  6. }

代码示例来源:origin: kingbbode/spring-boot-ehcache-monitor

  1. private HorizontalLayout createSearchBox() {
  2. HorizontalLayout horizontalLayout = new HorizontalLayout();
  3. this.searchTextField.setWidth("70%");
  4. horizontalLayout.addComponent(this.searchTextField);
  5. Button button = new Button(VaadinIcons.SEARCH);
  6. button.addClickListener(event -> searchAction());
  7. button.setWidth("30%");
  8. horizontalLayout.addComponent(button);
  9. return horizontalLayout;
  10. }

代码示例来源:origin: org.activiti/activiti-explorer

  1. protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) {
  2. Button button = new Button(label);
  3. button.addStyleName(type);
  4. button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON);
  5. button.addStyleName(Reindeer.BUTTON_LINK);
  6. button.setHeight(54, UNITS_PIXELS);
  7. button.setIcon(icon);
  8. button.setWidth(width, UNITS_PIXELS);
  9. addComponent(button);
  10. setComponentAlignment(button, Alignment.TOP_CENTER);
  11. return button;
  12. }

相关文章