本文整理汇总了Java中com.jfoenix.controls.JFXTabPane类的典型用法代码示例。如果您正苦于以下问题:Java JFXTabPane类的具体用法?Java JFXTabPane怎么用?Java JFXTabPane使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JFXTabPane类属于com.jfoenix.controls包,在下文中一共展示了JFXTabPane类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.jfoenix.controls.JFXTabPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
try {
// Image setting = new Image(getClass().getResourceAsStream("setting.png"j));
Image logoimg = new Image(getClass().getResourceAsStream("logo.png"));
// Button settingbtn = new Button("",new ImageView(setting));
// settingLabel.setStyle("-fx-background-color:#1d1d1d");
JFXButton logobtn = new JFXButton("",new ImageView(logoimg));
Label title = new Label(" Energy Saving System");
title.setFont(new Font(30));
title.setPrefSize(650, 60);
title.setStyle("-fx-background-color:#1d1d1d; \n -fx-text-fill:white ;");
HBox hbox = new HBox();
hbox.setStyle("-fx-background-color:#1d1d1d");
hbox.setSpacing(10);
hbox.setPadding(new Insets(10,10,10,10));
hbox.getChildren().addAll(logobtn,title);
BorderPane root = new BorderPane();
root.setTop(hbox);
JFXTabPane pane = new JFXTabPane();
pane.setSide(Side.RIGHT);
Tab tab1 = new Tab();
Tab tab2 = new Tab();
Tab tab3 = new Tab();
tab3.setText("Settings");
tab2.setText("Tweaks");
tab2.setContent(new Tweaks().getPane());
tab1.setText("Statistics");
tab1.setContent(new ChartControls().getPane());
pane.getTabs().addAll(tab1,tab2,tab3);
root.setCenter(pane);
Scene scene = new Scene(root,910,550);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
示例2: start
import com.jfoenix.controls.JFXTabPane; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
BorderPane root = new BorderPane();
JFXTabPane tabPane = new JFXTabPane();
Tab tab1 = new Tab();
tab1.setText("Graph Tab");
Tab tab2 = new Tab();
tab2.setText("Empty Tab");
BorderPane gPane = new BorderPane();
CategoryAxis x = new CategoryAxis();
x.setLabel("Visited Sites");
NumberAxis y = new NumberAxis();
y.setLabel("Hits");
lineChart = new LineChart<>(x, y);
set2 = new XYChart.Series<>();
set2.getData().add(new XYChart.Data("Ramzan",62));
// set2.getData().add(new XYChart.Data("Hussan",421));
// set2.getData().add(new XYChart.Data("Shoaib",92));
// set2.getData().add(new XYChart.Data("Sudo",42));
lineChart.setTitle("History Statistics");
lineChart.getData().add(set2);
JFXButton button = new JFXButton("add");
button.addEventHandler(MouseEvent.MOUSE_CLICKED, e ->{
set2.getData().remove(0);
set2.getData().add(new XYChart.Data("chhala",45));
});
gPane.setCenter(lineChart);
gPane.setLeft(button);
tab1.setContent(gPane);
tabPane.getTabs().addAll(tab1,tab2);
root.setCenter(tabPane);
Scene scene = new Scene(root,800,600);
stage.setScene(scene);
stage.show();
final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
Random rand = new Random();
System.out.println(set2.getData().size());
java.util.Date date = new java.util.Date();
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
set2.getData().add(new XYChart.Data(timeFormat.format(date),rand.nextInt(20)));
}
}, 0, 1, TimeUnit.SECONDS);
}
示例3: setTabPane
import com.jfoenix.controls.JFXTabPane; //导入依赖的package包/类
/**
* getting the tabpane and borderpane.
*/
public void setTabPane(JFXTabPane tabPane, BorderPane borderPane) {
this.tabPane = tabPane;
System.out.println("Tab Pane is: " + tabPane);
this.borderPane = borderPane;
}
示例4: getJFXTabPane
import com.jfoenix.controls.JFXTabPane; //导入依赖的package包/类
public JFXTabPane getJFXTabPane() {
return jfxTabPane;
}
示例5: start
import com.jfoenix.controls.JFXTabPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Tabs");
JFXTabPane tabPane = new JFXTabPane();
Tab tab = new Tab();
tab.setText(msg);
tab.setContent(new Label(TAB_0));
tabPane.getTabs().add(tab);
tabPane.setPrefSize(300, 200);
Tab tab1 = new Tab();
tab1.setText(TAB_01);
tab1.setContent(new Label(TAB_01));
tabPane.getTabs().add(tab1);
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
selectionModel.select(1);
JFXButton button = new JFXButton("New Tab");
button.setOnMouseClicked((o) -> {
Tab temp = new Tab();
int count = tabPane.getTabs().size();
temp.setText(msg + count);
temp.setContent(new Label(TAB_0 + count));
tabPane.getTabs().add(temp);
});
tabPane.setMaxWidth(500);
HBox hbox = new HBox();
hbox.getChildren().addAll(button, tabPane);
hbox.setSpacing(50);
hbox.setAlignment(Pos.CENTER);
hbox.setStyle("-fx-padding:20");
Group root = new Group();
Scene scene = new Scene(root, 700, 250);
root.getChildren().addAll(hbox);
scene.getStylesheets().add(TabsDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
primaryStage.setTitle("JFX Tabs Demo");
primaryStage.setScene(scene);
primaryStage.show();
}