This discussion is archived
5 Replies Latest reply: Jul 8, 2013 1:12 AM by 963782 RSS

How to iconify the primary stage which has no default decoration.

963782 Newbie
Currently Being Moderated

When I use initStage(StageStyle.UNDECORATED) to customize my own window's border other than the local platform window's border. But in that case, we can not iconify the primary stage when we click the icon in the task bar of Windows 7. The JDK 7u21, JavaFX 2.2 are used.

 

When I tested other programs with custom window borders (although I did not know by which language it is developed), there is no such iconification problem.

 

Thanks for your help

 

A simple JavaFX application for test:

 

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class TestBox extends Application {
  @Override
  public void start(Stage primaryStage) throws Exception {
  ChoiceBox choiceBox = new ChoiceBox(FXCollections.observableArrayList(
  "choice 1", "choice 2", "choice 3"));
  ComboBox comboBox = new ComboBox(FXCollections.observableArrayList(
  "combo 1", "combo 2", "combo 3"));
  ScrollPane scrollPane = new ScrollPane();
  FlowPane flowPane = new FlowPane();
  flowPane.getChildren().addAll(choiceBox, comboBox);
  scrollPane.setContent(flowPane);
  Scene scene = new Scene(scrollPane);
  primaryStage.setScene(scene);
  primaryStage.initStyle(StageStyle.UNDECORATED);
  primaryStage.show();
  }
  public static void main(String[] args) {
  launch(args);
  }
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points