本文整理匯總了Java中com.vaadin.ui.Button.setCaption方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.setCaption方法的具體用法?Java Button.setCaption怎麽用?Java Button.setCaption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Button
的用法示例。
在下文中一共展示了Button.setCaption方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateAutoScrollButtonCaption
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void updateAutoScrollButtonCaption(Button btn) {
if(((PersephoneUI)getUI()).getUserData().isTailAutoScrollEnabled()) {
btn.setCaption("Disable auto scroll");
} else {
btn.setCaption("Enable auto scroll");
}
}
示例2: addHeaderAndButtons
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void addHeaderAndButtons() {
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("80%");
Label header = new Label("Message Console");
header.addStyleName(ValoTheme.LABEL_H2);
Button showButton = new Button("");
showButton.setCaption("Show");
showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
showButton.addClickListener(click -> {
System.out.println("[x] Show button clicked ...");
dataGrid.setItems();
});
Button sendButton = new Button("");
sendButton.setCaption("Send");
sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
sendButton.setIcon(VaadinIcons.PLUS);
sendButton.addClickListener(click -> {
System.out.println("[x] Send button clicked ...");
Runnable runner = new Runnable() {
@Override
public void run() {
sender.send();
}
};
new Thread(runner).start();
});
topLayout.addComponent(header);
topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
topLayout.addComponent(showButton);
topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
topLayout.addComponent(sendButton);
topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);
addComponent(topLayout);
}
示例3: addHeaderAndButtons
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void addHeaderAndButtons() {
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("80%");
Label header = new Label("Streaming Console");
header.addStyleName(ValoTheme.LABEL_H2);
Button showButton = new Button("");
showButton.setCaption("Stream");
showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
showButton.addClickListener(click -> {
System.out.println("[x] Show button clicked ...");
// Start the data feed thread
new FeederThread().start();
});
Button sendButton = new Button("");
sendButton.setCaption("Send");
sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
sendButton.setIcon(VaadinIcons.PLUS);
sendButton.addClickListener(click -> {
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("[x] Send button clicked ...");
sender.stream();
}
};
new Thread(r).start();
});
topLayout.addComponent(header);
topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
topLayout.addComponent(showButton);
topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
topLayout.addComponent(sendButton);
topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);
addComponent(topLayout);
}
示例4: addVoltronCommandsControls
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void addVoltronCommandsControls() {
serverControls = new GridLayout();
serverControls.setWidth(50, Unit.PERCENTAGE);
voltronControlLayout.addComponentsAndExpand(serverControls);
HorizontalLayout row1 = new HorizontalLayout();
Button clusterStartBtn = new Button();
clusterStartBtn.setCaption("Start all servers");
clusterStartBtn.addStyleName("align-bottom");
clusterStartBtn.addClickListener(event -> {
for (Component child : serverControls) {
if (child instanceof Button && "START".equals(child.getCaption()) && child.isEnabled()) {
((Button) child).click();
}
}
});
row1.addComponents(clusterStartBtn);
if (kitAwareClassLoaderDelegator.isEEKit()) {
clusterNameTF = new TextField();
clusterNameTF.setCaption("Cluster name");
clusterNameTF.setValue("MyCluster");
Button clusterConfigBtn = new Button();
clusterConfigBtn.addStyleName("align-bottom");
clusterConfigBtn.setCaption("Configure");
clusterConfigBtn.setData("configure");
clusterConfigBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);
Button clusterReConfigBtn = new Button();
clusterReConfigBtn.addStyleName("align-bottom");
clusterReConfigBtn.setCaption("Reconfigure");
clusterReConfigBtn.setData("reconfigure");
clusterReConfigBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);
Button clusterBackupBtn = new Button();
clusterBackupBtn.addStyleName("align-bottom");
clusterBackupBtn.setCaption("Backup");
clusterBackupBtn.setData("backup");
clusterBackupBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);
Button clusterDumpBtn = new Button();
clusterDumpBtn.addStyleName("align-bottom");
clusterDumpBtn.setCaption("Dump");
clusterDumpBtn.setData("dump");
clusterDumpBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);
Button clusterStopBtn = new Button();
clusterStopBtn.addStyleName("align-bottom");
clusterStopBtn.setCaption("Stop cluster");
clusterStopBtn.setData("stop");
clusterStopBtn.addClickListener((Button.ClickListener) this::executeClusterToolCommand);
row1.addComponents(clusterNameTF, clusterConfigBtn, clusterReConfigBtn, clusterBackupBtn, clusterDumpBtn, clusterStopBtn);
}
voltronControlLayout.addComponentsAndExpand(row1);
consoles = new TabSheet();
mainConsole = addConsole("Main", "main");
voltronControlLayout.addComponentsAndExpand(consoles);
}
示例5: updateServerControls
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private void updateServerControls() {
int nStripes = serverGrid.getRows() - 1;
int nServersPerStripe = serverGrid.getColumns() - 1;
serverControls.removeAllComponents();
serverControls.setRows(nStripes * nServersPerStripe);
serverControls.setColumns(5);
for (int i = consoles.getComponentCount() - 1; i > 0; i--) {
consoles.removeTab(consoles.getTab(i));
}
for (int stripeId = 1; stripeId < serverGrid.getRows(); stripeId++) {
String stripeName = "stripe-" + stripeId;
for (int serverId = 1; serverId < serverGrid.getColumns(); serverId++) {
FormLayout form = (FormLayout) serverGrid.getComponent(serverId, stripeId);
if (form != null) {
TextField serverNameTF = (TextField) form.getComponent(0);
String serverName = serverNameTF.getValue();
serverControls.addComponent(new Label(serverName));
Button startBT = new Button();
startBT.setCaption("START");
startBT.setData(serverName);
startBT.setStyleName("align-top");
serverControls.addComponent(startBT);
Button stopBT = new Button();
stopBT.setEnabled(false);
stopBT.setCaption("STOP");
stopBT.setStyleName("align-top");
stopBT.setData(serverName);
serverControls.addComponent(stopBT);
Label pid = new Label();
serverControls.addComponent(pid);
Label state = new Label();
serverControls.addComponent(state);
addConsole(serverName, stripeName + "-" + serverName);
startBT.addClickListener((Button.ClickListener) event -> {
startServer(stripeName, (String) event.getButton().getData(), startBT, stopBT, state, pid);
});
stopBT.addClickListener((Button.ClickListener) event -> {
stopServer(stripeName, (String) event.getButton().getData(), stopBT);
});
}
}
}
}